|
|
@@ -0,0 +1,1273 @@
|
|
|
+using AutoMapper;
|
|
|
+using CSRedis;
|
|
|
+using Microsoft.AspNetCore.Http;
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
+using Newtonsoft.Json;
|
|
|
+using Org.BouncyCastle.Crypto;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Diagnostics;
|
|
|
+using System.Linq;
|
|
|
+using wms.api.Job;
|
|
|
+using wms.dto;
|
|
|
+using wms.dto.request;
|
|
|
+using wms.dto.request.hj;
|
|
|
+using wms.dto.request.hj.dto;
|
|
|
+using wms.dto.request.share;
|
|
|
+using wms.dto.response;
|
|
|
+using wms.dto.response.hj;
|
|
|
+using wms.dto.response.share;
|
|
|
+using wms.service;
|
|
|
+using wms.service.IService;
|
|
|
+using wms.sqlsugar;
|
|
|
+using wms.sqlsugar.model.hj;
|
|
|
+using wms.util;
|
|
|
+using wms.util.Check;
|
|
|
+using wms.util.Ext;
|
|
|
+using wms.util.Http;
|
|
|
+
|
|
|
+namespace wms.api.Controllers
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// 合金库控制器
|
|
|
+ /// </summary>
|
|
|
+ [Route("api/[controller]/[action]")]
|
|
|
+ [ApiController]
|
|
|
+ public class HjController : BaseController
|
|
|
+ {
|
|
|
+ private readonly IHJService _hJService;
|
|
|
+ private readonly ILogger<HjController> _logger;
|
|
|
+ private readonly IMapper _mapper;
|
|
|
+ static object lockerCopperLineReceiveInstr = new object();
|
|
|
+ static object lockerWetLineBackInApply = new object();
|
|
|
+ static object lockerStockChange = new object();
|
|
|
+ static object lockerSpecialPickMaterApply = new object();
|
|
|
+ static object lockerSyncMaterInfoList = new object();
|
|
|
+ static object lockerApplyStockOutTask = new object();
|
|
|
+ static object lockerWetLinePickMaterApply = new object();
|
|
|
+ static object lockerCompleteTask = new object();
|
|
|
+ static object lockerApplyStockInLoc = new object();
|
|
|
+ static object lockerMoveTask = new object();
|
|
|
+ static object lockerSrmPickOutCompleted = new object();
|
|
|
+ static object lockWcsUploadInfo = new object();
|
|
|
+ static object lockerMannel = new object();
|
|
|
+ static object lockerCarryTask = new object();
|
|
|
+ static object lockerStockInfo = new object();
|
|
|
+ static object lockerPdaTaskInfo = new object();
|
|
|
+ static object lockerCancelOrComplet = new object();
|
|
|
+
|
|
|
+ Repository<SysJob> _sysJobrepository => new Repository<SysJob>();
|
|
|
+ public HjController(IHJService hJService, ILogger<HjController> logger, IMapper mapper) :base(hJService, logger)
|
|
|
+ {
|
|
|
+ _hJService = hJService;
|
|
|
+ _logger= logger;
|
|
|
+ _mapper = mapper;
|
|
|
+ }
|
|
|
+
|
|
|
+ #region 业务方法
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 更新任务进程
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqEntity"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes<int> WcsTaskCallBack(WcsTaskCallBackRequest reqEntity)
|
|
|
+ {
|
|
|
+ return _hJService.WcsTaskCallBack(reqEntity);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 获取巷道
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqEntity"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes<string> GetTunnelPriorityList(GetTunnelPriorityListRequest reqEntity)
|
|
|
+ {
|
|
|
+ return _hJService.GetTunnelPriorityList(reqEntity);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 分配货位
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqEntity"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes<ApplyStockInLocResponse> ApplyStockInLoc(ApplyStockInLocRequest reqEntity)
|
|
|
+ {
|
|
|
+ return ConcurrencyReqControl<ApplyStockInLocRequest, SRes<ApplyStockInLocResponse>>(lockerApplyStockInLoc, "ApplyStockInLoc" + reqEntity.TunnelNum, "分配货位" + reqEntity.PickUpEquipmentNo, reqEntity, _hJService.ApplyStockInLoc);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 完成任务
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqEntity"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes<int> CompleteTask(CompleteTaskRequest reqDto)
|
|
|
+ {
|
|
|
+ lock (lockerCompleteTask)
|
|
|
+ {
|
|
|
+ return _hJService.CompleteTask(reqDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 申请移库任务
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqEntity"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes<AddWcsMoveTaskResponse> AddWcsMoveTask(AddWcsMoveTaskRequest reqEntity)
|
|
|
+ {
|
|
|
+ lock (lockerMoveTask)
|
|
|
+ {
|
|
|
+ return _hJService.AddWcsMoveTask(reqEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 堆垛机出库放货完成
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqEntity"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes<int> SrmPickOutCompleted(SrmPickOutCompletedRequest reqDto)
|
|
|
+ {
|
|
|
+ lock (lockerSrmPickOutCompleted)
|
|
|
+ {
|
|
|
+ return _hJService.SrmPickOutCompleted(reqDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// WCS信息上传
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqEntity"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes WcsUploadInfo(WcsUploadInfoRequest reqDto)
|
|
|
+ {
|
|
|
+ lock (lockWcsUploadInfo)
|
|
|
+ {
|
|
|
+ //if (reqDto.Weight > 1)
|
|
|
+ //{
|
|
|
+ // var webBaseUrl = AppSettings.GetConfig("maxweight");
|
|
|
+ //}
|
|
|
+ return _hJService.WcsUploadInfo(reqDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 物料主数据推送接口
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqBody"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes SyncMaterInfoList(HJSyncMaterInfoListRequest reqDto)
|
|
|
+ {
|
|
|
+ var res = new SRes();
|
|
|
+ if (string.IsNullOrEmpty(reqDto.ReqId))
|
|
|
+ {
|
|
|
+ res.ResCode = ResponseStatusCodeEnum.NotReqId.GetHashCode();
|
|
|
+ res.ResMsg = ResponseStatusCodeEnum.NotReqId.GetDescription();
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (reqDto.ListInfo == null || !reqDto.ListInfo.Any())
|
|
|
+ {
|
|
|
+ res.ResCode = ResponseStatusCodeEnum.DocDetailNotExist.GetHashCode();
|
|
|
+ res.ResMsg = ResponseStatusCodeEnum.DocDetailNotExist.GetDescription();
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ return ConcurrencyReqControl<HJSyncMaterInfoListRequest, SRes>(lockerSyncMaterInfoList, "SyncMaterInfoList", "物料主数据推送" + reqDto.ReqId, reqDto, _hJService.SyncMaterInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 镀铜满轮入库/550工字轮入库反馈接口
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="billcode"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost(Name = "CopperLineStockInFeedBack")]
|
|
|
+ public CopperLineStockInFeedBackResponse CopperLineStockInFeedBack(string billcode)
|
|
|
+ {
|
|
|
+ var list = _hJService.GetBillFeedbackList(p => p.BillCode == billcode && p.ApiCode == "CopperLineStockInFeedBack" && p.PostResult == 0 ||( p.PostResult == 2 && p.PostNum < 5));
|
|
|
+ if (!list.Any())
|
|
|
+ {
|
|
|
+ return new CopperLineStockInFeedBackResponse() { ResCode = ResponseStatusCodeEnum.NoResult.GetHashCode(), ResMsg = ResponseStatusCodeEnum.NoResult.GetDescription() };
|
|
|
+ }
|
|
|
+ var dtolist = _mapper.Map<List<CopperLineStockInFeedBackItem>>(list);
|
|
|
+ CopperLineStockInFeedBackRequest dto = new CopperLineStockInFeedBackRequest();
|
|
|
+ dto.ListInfo = dtolist;
|
|
|
+ CopperLineStockInFeedBackResponse resbody = JsonConvert.DeserializeObject<CopperLineStockInFeedBackResponse>(WmsServiceExportApi(dto));
|
|
|
+ List<long> ids = list.Select(p => p.Id).ToList();
|
|
|
+ List<string> doccodelist = list.Select(p => p.BillCode).ToList();
|
|
|
+ if (resbody.ResCode == ResponseStatusCodeEnum.Sucess.GetHashCode())
|
|
|
+ {
|
|
|
+ //更新推送表数据
|
|
|
+ _hJService.UpdateBillFeedbackPushModelColumns(new sqlsugar.model.UpdateModelColumns<hjBillFeedbackPush>()
|
|
|
+ {
|
|
|
+ Columns = it => new hjBillFeedbackPush { PostResult = 1, PostNum = it.PostNum + 1 },
|
|
|
+ WhereExpression = it => ids.Contains(it.Id)
|
|
|
+ });
|
|
|
+ //删除单据表数据
|
|
|
+ _hJService.DeleteDoc(p => doccodelist.Contains(p.DocNo));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //更新推送表数据
|
|
|
+ _hJService.UpdateBillFeedbackPushModelColumns(new sqlsugar.model.UpdateModelColumns<hjBillFeedbackPush>()
|
|
|
+ {
|
|
|
+ Columns = it => new hjBillFeedbackPush { PostResult = 2, PostNum = it.PostNum + 1 },
|
|
|
+ WhereExpression = it => ids.Contains(it.Id)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return resbody;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 湿拉生产退料/余料反馈接口
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="billcode"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost(Name = "WetLineBackInFeedBack")]
|
|
|
+ public WetLineBackInFeedBackResponse WetLineBackInFeedBack(string billcode)
|
|
|
+ {
|
|
|
+ var list = _hJService.GetBillFeedbackList(p => p.BillCode == billcode && p.ApiCode == "WetLineBackInFeedBack" && p.PostResult == 0 || (p.PostResult == 2 && p.PostNum < 5));
|
|
|
+ var dtolist = _mapper.Map<List<WetLineBackInFeedBackRequestItem>>(list);
|
|
|
+ var dto = new WetLineBackInFeedBackRequest() { ListInfo = dtolist };
|
|
|
+ WetLineBackInFeedBackResponse resbody = JsonConvert.DeserializeObject<WetLineBackInFeedBackResponse>(WmsServiceExportApi(dtolist));
|
|
|
+ List<long> ids = list.Select(p => p.Id).ToList();
|
|
|
+ List<string> doccodelist = list.Select(p => p.BillCode).ToList();
|
|
|
+ if (resbody.ResCode == ResponseStatusCodeEnum.Sucess.GetHashCode())
|
|
|
+ {
|
|
|
+ //更新推送表数据
|
|
|
+ _hJService.UpdateBillFeedbackPushModelColumns(new sqlsugar.model.UpdateModelColumns<hjBillFeedbackPush>()
|
|
|
+ {
|
|
|
+ Columns = it => new hjBillFeedbackPush { PostResult = 1, PostNum = it.PostNum + 1 },
|
|
|
+ WhereExpression = it => ids.Contains(it.Id)
|
|
|
+ });
|
|
|
+ //删除单据表数据
|
|
|
+ _hJService.DeleteDoc(p => doccodelist.Contains(p.DocNo));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //更新推送表数据
|
|
|
+ _hJService.UpdateBillFeedbackPushModelColumns(new sqlsugar.model.UpdateModelColumns<hjBillFeedbackPush>()
|
|
|
+ {
|
|
|
+ Columns = it => new hjBillFeedbackPush { PostResult = 2, PostNum = it.PostNum + 1 },
|
|
|
+ WhereExpression = it => ids.Contains(it.Id)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return resbody;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 改判反馈接口
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="billcode"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost(Name = "StockChangeFeedBack")]
|
|
|
+ public StockChangeFeedBackResponse StockChangeFeedBack(string billcode)
|
|
|
+ {
|
|
|
+ var list = _hJService.GetBillFeedbackList(p => p.BillCode == billcode);
|
|
|
+ var dtolist = _mapper.Map<List<StockChangeRequestItem>>(list);
|
|
|
+ StockChangeFeedBackRequest dto = new StockChangeFeedBackRequest() { BillCode = billcode };
|
|
|
+ dto.ListInfo = dtolist;
|
|
|
+ StockChangeFeedBackResponse resbody = JsonConvert.DeserializeObject<StockChangeFeedBackResponse>(WmsServiceExportApi(dto));
|
|
|
+ List<long> ids = list.Select(p => p.Id).ToList();
|
|
|
+ List<string> doccodelist = list.Select(p => p.BillCode).ToList();
|
|
|
+ if (resbody.ResCode == ResponseStatusCodeEnum.Sucess.GetHashCode())
|
|
|
+ {
|
|
|
+ //更新推送表数据
|
|
|
+ _hJService.UpdateBillFeedbackPushModelColumns(new sqlsugar.model.UpdateModelColumns<hjBillFeedbackPush>()
|
|
|
+ {
|
|
|
+ Columns = it => new hjBillFeedbackPush { PostResult = 1, PostNum = it.PostNum + 1 },
|
|
|
+ WhereExpression = it => ids.Contains(it.Id)
|
|
|
+ });
|
|
|
+ //删除单据表数据
|
|
|
+ _hJService.DeleteDoc(p => doccodelist.Contains(p.DocNo));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //更新推送表数据
|
|
|
+ _hJService.UpdateBillFeedbackPushModelColumns(new sqlsugar.model.UpdateModelColumns<hjBillFeedbackPush>()
|
|
|
+ {
|
|
|
+ Columns = it => new hjBillFeedbackPush { PostResult = 2, PostNum = it.PostNum + 1 },
|
|
|
+ WhereExpression = it => ids.Contains(it.Id)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return resbody;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 特殊料反馈接口
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="billcode"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost(Name = "SpecialPickMaterFeedBack")]
|
|
|
+ public SpecialPickMaterFeedBackResponse SpecialPickMaterFeedBack(string billcode)
|
|
|
+ {
|
|
|
+ var list = _hJService.GetBillFeedbackList(p => p.BillCode == billcode && p.ApiCode == "SpecialPickMaterFeedBack" && p.PostResult == 0 || (p.PostResult == 2 && p.PostNum < 5));
|
|
|
+ var dtolist = _mapper.Map<List<SpecialPickMaterFeedBackRequestItem>>(list);
|
|
|
+ SpecialPickMaterFeedBackRequest dto = new SpecialPickMaterFeedBackRequest() { ListInfo = dtolist };
|
|
|
+ SpecialPickMaterFeedBackResponse resbody = JsonConvert.DeserializeObject<SpecialPickMaterFeedBackResponse>(WmsServiceExportApi(dtolist));
|
|
|
+ List<long> ids = list.Select(p => p.Id).ToList();
|
|
|
+ List<string> doccodelist = list.Select(p => p.BillCode).ToList();
|
|
|
+ if (resbody.ResCode == ResponseStatusCodeEnum.Sucess.GetHashCode())
|
|
|
+ {
|
|
|
+ //更新推送表数据
|
|
|
+ _hJService.UpdateBillFeedbackPushModelColumns(new sqlsugar.model.UpdateModelColumns<hjBillFeedbackPush>()
|
|
|
+ {
|
|
|
+ Columns = it => new hjBillFeedbackPush { PostResult = 1, PostNum = it.PostNum + 1 },
|
|
|
+ WhereExpression = it => ids.Contains(it.Id)
|
|
|
+ });
|
|
|
+ //删除单据表数据
|
|
|
+ _hJService.DeleteDoc(p => doccodelist.Contains(p.DocNo));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //更新推送表数据
|
|
|
+ _hJService.UpdateBillFeedbackPushModelColumns(new sqlsugar.model.UpdateModelColumns<hjBillFeedbackPush>()
|
|
|
+ {
|
|
|
+ Columns = it => new hjBillFeedbackPush { PostResult = 2, PostNum = it.PostNum + 1 },
|
|
|
+ WhereExpression = it => ids.Contains(it.Id)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return resbody;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 移库货位上报MES接口
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="billcode"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost(Name = "MoveStockFeedBack")]
|
|
|
+ public MoveStockFeedBackResponse MoveStockFeedBack(string billcode)
|
|
|
+ {
|
|
|
+ var list = _hJService.GetBillFeedbackList1(p => p.DocsNo == billcode && p.TypeCode == "MoveStockFeedBack" && p.PostResult == 0 || (p.PostResult == 2 && p.PostQty < 5));
|
|
|
+ var dtolist = _mapper.Map<List<MoveStockFeedBackRequestItem>>(list);
|
|
|
+ MoveStockFeedBackRequest dto = new MoveStockFeedBackRequest() { ListInfo = dtolist };
|
|
|
+ MoveStockFeedBackResponse resbody = JsonConvert.DeserializeObject<MoveStockFeedBackResponse>(WmsServiceExportApi(dto));
|
|
|
+ List<long> ids = list.Select(p => p.Id).ToList();
|
|
|
+ List<string> doccodelist = list.Select(p => p.DocsNo).ToList();
|
|
|
+ if (resbody.ResCode == ResponseStatusCodeEnum.Sucess.GetHashCode())
|
|
|
+ {
|
|
|
+ //更新推送表数据
|
|
|
+ _hJService.UpdateBillFeedbackPushModelColumns(new sqlsugar.model.UpdateModelColumns<hjBillFeedbackPush>()
|
|
|
+ {
|
|
|
+ Columns = it => new hjBillFeedbackPush { PostResult = 1, PostNum = it.PostNum + 1 },
|
|
|
+ WhereExpression = it => ids.Contains(it.Id)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //更新推送表数据
|
|
|
+ _hJService.UpdateBillFeedbackPushModelColumns(new sqlsugar.model.UpdateModelColumns<hjBillFeedbackPush>()
|
|
|
+ {
|
|
|
+ Columns = it => new hjBillFeedbackPush { PostResult = 2, PostNum = it.PostNum + 1 },
|
|
|
+ WhereExpression = it => ids.Contains(it.Id)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return resbody;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 条码信息查询接口
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="billcode"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost(Name = "GetBarCodeInfo")]
|
|
|
+ public GetBarCodeInfoResponse GetBarCodeInfo(GetBarCodeInfoRequest barcode)
|
|
|
+ {
|
|
|
+ GetBarCodeInfoResponse resbody = JsonConvert.DeserializeObject<GetBarCodeInfoResponse>(WmsServiceExportApi(barcode));
|
|
|
+ return resbody;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 镀铜补空/取满指令接收接口(包含550工字轮)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqDto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost(Name = "CopperLineReceiveInstr")]
|
|
|
+ public SRes CopperLineReceiveInstr(CopperLineNewRequest reqDtoList)
|
|
|
+ {
|
|
|
+ var res = new SRes();
|
|
|
+ if (reqDtoList != null && reqDtoList.data!= null && reqDtoList.data.Any())
|
|
|
+ {
|
|
|
+ foreach (var reqDto in reqDtoList.data)
|
|
|
+ {
|
|
|
+ res = ConcurrencyReqControl<CopperLineRequest, SRes>(lockerCopperLineReceiveInstr, "CopperLineReceiveInstr" + reqDto.WbCode, reqDto.WbCode, reqDto, _hJService.CopperLineReceiveInstr);
|
|
|
+ if (res.ResCode != ResponseStatusCodeEnum.Sucess.GetHashCode())
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 镀铜补空/取满指令接收接口(手持机用)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqDto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost(Name = "PdaCopperLineReceiveInstr")]
|
|
|
+ public SRes PdaCopperLineReceiveInstr(CopperLineRequest reqDto)
|
|
|
+ {
|
|
|
+ return ConcurrencyReqControl<CopperLineRequest, SRes>(lockerCopperLineReceiveInstr, "CopperLineReceiveInstr" + reqDto.WbCode, reqDto.WbCode, reqDto, _hJService.PdaCopperLineReceiveInstr);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 申请出库任务
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqDto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public ApplyStockOutTaskResponse ApplyStockOutTask(ApplyStockOutTaskRequest reqDto)
|
|
|
+ {
|
|
|
+ var result = new ApplyStockOutTaskResponse();
|
|
|
+ if (reqDto.OutType == 2)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(reqDto.Tunnel))
|
|
|
+ {
|
|
|
+ return new ApplyStockOutTaskResponse()
|
|
|
+ {
|
|
|
+ ResCode = ResponseStatusCodeEnum.ErrParam.GetHashCode(),
|
|
|
+ ResMsg = "巷道值没有传值"
|
|
|
+ };
|
|
|
+ }
|
|
|
+ var req = new ApplyEmptySpoolRequest() { Tunnel = int.Parse(reqDto.Tunnel),OutEndPostion = reqDto.OutEndPostion };
|
|
|
+ return ConcurrencyReqControl<ApplyEmptySpoolRequest, ApplyStockOutTaskResponse>(lockerApplyStockOutTask, "ApplyStockOutTask" + reqDto.OutEndPostion, reqDto.OutEndPostion, req, _hJService.ApplyEmptySpoolService);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取巷道空轮数量
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes<GetTunnelEmptyConResponse> GetTunnelEmptyConCount(GetTunnelEmptyConCountRequest reqDto)
|
|
|
+ {
|
|
|
+ return _hJService.GetTunnelEmptyConCount(reqDto);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 库存改判
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqDto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost(Name = "StockChange")]
|
|
|
+ public StockChangeResponse StockChange(StockChangeRequest reqDto)
|
|
|
+ {
|
|
|
+ return ConcurrencyReqControl<StockChangeRequest, StockChangeResponse>(lockerStockChange, "StockChange" + reqDto.BillCode, reqDto.BillCode, reqDto, _hJService.StockChange);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 特殊出库领料申请接口
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqDto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost(Name = "SpecialPickMaterApply")]
|
|
|
+ public SpecialPickMaterApplyResponse SpecialPickMaterApply(SpecialPickMaterApplyRequest reqDto)
|
|
|
+ {
|
|
|
+ return ConcurrencyReqControl<SpecialPickMaterApplyRequest, SpecialPickMaterApplyResponse>(lockerSpecialPickMaterApply, "SpecialPickMaterApply" + reqDto.MatBarCode, reqDto.MatBarCode, reqDto, _hJService.SpecialPickMaterApply);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 实时库存查询接口
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqDto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public GetCurStockListResponse GetCurStockList(GetCurStockListRequest reqDto)
|
|
|
+ {
|
|
|
+ return _hJService.GetCurStockList(reqDto);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region RCS调用接口
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 镀铜一楼res下任务
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqDto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public GenAgvSchedulingTaskResponse CopperLineAgvTaskToRcs(GenAgvSchedulingTaskRequest reqDto)
|
|
|
+ {
|
|
|
+ var result = new GenAgvSchedulingTaskResponse();
|
|
|
+ //GenAgvSchedulingTaskRequest resReq = new GenAgvSchedulingTaskRequest();
|
|
|
+ var apiurl = wms.util.AppSettings.GetConfig("RcsCreateTaskPushUrl");
|
|
|
+ var strRes = HttpUtil.PostRequest(apiurl, JsonConvert.SerializeObject(reqDto), 30000);
|
|
|
+ if (string.IsNullOrEmpty(strRes))
|
|
|
+ {
|
|
|
+ result.message = "返回空";
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ return JsonConvert.DeserializeObject<GenAgvSchedulingTaskResponse>(strRes);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 镀铜一楼res继续任务
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqDto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public GenAgvSchedulingTaskResponse CopperLineContinueTaskToRcs(GenAgvSchedulingTaskRequest reqDto)
|
|
|
+ {
|
|
|
+ var result = new GenAgvSchedulingTaskResponse();
|
|
|
+ //GenAgvSchedulingTaskRequest resReq = new GenAgvSchedulingTaskRequest()
|
|
|
+ //{ };
|
|
|
+ var apiurl = wms.util.AppSettings.GetConfig("RcsContinuePushUrl");
|
|
|
+ var strRes = HttpUtil.PostRequest(apiurl, JsonConvert.SerializeObject(reqDto), 30000);
|
|
|
+ if (string.IsNullOrEmpty(strRes))
|
|
|
+ {
|
|
|
+ result.message = "返回空";
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ return JsonConvert.DeserializeObject<GenAgvSchedulingTaskResponse>(strRes);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 镀铜二楼IWMS下发满轮出库
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqDto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes CopperLineAgvTaskStockOutToIWms(CopperLineAgvTaskStockOutToIWmsRequest reqDto)
|
|
|
+ {
|
|
|
+ var result = new SRes();
|
|
|
+ CopperLineAgvTaskStockOutToIWmsRequest resReq = new CopperLineAgvTaskStockOutToIWmsRequest()
|
|
|
+ {
|
|
|
+ matCode = "",
|
|
|
+ wbCode = "满轮接驳口",
|
|
|
+ inSpoolFull = "1",
|
|
|
+ wetInto = true,
|
|
|
+ wetIntoSpec = false,
|
|
|
+ isSurplus = "",
|
|
|
+ isRework = "",
|
|
|
+ matNo = "",
|
|
|
+ spoolNo = "",
|
|
|
+ gradeCode = "",
|
|
|
+ taskNo = Guid.NewGuid().ToString(),
|
|
|
+
|
|
|
+ };
|
|
|
+ var apiurl = wms.util.AppSettings.GetConfig("IWmsStockOutPushUrl");
|
|
|
+ var strRes = HttpUtil.PostRequest(apiurl, JsonConvert.SerializeObject(reqDto), 30000);
|
|
|
+ if (string.IsNullOrEmpty(strRes))
|
|
|
+ {
|
|
|
+ //result.message = "返回空";
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ return JsonConvert.DeserializeObject<SRes>(strRes);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 镀铜二楼IWMS下发空轮/退料/余料入库
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqDto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes CopperLineAgvTaskStockInToIWms(CopperLineAgvTaskStockInToIWmsRequest reqDto)
|
|
|
+ {
|
|
|
+ var result = new SRes();
|
|
|
+ CopperLineAgvTaskStockInToIWmsRequest resReq = new CopperLineAgvTaskStockInToIWmsRequest()
|
|
|
+ {
|
|
|
+ matCode = "",
|
|
|
+ workAreaCode = "11",
|
|
|
+ outSpoolFull = "1",
|
|
|
+ taskNo = Guid.NewGuid().ToString()
|
|
|
+ };
|
|
|
+ var apiurl = wms.util.AppSettings.GetConfig("IWmsStockInPushUrl");
|
|
|
+ var strRes = HttpUtil.PostRequest(apiurl, JsonConvert.SerializeObject(reqDto), 30000);
|
|
|
+ if (string.IsNullOrEmpty(strRes))
|
|
|
+ {
|
|
|
+ //result.message = "返回空";
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ return JsonConvert.DeserializeObject<SRes>(strRes);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// AGV执行回调
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqDto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public agvCallbackResponse agvCallback(agvCallbackRequest reqDto)
|
|
|
+ {
|
|
|
+ var res = new agvCallbackResponse() { code = "0",message = "成功" };
|
|
|
+
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 复核异常上报接口
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public RfidCheckDiffResponse RfidCheckDiff(RfidCheckDiffRequest request)
|
|
|
+ {
|
|
|
+ var res = new RfidCheckDiffResponse();
|
|
|
+ //异常
|
|
|
+ _hJService.RfidCheckDiffService(request);
|
|
|
+ _logger.LogInformation("复核异常上报接口RfidCheckDiff接收数据:" + JsonConvert.SerializeObject(request));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 湿拉生产退料/余料/空轮申请接口
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes WetLineBackInApply(WetLineBackInApplyRequest reqDto)
|
|
|
+ {
|
|
|
+ return ConcurrencyReqControl<WetLineBackInApplyRequest, SRes>(lockerWetLineBackInApply, "WetLineBackInApply" + reqDto.MatBarCode, reqDto.MatBarCode, reqDto, _hJService.WetLineBackInApplyService);
|
|
|
+ //接收指令
|
|
|
+ //入库逻辑
|
|
|
+ //下发wcs任务
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 湿拉产线领料申请接口WetLinePickMaterApply
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes WetLinePickMaterApply(WetLinePickMaterApplyRequest reqDto)
|
|
|
+ {
|
|
|
+ return ConcurrencyReqControl<WetLinePickMaterApplyRequest, SRes>(lockerWetLinePickMaterApply, "WetLinePickMaterApply" + reqDto.MatCode, reqDto.MatCode, reqDto, _hJService.WetLinePickMaterApplyService);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 定时任务业务
|
|
|
+ /// <summary>
|
|
|
+ /// 添加定时任务
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string AddJob(AddJobRequest request)
|
|
|
+ {
|
|
|
+ request.Id = IdFactory.NewId();
|
|
|
+ return _hJService.AddJob(request);
|
|
|
+ }
|
|
|
+ /// <summar y>
|
|
|
+ /// 编辑定时任务
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string UpdateJobEntity(AddJobRequest request)
|
|
|
+ {
|
|
|
+ return _hJService.UpdateJobEntity(request);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 获取job根据id
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string GetSysJobById(long id)
|
|
|
+ {
|
|
|
+ return JsonConvert.SerializeObject(_hJService.GetSysJobById(id));
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 启用job
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string StartJob(DetailRequest2Str req)
|
|
|
+ {
|
|
|
+ var res = new SRes();
|
|
|
+ var sysjob = _sysJobrepository.GetById(req.Id);
|
|
|
+ if (sysjob == null)
|
|
|
+ {
|
|
|
+ res.ResCode = 0;
|
|
|
+ res.ResMsg = "没有找到对应的定时任务";
|
|
|
+ return res.ToCamelCaseString();
|
|
|
+ }
|
|
|
+ JobScheduler.Start(sysjob.Code, Type.GetType("wms.api.Job.PostJob"), sysjob.CronExpression);
|
|
|
+ return res.ToCamelCaseString();
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 执行job
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqEntity"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string ExecuteJob(DetailCodeRequest reqEntity)
|
|
|
+ {
|
|
|
+ var res = new SRes();
|
|
|
+ if (string.IsNullOrEmpty(reqEntity.Code))
|
|
|
+ {
|
|
|
+ res.ResCode = 0;
|
|
|
+ res.ResMsg = "参数错误";
|
|
|
+ return res.ToCamelCaseString();
|
|
|
+ }
|
|
|
+ var jobEntity = _sysJobrepository.GetSingle(p => p.Code == reqEntity.Code);
|
|
|
+ if (jobEntity == null)
|
|
|
+ {
|
|
|
+ res.ResCode = 0;
|
|
|
+ res.ResMsg = "没有找到该编码";
|
|
|
+ return res.ToCamelCaseString();
|
|
|
+ }
|
|
|
+ var jobapilist = _hJService.GetSysApiDetail(jobEntity.Id);
|
|
|
+ if (jobapilist.Any())
|
|
|
+ {
|
|
|
+ foreach (var item in jobapilist)
|
|
|
+ {
|
|
|
+ Task.Run(() => { HttpUtil.PostRequest(item.ApiUrl, item.RequestBody); });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return res.ToCamelCaseString();
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 分页Job列表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqEntity"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public List<dto.response.hj.SysJobDto> GetSysJobList(GetSysJobListRequest reqEntity)
|
|
|
+ {
|
|
|
+ var list = _sysJobrepository.GetList();
|
|
|
+ var listdto = _mapper.Map<List<dto.response.hj.SysJobDto>>(list);
|
|
|
+ if (listdto != null && listdto.Any())
|
|
|
+ {
|
|
|
+ for (int i = 0; i < list.Count; i++)
|
|
|
+ {
|
|
|
+ listdto[i].JobExecuteStatus = GetExecuteStatus(new DetailCodeRequest() { Code = listdto[i].Code });
|
|
|
+ }
|
|
|
+ return listdto;
|
|
|
+ }
|
|
|
+ return new List<dto.response.hj.SysJobDto>();
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 获取执行状态
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="reqEntity"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string GetExecuteStatus(DetailCodeRequest reqEntity)
|
|
|
+ {
|
|
|
+ var jobInfo = _sysJobrepository.GetFirst(p=>p.Code == reqEntity.Code);
|
|
|
+ var jobs = JobScheduler.GetJobList(Const.JobGroupName).Result;
|
|
|
+ if (jobs != null)
|
|
|
+ {
|
|
|
+ var temp = jobs.Where(p => p.JobName == jobInfo.Code);
|
|
|
+ if (temp.Any())
|
|
|
+ {
|
|
|
+ return temp.First().JobStatus;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return "Stop";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return "Stop";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ [HttpPost]
|
|
|
+ public string GetId()
|
|
|
+ {
|
|
|
+ return IdFactory.NewId().ToString();
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 库存管理
|
|
|
+ /// <summary>
|
|
|
+ /// 手动出库确定
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string ManualTask(ManualTaskRequest request)
|
|
|
+ {
|
|
|
+ lock (lockerMannel)
|
|
|
+ {
|
|
|
+ return _hJService.ManualTask(request);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 合金PDA
|
|
|
+ /// <summary>
|
|
|
+ /// 合金解绑
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes<int> Unbounding(UnboundRequest request)
|
|
|
+ {
|
|
|
+ return _hJService.Unbounding(request);
|
|
|
+ }
|
|
|
+ #region pda出库
|
|
|
+ /// <summary>
|
|
|
+ /// pda指定出库确定
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string PdaManualTask(ManualTaskRequest request)
|
|
|
+ {
|
|
|
+ request.BusType = TaskBusType.TaskBusType_HJ_PdaManualOut.GetHashCode().ToString();
|
|
|
+ return _hJService.ManualTask(request);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// pda质检领料出库确定
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string PdaQualityTask(ManualTaskRequest request)
|
|
|
+ {
|
|
|
+ request.BusType = TaskBusType.TaskBusType_HJ_QualityOut.GetHashCode().ToString();
|
|
|
+ return _hJService.ManualTask(request);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// pda呆滞料出库确定
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string PdaInactionStockTask(ManualTaskRequest request)
|
|
|
+ {
|
|
|
+ request.BusType = TaskBusType.TaskBusType_HJ_DullMaterOut.GetHashCode().ToString();
|
|
|
+ return _hJService.ManualTask(request);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// pda单据查询
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string GetDocumentsAll(DocumentsRequest request)
|
|
|
+ {
|
|
|
+ return _hJService.GetPageDocumentsList(request).ToCamelCaseString();
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// pda单据明细查询(传单号)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string GetDocumentDetails(DocumentsRequest request)
|
|
|
+ {
|
|
|
+ return _hJService.GetDocumentDetailListByDocsNo(request).ToCamelCaseString();
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 获取物料信息,根据RFID
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes<MaterInfo> GetMaterInfoByRfid(PdaRfidRequest request)
|
|
|
+ {
|
|
|
+ return _hJService.MaterInfoByRfid(request);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 提交(组盘)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string PdaGroupStock(PdaRfidRequest request)
|
|
|
+ {
|
|
|
+ lock (lockerStockInfo)
|
|
|
+ {
|
|
|
+ return _hJService.PdaGroupStock(request);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// pda 下发任务
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string PdaInsterInTask(PdaRfidRequest request)
|
|
|
+ {
|
|
|
+ lock (lockerPdaTaskInfo)
|
|
|
+ {
|
|
|
+ return _hJService.PdaInsertTask(request);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 获取设备报警信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string GetEquipErrorInfo(ErrorInfoRequest request)
|
|
|
+ {
|
|
|
+ var it = RedisHelper.Get("equoneRGV3");
|
|
|
+ return it;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 获取物料报警信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string GetMaterErrorInfo(ErrorInfoRequest request)
|
|
|
+ {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 获取业务报警信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string GetBusinessErrorInfo(ErrorInfoRequest request)
|
|
|
+ {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// agv空轮搬运任务(一楼空轮初始化)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public string AgvTaskInfo(AgvTaskInfoRequest request)
|
|
|
+ {
|
|
|
+ return _hJService.AgvCarryTaskInfo(request);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+ /// <summary>
|
|
|
+ /// 取消/完成任务验证(只验证不做业务处理,开放wcs系统调用)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes CancelTaskVerify(CancelTaskRequest request)
|
|
|
+ {
|
|
|
+ lock (lockerCancelOrComplet)
|
|
|
+ {
|
|
|
+ return _hJService.CancelTaskVerify(request);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 执行任务(开放wcs调用,前端不调用)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes CarryTaskInfo(CancelTaskRequest request)
|
|
|
+ {
|
|
|
+ lock (lockerCarryTask)
|
|
|
+ {
|
|
|
+ return _hJService.CarryTaskInfo(request);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>du
|
|
|
+ /// 异常任务的库存处理
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes GetErrorTaskInfo()
|
|
|
+ {
|
|
|
+ var res = new SRes();
|
|
|
+ //获取货位锁是出库锁,当前时间差大于等于1
|
|
|
+ var list = _hJService.GetOutStateList();
|
|
|
+ //根据条码捞取历史任务表中的数据
|
|
|
+ var barcode = list.Select(p => p.ContGrpBarCode).ToList();
|
|
|
+ var task = _hJService.GetTaskHistoryByCode(barcode);
|
|
|
+ if (task.Any())
|
|
|
+ {
|
|
|
+ foreach (var item in task)
|
|
|
+ {
|
|
|
+ if (item.Type != TaskType.OutDepot)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (item.Status != dto.TaskStatus.Finish)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ var info = CompleteTask(new CompleteTaskRequest() { TaskNum = item.ID, OperationType = 2, WCSUpdateName = "wcs" });
|
|
|
+ if (info.ResCode != ResponseStatusCodeEnum.Sucess.GetHashCode())
|
|
|
+ {
|
|
|
+ res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
|
|
|
+ res.ResMsg = ResponseStatusCodeEnum.Fail.GetDescription();
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ #region 推送数据
|
|
|
+ /// <summary>
|
|
|
+ /// 数据推送接口
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public PushResponse PushErpDate(PushDate request)
|
|
|
+ {
|
|
|
+ var result = new PushResponse();
|
|
|
+ if (request.init == 1)
|
|
|
+ {
|
|
|
+ //手动推送
|
|
|
+ if (!request.CLBarCode.Any())
|
|
|
+ {
|
|
|
+ result.ResCode = ResponseStatusCodeEnum.ErrParam.GetHashCode();
|
|
|
+ result.ResMsg = ResponseStatusCodeEnum.ErrParam.GetDescription();
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ var list = _hJService.GetPushDatelistMannel(request);
|
|
|
+ if (!list.Any())
|
|
|
+ {
|
|
|
+ result.ResCode = ResponseStatusCodeEnum.NoResult.GetHashCode();
|
|
|
+ result.ResMsg = ResponseStatusCodeEnum.NoResult.GetDescription();
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ if (list.Where(p => p.TypeCode == FackbeekType.InterfaceType_HJ_1F_StockIn.ToString()).ToList().Any())
|
|
|
+ {
|
|
|
+ PushRequest push = new PushRequest();
|
|
|
+ var onefloor = list.Where(p => p.TypeCode == FackbeekType.InterfaceType_HJ_1F_StockIn.ToString()).ToList();
|
|
|
+ var info = _mapper.Map<List<ListInfo>>(onefloor);
|
|
|
+ push.list = info;
|
|
|
+ var resbody = JsonConvert.DeserializeObject<PushResponse>(WmsServiceExportApi(push));
|
|
|
+ var matBarCode = info.Select(p => p.MatBarCode).ToList();
|
|
|
+ if (resbody.success == true)
|
|
|
+ {
|
|
|
+ _hJService.UpdatePushModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
|
|
|
+ {
|
|
|
+ Columns = it => new BillPushinfo { PostResult = 1, PostQty = it.PostQty + 1, ResDesc = "手动推送成功", EditTime = DateTime.Now },
|
|
|
+ WhereExpression = it => matBarCode.Contains(it.CLBarCode)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _hJService.UpdatePushModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
|
|
|
+ {
|
|
|
+ Columns = it => new BillPushinfo { PostResult = 2, PostQty = it.PostQty + 1, ResDesc = "手动推送失败", EditTime = DateTime.Now },
|
|
|
+ WhereExpression = it => matBarCode.Contains(it.CLBarCode)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //退料
|
|
|
+ //if (list.Where(p => p.TypeCode == FackbeekType.InterfaceType_HJ_2F_BackStockIn.ToString()).ToList().Any())
|
|
|
+ //{
|
|
|
+ // WetLineBackInFeedBackRequest wetLineBack = new WetLineBackInFeedBackRequest();
|
|
|
+ // var back = _mapper.Map<List<WetLineBackInFeedBackRequestItem>>(list);
|
|
|
+ // back.ForEach(p =>
|
|
|
+ // {
|
|
|
+ // p.BusType = "1";
|
|
|
+ // p.WareName = "合金库";
|
|
|
+ // });
|
|
|
+ // wetLineBack.ListInfo = back;
|
|
|
+ // var resbody = JsonConvert.DeserializeObject<WetLineBackInFeedBackResponse>(WmsServiceExportApi(wetLineBack));
|
|
|
+ // var rfid = back.Select(p => p.RFID).ToList();
|
|
|
+ // if (resbody.ResCode == ResponseStatusCodeEnum.Sucess.GetHashCode())
|
|
|
+ // {
|
|
|
+ // _hJService.UpdatePushModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
|
|
|
+ // {
|
|
|
+ // Columns = it => new BillPushinfo { PostResult = 1, PostQty = it.PostQty + 1, ResDesc = "手动推送" },
|
|
|
+ // WhereExpression = it => rfid.Contains(it.RFIDBarCode)
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // _hJService.UpdatePushModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
|
|
|
+ // {
|
|
|
+ // Columns = it => new BillPushinfo { PostResult = 2, PostQty = it.PostQty + 1 },
|
|
|
+ // WhereExpression = it => rfid.Contains(it.RFIDBarCode)
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ ////余料
|
|
|
+ //if (list.Where(p => p.TypeCode == FackbeekType.InterfaceType_HJ_2F_LeftStockIn.ToString()).ToList().Any())
|
|
|
+ //{
|
|
|
+ // WetLineBackInFeedBackRequest wetLineBack = new WetLineBackInFeedBackRequest();
|
|
|
+ // var back = _mapper.Map<List<WetLineBackInFeedBackRequestItem>>(list);
|
|
|
+ // back.ForEach(p =>
|
|
|
+ // {
|
|
|
+ // p.BusType = "2";
|
|
|
+ // p.WareName = "合金库";
|
|
|
+ // });
|
|
|
+ // wetLineBack.ListInfo = back;
|
|
|
+ // var resbody = JsonConvert.DeserializeObject<WetLineBackInFeedBackResponse>(WmsServiceExportApi(wetLineBack));
|
|
|
+ // var rfid = back.Select(p => p.RFID).ToList();
|
|
|
+ // if (resbody.ResCode == ResponseStatusCodeEnum.Sucess.GetHashCode())
|
|
|
+ // {
|
|
|
+ // _hJService.UpdatePushModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
|
|
|
+ // {
|
|
|
+ // Columns = it => new BillPushinfo { PostResult = 1, PostQty = it.PostQty + 1, ResDesc = "手动推送" },
|
|
|
+ // WhereExpression = it => rfid.Contains(it.RFIDBarCode)
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // _hJService.UpdatePushModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
|
|
|
+ // {
|
|
|
+ // Columns = it => new BillPushinfo { PostResult = 2, PostQty = it.PostQty + 1 },
|
|
|
+ // WhereExpression = it => rfid.Contains(it.RFIDBarCode)
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //自动推送
|
|
|
+ var list = _hJService.GetPushDatelistAuto(request);
|
|
|
+ if (!list.Any())
|
|
|
+ {
|
|
|
+ return new PushResponse() { ResCode = ResponseStatusCodeEnum.NoResult.GetHashCode(), ResMsg = ResponseStatusCodeEnum.NoResult.GetDescription() };
|
|
|
+ }
|
|
|
+
|
|
|
+ if (list.Where(p => p.TypeCode == FackbeekType.InterfaceType_HJ_1F_StockIn.ToString()).ToList().Any())
|
|
|
+ {
|
|
|
+ var onefloor = list.Where(p => p.TypeCode == FackbeekType.InterfaceType_HJ_1F_StockIn.ToString()).ToList();
|
|
|
+ PushRequest push = new PushRequest();
|
|
|
+ var info = _mapper.Map<List<ListInfo>>(onefloor);
|
|
|
+ push.list = info;
|
|
|
+ var resbody = JsonConvert.DeserializeObject<PushResponse>(WmsServiceExportApi(push));
|
|
|
+ var matBarCode = info.Select(p => p.MatBarCode).ToList();
|
|
|
+ if (resbody.success == true)
|
|
|
+ {
|
|
|
+ _hJService.UpdatePushModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
|
|
|
+ {
|
|
|
+ Columns = it => new BillPushinfo { PostResult = 1, PostQty = it.PostQty + 1, ResDesc = "自动推送" ,EditTime = DateTime.Now},
|
|
|
+ WhereExpression = it => matBarCode.Contains(it.CLBarCode)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _hJService.UpdatePushModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
|
|
|
+ {
|
|
|
+ Columns = it => new BillPushinfo { PostResult = 2, PostQty = it.PostQty + 1, EditTime = DateTime.Now },
|
|
|
+ WhereExpression = it => matBarCode.Contains(it.CLBarCode)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //退料
|
|
|
+ //if (list.Where(p => p.TypeCode == FackbeekType.InterfaceType_HJ_2F_BackStockIn.ToString()).ToList().Any())
|
|
|
+ //{
|
|
|
+ // WetLineBackInFeedBackRequest wetLineBack = new WetLineBackInFeedBackRequest();
|
|
|
+ // var back = _mapper.Map<List<WetLineBackInFeedBackRequestItem>>(list);
|
|
|
+ // back.ForEach(p =>
|
|
|
+ // {
|
|
|
+ // p.BusType = "1";
|
|
|
+ // p.WareName = "合金库";
|
|
|
+ // });
|
|
|
+ // wetLineBack.ListInfo = back;
|
|
|
+ // var resbody = JsonConvert.DeserializeObject<WetLineBackInFeedBackResponse>(WmsServiceExportApi(wetLineBack));
|
|
|
+ // var rfid = back.Select(p => p.RFID).ToList();
|
|
|
+ // if (resbody.ResCode == ResponseStatusCodeEnum.Sucess.GetHashCode())
|
|
|
+ // {
|
|
|
+ // _hJService.UpdatePushModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
|
|
|
+ // {
|
|
|
+ // Columns = it => new BillPushinfo { PostResult = 1, PostQty = it.PostQty + 1, ResDesc = "自动推送" },
|
|
|
+ // WhereExpression = it => rfid.Contains(it.RFIDBarCode)
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // _hJService.UpdatePushModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
|
|
|
+ // {
|
|
|
+ // Columns = it => new BillPushinfo { PostResult = 2, PostQty = it.PostQty + 1 },
|
|
|
+ // WhereExpression = it => rfid.Contains(it.RFIDBarCode)
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ ////余料
|
|
|
+ //if (list.Where(p => p.TypeCode == FackbeekType.InterfaceType_HJ_2F_LeftStockIn.ToString()).ToList().Any())
|
|
|
+ //{
|
|
|
+ // WetLineBackInFeedBackRequest wetLineBack = new WetLineBackInFeedBackRequest();
|
|
|
+ // var back = _mapper.Map<List<WetLineBackInFeedBackRequestItem>>(list);
|
|
|
+ // back.ForEach(p =>
|
|
|
+ // {
|
|
|
+ // p.BusType = "2";
|
|
|
+ // p.WareName = "合金库";
|
|
|
+ // });
|
|
|
+ // wetLineBack.ListInfo = back;
|
|
|
+ // var resbody = JsonConvert.DeserializeObject<WetLineBackInFeedBackResponse>(WmsServiceExportApi(wetLineBack));
|
|
|
+ // var rfid = back.Select(p => p.RFID).ToList();
|
|
|
+ // if (resbody.ResCode == ResponseStatusCodeEnum.Sucess.GetHashCode())
|
|
|
+ // {
|
|
|
+ // _hJService.UpdatePushModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
|
|
|
+ // {
|
|
|
+ // Columns = it => new BillPushinfo { PostResult = 1, PostQty = it.PostQty + 1, ResDesc = "自动推送" },
|
|
|
+ // WhereExpression = it => rfid.Contains(it.RFIDBarCode)
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // _hJService.UpdatePushModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
|
|
|
+ // {
|
|
|
+ // Columns = it => new BillPushinfo { PostResult = 2, PostQty = it.PostQty + 1 },
|
|
|
+ // WhereExpression = it => rfid.Contains(it.RFIDBarCode)
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 异常处理
|
|
|
+ /// <summary>
|
|
|
+ /// 强制取消任务
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes ForceCancelTask(WebErrorRequest request)
|
|
|
+ {
|
|
|
+ return _hJService.ForceCancelTask(request);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 删除库存信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes DeleteStockInfo(DetailCodeRequest request)
|
|
|
+ {
|
|
|
+ return _hJService.DeleteStockInfo(request);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 修改库存状态
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes UpdateStockState(DetailCodeRequestdto request)
|
|
|
+ {
|
|
|
+ return _hJService.UpdateStockState(request);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 修改货位状态
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes UpdateCellState(DetailCodeRequestdto request)
|
|
|
+ {
|
|
|
+ return _hJService.UpdateCellState(request);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 货位数据互换
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes DataSwapCell(DataSwapCellRequest request)
|
|
|
+ {
|
|
|
+ return _hJService.DataSwapCell(request);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 补数据
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public SRes DataBasePatch(DetailCodeRequest request)
|
|
|
+ {
|
|
|
+ return _hJService.DataBasePatch(request);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+}
|