123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131 |
- using AutoMapper;
- using Microsoft.AspNetCore.Mvc;
- using Newtonsoft.Json;
- using SqlSugar;
- using WCS.Entity.fj;
- using wms.api.Job;
- using wms.dto;
- using wms.dto.request.fj;
- using wms.dto.request.hj;
- using wms.dto.request.hj.dto;
- using wms.dto.request.share;
- using wms.dto.response;
- using wms.dto.response.fj;
- using wms.service.IService;
- using wms.service.Service;
- using wms.sqlsugar.model.fj;
- 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 FjController : BaseController
- {
- /// <summary>
- /// 分拣服务 逻辑类
- /// </summary>
- private readonly IFJService _fjService;
- /// <summary>
- /// 日志
- /// </summary>
- private readonly ILogger<FjController> _logger;
- /// <summary>
- /// 映射器
- /// </summary>
- private readonly IMapper _mapper;
- #region 锁
- private static object lockerCurtainProductionOrder = new object();
- private static object lockerCurtainOrderStartCheck = new object();
- private static object lockerFjEditorialFlow = new object();
- private static object lockerSpoolMaterialInfoTrans = new object();
- private static object lockerCurtainProductionStockOut = new object();
- private static object lockerCurtainProductionStockOut1 = new object();
- private static object lockerProductionBack = new object();
- private static object lockerCreateMaterialPalletWarehouTask = new object();
- private static object lockerCreateMaterialPalletWarehouTask1 = new object();
- private static object lockerCreateMaterialPalletWarehouTask2 = new object();
- private static object lockerMaterialReturnTaskCreator = new object();
- private static object lockerErrorMaterialStockOut = new object();
- private static object lockerBGradeMaterialStockOut = new object();
- private static object lockerlockerStockChange = new object();
- private static object lockerWetFormulaInfo = new object();
- private static object lockerManualBuildEmptyStock = new object();
- private static object lockFindAvailableFlatStorageSlot=new object();
- /// <summary>
- /// 人工组盘传输接口
- /// </summary>
- private static object lockerManualBuildStockTrans = new object();
- /// <summary>
- /// 一层工人创建创建空托盘库存
- /// </summary>
- private static object lockOneFloorWorkerBuildEmptyPalletsStock = new object();
- /// <summary>
- ///
- /// </summary>
- private static object lockGroupTask = new object();
- // <summary>
- ///
- /// </summary>
- private static object lockBingPallet = new object();
- // <summary>
- ///
- /// </summary>
- private static object lockGetTwoPallet = new object();
- /// <summary>
- /// 申请货位
- /// </summary>
- private static object lockApplyStockInLoc = new object();
- /// <summary>
- /// 完成任务
- /// </summary>
- private static object lockerCompleteTask = new object();
- /// <summary>
- /// 取消任务
- /// </summary>
- private static object lockerCancelTask = new object();
- /// <summary>
- /// 手动出库任务
- /// </summary>
- private static object lockManualTask = new object();
- /// <summary>
- /// 空托盘组申请出库
- /// </summary>
- private static object lockApplyEmptyPalletGroupOutStorage = new object();
- /// <summary>
- /// 组盘工字轮创建异常任务
- /// </summary>
- private static object palletizingCreateseErrorTasks = new object();
- /// <summary>
- /// 空托盘组申请出库
- /// </summary>
- private static object lockRingApplyStockInLoc = new object();
- /// <summary>
- /// 环形库请求码垛出库任务
- /// </summary>
- private static object lockApplyPalletizingStockOut = new object();
- /// <summary>
- /// 堆垛机从出库完成
- /// </summary>
- private static object lockerSrmPickOutCompleted = new object();
- private static object lockerBomInfoTrans = new object();
- private static object lockFJEnteMainLineRequest = new object();
- private static object lockAllocatedSpoolFlow = new object();
- #endregion 锁
- /// <summary>
- /// 分拣控制器构造函数
- /// </summary>
- /// <param name="fjService">分拣服务 逻辑类</param>
- /// <param name="logger">日志</param>
- /// <param name="mapper">映射器</param>
- public FjController(IFJService fjService, ILogger<FjController> logger, IMapper mapper) : base(fjService)
- {
- _fjService = fjService;
- _logger = logger;
- _mapper = mapper;
- }
- #region 暂时不用
- /// <summary>
- /// 同步物料基础信息
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- //[HttpPost]
- //public string SyncMaterInfo(SyncMaterInfoRequest reqBody)
- //{
- // var result = new SRes();
- // //_logger.LogInformation("请求参数:{@reqBody},{aa}", reqBody,1);
- // FJSyncMaterInfoResponse resbody = JsonConvert.DeserializeObject<FJSyncMaterInfoResponse>(WmsServiceExportApi(reqBody));
- // if (reqBody.SyncType == 1)
- // {
- // reqBody.PageIndex = 1;
- // while (resbody.ResData !=null && resbody.ResData.Any())
- // {
- // _fjService.SyncMaterInfo(resbody.ResData);
- // reqBody.PageIndex++;
- // resbody = JsonConvert.DeserializeObject<FJSyncMaterInfoResponse>(WmsServiceExportApi(reqBody));
- // }
- // }
- // else if (reqBody.SyncType == 2)
- // {
- // //拿到增量
- // var increconf = _fjService.GetSysConfigByCode(Const.MESMaterialInitIncrement);
- // if (increconf != null)
- // {
- // reqBody.StartTime = DateTime.Parse(increconf.SContent);
- // //reqBody.Count = int.Parse(increconf.Remark);
- // resbody = JsonConvert.DeserializeObject<FJSyncMaterInfoResponse>(WmsServiceExportApi(reqBody));
- // if (resbody.ResData.Any())
- // {
- // if (_fjService.SyncMaterInfo(resbody.ResData))
- // {
- // var lastdata = resbody.ResData.OrderBy(p => p.UpdatedTime).Last();
- // _fjService.UpdateSysConfigModelColumns(new sqlsugar.model.UpdateModelColumns<fjSysConfig>()
- // {
- // Columns = it => new fjSysConfig { SContent = lastdata.UpdatedTime.ToString("yyyy-MM-dd HH:mm:ss.fff") },
- // WhereExpression = it => it.Code == Const.MESMaterialInitIncrement
- // });
- // }
- // }
- // else
- // {
- // result.ResCode = ResponseStatusCodeEnum.NoResult.GetHashCode();
- // result.ResMsg = ResponseStatusCodeEnum.NoResult.GetDescription();
- // }
- // }
- // else
- // {
- // result.ResCode = ResponseStatusCodeEnum.AccountError.GetHashCode();
- // result.ResMsg = "没有配置信息" + Const.MESMaterialInitIncrement;
- // }
- // }
- // else
- // {
- // if (!string.IsNullOrEmpty(reqBody.MatCode))
- // {
- // resbody = JsonConvert.DeserializeObject<FJSyncMaterInfoResponse>(WmsServiceExportApi(reqBody));
- // if (resbody.ResData.Any())
- // {
- // if (_fjService.SyncMaterInfo(resbody.ResData))
- // {
- // }
- // }
- // }
- // }
- // return result.ToCamelCaseString();
- //}
- /// <summary>
- /// BOM信息传输接口
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- //[HttpPost]
- //public SRes BomInfoTrans(BomInfoTransRequest reqDto)
- //{
- // return ConcurrencyReqControl<BomInfoTransRequest, SRes>(lockerBomInfoTrans, "BomInfoTrans" + reqDto.BomCode, reqDto.BomCode, reqDto, _fjService.BomInfoTrans);
- //}
- #endregion 暂时不用
- /// <summary>
- /// 创建货位,用于少数虚拟货位及平库
- /// </summary>
- /// <param name="WarehouseCode">仓库号</param>
- /// <param name="Code">货位号</param>
- /// <returns></returns>
- [HttpPost]
- public SRes CreatWarecell(string WarehouseCode, string Code)
- {
- return _fjService.CreatWarecell(WarehouseCode, Code);
- }
- /// <summary>
- /// 物料主数据推送接口(湿拉)
- /// </summary>
- /// <param name="reqBody"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes SyncMaterInfoList(FJSyncMaterInfoListRequest reqBody)
- {
- var res = new SRes();
- if (reqBody.ListInfo == null || !reqBody.ListInfo.Any())
- {
- res.ResCode = ResponseStatusCodeEnum.DocDetailNotExist.GetHashCode();
- res.ResMsg = ResponseStatusCodeEnum.DocDetailNotExist.GetDescription();
- return res;
- }
- _fjService.SyncMaterInfo(_mapper.Map<List<FJSyncMaterInfoResponseItem>>(reqBody.ListInfo));
- return res;
- }
- /// <summary>
- /// 物料主数据推送接口(帘线)
- /// </summary>
- /// <param name="reqBody"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes SyncMaterInfoListForLX(SxSyncMaterInfoListRequest reqBody)
- {
- var res = new SRes();
- if (reqBody.ListInfo == null || !reqBody.ListInfo.Any())
- {
- res.ResCode = ResponseStatusCodeEnum.DocDetailNotExist.GetHashCode();
- res.ResMsg = ResponseStatusCodeEnum.DocDetailNotExist.GetDescription();
- return res;
- }
- _fjService.SyncMaterInfoLX(reqBody.ListInfo);
- return res;
- }
- /// <summary>
- /// 机台信息同步接口
- /// </summary>
- /// <param name=""></param>
- /// <returns></returns>
- [HttpPost(Name = "SyncMachineInfo")]
- public SRes SyncMachineInfo(SyncMachineInfoRequest reqDto)
- {
- //SyncMachineInfoResponse resbody = JsonConvert.DeserializeObject<SyncMachineInfoResponse>(WmsServiceExportApi(reqDto));
- //if (resbody.ResCode == ResponseStatusCodeEnum.Sucess.GetHashCode() && resbody.ResData != null && resbody.ResData.Any())
- //{
- return _fjService.SyncMachineInfo(reqDto);
- //}
- }
- /// <summary>
- /// 创建芯股用空托入库任务
- /// </summary>
- /// <returns></returns>
- [HttpPost(Name = "CreateCoreStrandEmptyPalletEnterWarehouse")]
- public void CreateCoreStrandEmptyPalletEnterWarehouse()
- {
- _fjService.CreateCoreStrandEmptyPalletEnterWarehouse();
- }
- /// <summary>
- /// 创建芯股站台用的空托出库任务
- /// </summary>
- /// <returns></returns>
- [HttpPost(Name = "CoreStrandSupportReplenishEmptyPallet")]
- public SRes CoreStrandSupportReplenishEmptyPallet()
- {
- return _fjService.CoreStrandSupportReplenishEmptyPallet();
- }
- /// <summary>
- /// 投料信息同步接口
- /// </summary>
- /// <param name=""></param>
- /// <returns></returns>
- [HttpPost(Name = "WetFormulaInfo")]
- public SRes WetFormulaInfo(WetFormulaInfoRequest reqDto)
- {
- return ConcurrencyReqControl<WetFormulaInfoRequest, SRes>(lockerWetFormulaInfo, "WetFormulaInfo", reqDto.FeedCode, reqDto, _fjService.WetFormulaInfo);
- }
- /// <summary>
- /// 帘线生产工单信息传输接口
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes CurtainProductionOrder(CurtainProductionOrderRequest reqDto)
- {
- var res = ConcurrencyReqControl<CurtainProductionOrderRequest, SRes>(lockerCurtainProductionOrder, "CurtainProductionOrder", reqDto.BillCode, reqDto, _fjService.CurtainProductionOrder);
- try
- {
- HttpUtil.PostRequest("http://10.30.44.3:8011/api/sx/CurtainProductionOrder", JsonConvert.SerializeObject(reqDto), 30000, "UTF-8", "application/json");
- }
- catch (Exception ex)
- {
- _logger.LogInformation("调用时效工单异常" + ex.ToString());
- }
- return res;
- }
- /// <summary>
- /// 湿拉工单启动验证
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes CurtainOrderStartCheck(CurtainOrderStartCheckRequest reqDto)
- {
- return ConcurrencyReqControl<CurtainOrderStartCheckRequest, SRes>(lockerCurtainOrderStartCheck, "CurtainOrderStartCheck", reqDto.BillCode, reqDto, _fjService.CurtainOrderStartCheck);
- }
- /// <summary>
- /// 变更流向
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes EditorialFlow(FjEditorialFlowRequest reqDto)
- {
- return ConcurrencyReqControl<FjEditorialFlowRequest, SRes>(lockerFjEditorialFlow, "EditorialFlow", reqDto.LocCode, reqDto, _fjService.EditorialFlow);
- }
- /// <summary>
- /// 湿拉工字轮/芯股信息传输接口
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes SpoolMaterialInfoTrans(SpoolMaterialInfoTransRequest reqDto)
- {
- return ConcurrencyReqControl<SpoolMaterialInfoTransRequest, SRes>(lockerSpoolMaterialInfoTrans, "SpoolMaterialInfoTrans", reqDto.SpoolCode, reqDto, _fjService.SpoolMaterialInfoTrans);
- }
- /// <summary>
- /// AGV上报状态变更接口
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public AgvCallbackResponse AgvCallback(AgvCallbackRequest reqDto)
- {
- return _fjService.AgvCallback(reqDto);
- //return ConcurrencyReqControl<SpoolMaterialInfoTransRequest, SRes>(lockerSpoolMaterialInfoTrans, "SpoolMaterialInfoTrans", reqDto.SpoolCode, reqDto, _fjService.SpoolMaterialInfoTrans);
- }
- /// <summary>
- /// 获取工字轮流向(江锦调用)
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes<string> AllocatedSpoolFlow(AllocatedSpoolFlowRequest reqDto)
- {
- return _fjService.AllocatedSpoolFlow(reqDto);
- }
- /// <summary>
- /// MES获取流向异常信息
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes QueryFlowDirectionExceptions(GetFlowExceptionResultsRequest reqDto)
- {
- return _fjService.QueryFlowDirectionExceptions(reqDto);
- }
- private SRes ComPushData(SRes resbody, List<long> ids)
- {
- var res = new SRes();
- try
- {
- if (resbody.ResCode == ResponseStatusCodeEnum.Sucess.GetHashCode())
- {
- //更新推送表数据
- _fjService.UpdateBillPushinfoModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
- {
- Columns = it => new BillPushinfo { PostResult = 1, PostQty = it.PostQty + 1 },
- WhereExpression = it => ids.Contains(it.Id)
- });
- //删除单据表数据
- //_fjService.DeleteDoc(p => doccodelist.Contains(p.DocNo));
- }
- else
- {
- //更新推送表数据
- _fjService.UpdateBillPushinfoModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
- {
- Columns = it => new BillPushinfo { PostResult = 2, PostQty = it.PostQty + 1 },
- WhereExpression = it => ids.Contains(it.Id)
- });
- }
- }
- catch (Exception ex)
- {
- res.ResCode = ResponseStatusCodeEnum.DataSaveErr.GetHashCode();
- res.ResMsg = ResponseStatusCodeEnum.DataSaveErr.GetDescription();
- _logger.LogInformation("反馈数据推送" + ex.ToString());
- }
- return res;
- }
- /// <summary>
- /// 湿拉工字轮入库反馈接口
- /// </summary>
- /// <returns></returns>
- [HttpPost(Name = "WetProductStockInFeedBack")]
- public SRes WetProductStockInFeedBack()
- {
- var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_StockIn.ToString());
- var dtolist = _mapper.Map<List<WetProductStockInFeedBackRequestItem>>(list);
- var dto = new WetProductStockInFeedBackRequest() { ListInfo = dtolist };
- SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
- return ComPushData(resbody, list.Select(p => p.Id).ToList());
- }
- /// <summary>
- /// 数据推送接口
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- [HttpPost]
- public PushResponse FJPushErpDate(PushDate request)
- {
- var result = new PushResponse();
- //自动推送
- request.Type = FackbeekType.InterfaceType_HJ_1F_StockIn.ToString();
- var onefloor = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_StockIn.ToString(), true);
- foreach (var item in onefloor.GroupBy(p => p.RFIDBarCode))
- {
- PushRequest push = new PushRequest() { ListInfo = new List<ListInfoInfo>() };
- push.WareCode = "fjhouse";
- push.WareName = "分拣库";
- push.LocCode = item.First().WareCellCode;
- push.TrayCode = "TPB";
- push.TrayType = "TPB";
- push.ListInfo = item.Select(q => new ListInfoInfo() { MatBarCode = q.CLBarCode, SpoolCode = q.HWBarCode }).ToList();
- var resbody = JsonConvert.DeserializeObject<PushResponse>(WmsServiceExportMq(push));
- var matBarCode = push.ListInfo.Select(p => p.MatBarCode).ToList();
- if (resbody.success == true || resbody.ResCode == 200)
- {
- _fjService.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
- {
- _fjService.UpdatePushModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
- {
- Columns = it => new BillPushinfo { PostResult = 2, PostQty = it.PostQty + 1, EditTime = DateTime.Now, Memo = resbody.ResMsg },
- WhereExpression = it => matBarCode.Contains(it.CLBarCode)
- });
- }
- }
- return result;
- }
- /// <summary>
- /// 帘线叫料接口
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost(Name = "CurtainProductionStockOut")]
- public SRes CurtainProductionStockOut(CurtainProductionStockOutRequest reqDto)
- {
- return ConcurrencyReqControl<CurtainProductionStockOutRequest, SRes>(lockerCurtainProductionStockOut, "CurtainProductionStockOut" + reqDto.BillCode, reqDto.BillCode, reqDto, _fjService.CurtainProductionStockOut);
- }
- /// <summary>
- /// 帘线叫料接口(人工码垛托盘)
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost(Name = "CurtainProductionStockOut1")]
- public SRes CurtainProductionStockOut1(CurtainProductionStockOutRequest1 reqDto)
- {
- return ConcurrencyReqControl<CurtainProductionStockOutRequest1, SRes>(lockerCurtainProductionStockOut1, "CurtainProductionStockOut1" + reqDto.BillCode, reqDto.BillCode, reqDto, _fjService.CurtainProductionStockOut1);
- }
- /// <summary>
- /// 帘线手动叫料接口
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost(Name = "ManualCurtainProductionStockOut")]
- public SRes ManualCurtainProductionStockOut(ManualCurtainProductionStockOut reqDto)
- {
- return _fjService.ManualCurtainProductionStockOut(reqDto);
- }
- /// <summary>
- /// 人工创建满托入库任务
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes CreateMaterialPalletWarehouTask(CreateMaterialPalletWarehouTaskRequest reqDto)
- {
- return ConcurrencyReqControl<CreateMaterialPalletWarehouTaskRequest, SRes>(lockerCreateMaterialPalletWarehouTask, "CreateMaterialPalletWarehouTask", reqDto.SpoolNr, reqDto, _fjService.CreateMaterialPalletWarehouTask);
- }
- /// <summary>
- /// 人工创建UT满托入库任务
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes CreateMaterialUTPalletWarehouTask(CreateMaterialPalletWarehouTaskRequest reqDto)
- {
- return ConcurrencyReqControl<CreateMaterialPalletWarehouTaskRequest, SRes>(lockerCreateMaterialPalletWarehouTask, "CreateMaterialUTPalletWarehouTask", reqDto.SpoolNr, reqDto, _fjService.CreateMaterialUTPalletWarehouTask);
- }
-
- /// <summary>
- /// 芯股满托创建库存信息
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes CreateMaterialPalletWarehouTask1(CreateMaterialPalletWarehouTask1Request reqDto)
- {
- return ConcurrencyReqControl<CreateMaterialPalletWarehouTask1Request, SRes>(lockerCreateMaterialPalletWarehouTask1, "CreateMaterialPalletWarehouTask1", reqDto.SpoolNr, reqDto, _fjService.CreateMaterialPalletWarehouTask1);
- }
- /// <summary>
- /// 芯股满托创建库存信息
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes CreateMaterialPalletWarehouTask2(RewindFullPalletTaskRequest reqDto)
- {
- return ConcurrencyReqControl<RewindFullPalletTaskRequest, SRes>(lockerCreateMaterialPalletWarehouTask2, "CreateMaterialPalletWarehouTask2", reqDto.TrayCode, reqDto, _fjService.CreateMaterialPalletWarehouTask2);
- }
- /// <summary>
- /// 创建退料任务
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes MaterialReturnTaskCreator(MaterialReturnTaskCreatorRequest reqDto)
- {
- return ConcurrencyReqControl<MaterialReturnTaskCreatorRequest, SRes>(lockerMaterialReturnTaskCreator, "lockerMaterialReturnTaskCreator", reqDto.LocCode, reqDto, _fjService.MaterialReturnTaskCreator);
- }
- /// <summary>
- /// 叫料信息反馈接口
- /// </summary>
- /// <param name="billcode"></param>
- /// <returns></returns>
- [HttpPost(Name = "CurtainProductionStockOutFeedBack")]
- public SRes CurtainProductionStockOutFeedBack()
- {
- var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_StockOut.ToString());
- var dtolist = _mapper.Map<List<CurtainProductionStockOutFeedBackRequestItem>>(list);
- var dto = new CurtainProductionStockOutFeedBackRequest() { ListInfo = dtolist };
- SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
- return ComPushData(resbody, list.Select(p => p.Id).ToList());
- }
- /// <summary>
- /// 生产退料/余料接口
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes ProductionBack(FjProductionBackRequest reqDto)
- {
- return ConcurrencyReqControl<FjProductionBackRequest, SRes>(lockerProductionBack, "ProductionBack", reqDto.BillCode, reqDto, _fjService.ProductionBack);
- }
- /// <summary>
- /// 余料反馈接口
- /// </summary>
- /// <param name="billcode"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes ProductionLeftFeedBack()
- {
- var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_LeftStockIn.ToString());
- var dtolist = _mapper.Map<List<ProductionLeftFeedBackRequestItem>>(list);
- var dto = new ProductionLeftFeedBackRequest() { ListInfo = dtolist };
- SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
- return ComPushData(resbody, list.Select(p => p.Id).ToList());
- }
- /// <summary>
- /// 异常料出库单传输接口
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes ErrorMaterialStockOut(FjErrorMaterialStockOutRequest reqDto)
- {
- return ConcurrencyReqControl<FjErrorMaterialStockOutRequest, SRes>(lockerErrorMaterialStockOut, "ErrorMaterialStockOut", reqDto.BillCode, reqDto, _fjService.ErrorMaterialStockOut);
- }
- /// <summary>
- /// 异常料出库反馈接口
- /// </summary>
- /// <param name="billcode"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes ErrorMaterialStockOutFeedBack()
- {
- var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_ErrStockOut.ToString());
- var dtolist = _mapper.Map<List<ErrorMaterialStockOutFeedBackRequestItem>>(list);
- var dto = new ErrorMaterialStockOutFeedBackRequest() { ListInfo = dtolist };
- SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
- return ComPushData(resbody, list.Select(p => p.Id).ToList());
- }
- /// <summary>
- /// B站叫料单传输接口
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes BGradeMaterialStockOut(BGradeMaterialStockOutRequest reqDto)
- {
- return ConcurrencyReqControl<BGradeMaterialStockOutRequest, SRes>(lockerBGradeMaterialStockOut, "BGradeMaterialStockOut", reqDto.BillCode, reqDto, _fjService.BGradeMaterialStockOut);
- }
- /// <summary>
- /// B站出库反馈接口
- /// </summary>
- /// <param name="billcode"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes BGradeMaterialStockOutFeedBack()
- {
- var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_BGradeStockOut.ToString());
- var dtolist = _mapper.Map<List<BGradeMaterialStockOutFeedBackRequestItem>>(list);
- var dto = new BGradeMaterialStockOutFeedBackRequest() { ListInfo = dtolist };
- SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
- return ComPushData(resbody, list.Select(p => p.Id).ToList());
- }
- /// <summary>
- /// 库存改判
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes StockChange(FjStockChangeRequest reqDto)
- {
- return ConcurrencyReqControl<FjStockChangeRequest, SRes>(lockerlockerStockChange, "FJStockChange", reqDto.BillCode, reqDto, _fjService.StockChange);
- }
- /// <summary>
- /// 改判反馈接口
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes StockChangeFeedBack()
- {
- var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_StockChanage.ToString());
- var dtolist = _mapper.Map<List<StockChangeFeedBackRequestItem>>(list);
- var dto = new dto.request.fj.StockChangeFeedBackRequest() { ListInfo = dtolist };
- SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
- return ComPushData(resbody, list.Select(p => p.Id).ToList());
- }
- /// <summary>
- /// 实时库存查询接口
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost(Name = "GetFJCurStockList")]
- public GetFJCurStockListResponse GetFJCurStockList(GetFJCurStockListRequest reqDto)
- {
- return _fjService.GetCurStockList(reqDto);
- }
- /// <summary>
- /// 回库反馈接口(出库途中改判的,入库之后再次上传入库信息)
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes StockChangeStockInFeedBack()
- {
- var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_ChanageBack.ToString());
- var dtolist = _mapper.Map<List<StockChangeStockInFeedBackRequestItem>>(list);
- var dto = new StockChangeStockInFeedBackRequest() { ListInfo = dtolist };
- SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
- return resbody;
- }
- /// <summary>
- /// 人工组盘传输接口
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes ManualBuildStockTrans(ManualBuildStockTransRequest reqDto)
- {
- return ConcurrencyReqControl<ManualBuildStockTransRequest, SRes>(lockerManualBuildStockTrans, "ManualBuildStockTrans", reqDto.PalletCode, reqDto, _fjService.ManualBuildStockTrans);
- }
- /// <summary>
- /// 条码信息查询接口
- /// </summary>
- /// <param name="req"></param>
- /// <returns></returns>
- [HttpPost]
- public string GetMesBarCodeInfo(string req)
- {
- return "";
- }
- /// <summary>
- /// 空托组盘
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes ManualBuildEmptyStock(ManualBuildEmptyStockRequest reqDto)
- {
- return ConcurrencyReqControl<ManualBuildEmptyStockRequest, SRes>(lockerManualBuildEmptyStock, "ManualBuildEmptyStock", reqDto.ContGrpBarCode, reqDto, _fjService.ManualBuildEmptyStock);
- }
- #region 一楼入库任务生成接口
- /// <summary>
- /// 一楼空托盘人工入库任务创建
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes OneFloorWorkerBuildEmptyPalletsStock(FJBuildEmptyPalletsStockRequest reqDto)
- {
- return ConcurrencyReqControl<FJBuildEmptyPalletsStockRequest, SRes>(lockOneFloorWorkerBuildEmptyPalletsStock, "OneFloorWorkerBuildEmptyPalletsStock", reqDto.StartLoc, reqDto, _fjService.OneFloorWorkerBuildEmptyPalletsStock);
- }
- #endregion 一楼入库任务生成接口
- /// <summary>
- /// 生成组盘任务,空托盘
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes GroupTask(FJBuildEmptyPalletsStockDto reqDto)
- {
- return ConcurrencyReqControl<FJBuildEmptyPalletsStockDto, SRes>(lockGroupTask, "GroupTask", reqDto.StartLoc, reqDto, _fjService.GroupTask);
- }
- /// <summary>
- /// 整托入库
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes BingPallet(FJBingPalletDto reqDto)
- {
- return ConcurrencyReqControl<FJBingPalletDto, SRes>(lockBingPallet, "BingPallet" + reqDto.loc, reqDto.loc, reqDto, _fjService.BingPallet);
- }
- /// <summary>
- /// 整托入库
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes<int> GetTwoPallet(FJGetTwoPalletDto reqDto)
- {
- return ConcurrencyReqControl<FJGetTwoPalletDto, SRes<int>>(lockGetTwoPallet, "GetTwoPallet", reqDto.WarehouseCode, reqDto, _fjService.GetTwoPallet);
- }
- /// <summary>
- /// 申请货位
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes ApplyStockInLoc(FJApplyStockInLocRequest reqDto)
- {
- return ConcurrencyReqControl<FJApplyStockInLocRequest, SRes<FJApplyStockInLocResponse>>(lockApplyStockInLoc, "ApplyStockInLoc" + reqDto.PickUpEquipmentNo, reqDto.PickUpEquipmentNo, reqDto, _fjService.ApplyStockInLoc);
- }
- /// <summary>
- /// 平库申请货位
- /// </summary>
- /// <param name="reqEntity"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes<FJApplyStockInLocResponse> FindAvailableFlatStorageSlot(FJApplyStockInLocRequest reqDto)
- {
- return ConcurrencyReqControl<FJApplyStockInLocRequest, SRes<FJApplyStockInLocResponse>>(lockFindAvailableFlatStorageSlot, "FindAvailableFlatStorageSlot" + reqDto.PickUpEquipmentNo, reqDto.PickUpEquipmentNo, reqDto, _fjService.FindAvailableFlatStorageSlot);
- }
- /// <summary>
- /// 空托出库任务
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes ApplyEmptyPalletGroupOutStorage(FjApplyEmptyPalletGroupOutStorageRequest reqDto)
- {
- return ConcurrencyReqControl<FjApplyEmptyPalletGroupOutStorageRequest, SRes>(lockApplyEmptyPalletGroupOutStorage, "ApplyEmptyPalletGroupOutStorage", reqDto.AddTo, reqDto, _fjService.ApplyEmptyPalletGroupOutStorage);
- }
- /// <summary>
- /// 获取垛型数组
- /// </summary>
- /// <param name="req"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes<List<BillBomsetgrp>> FjGetSetGrpList(FjGetSetGrpListRequest req)
- {
- return _fjService.FjGetSetGrpList(req);
- }
- /// <summary>
- /// 环形库申请货位
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes<FJApplyStockInLocResponse> RingApplyStockInLoc(FJApplyStockInLocRequest reqDto)
- {
- return ConcurrencyReqControl<FJApplyStockInLocRequest, SRes<FJApplyStockInLocResponse>>(lockRingApplyStockInLoc, "RingApplyStockInLoc" + "Robot", "Robot", reqDto, _fjService.RingApplyStockInLoc);
- }
- /// <summary>
- /// WCS申请码垛出库
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes ApplyPalletizingStockOut(RingApplyPalletizingStockOutRequest reqDto)
- {
- return ConcurrencyReqControl<RingApplyPalletizingStockOutRequest, SRes>(lockApplyPalletizingStockOut, "ApplyPalletizingStockOut" + reqDto.WareHouseCode, reqDto.WareHouseCode, reqDto, _fjService.ApplyPalletizingStockOut);
- }
- /// <summary>
- /// 手动出库
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- [HttpPost]
- public string ManualTask(FJManualTaskRequest request)
- {
- lock (lockManualTask)
- {
- return _fjService.ManualTask(request);
- }
- }
- /// <summary>
- /// 堆垛机出库放货完成
- /// </summary>
- /// <param name="reqEntity"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes<int> SrmPickOutCompleted(SrmPickOutCompletedRequest reqDto)
- {
- lock (lockerSrmPickOutCompleted)
- {
- return _fjService.SrmPickOutCompleted(reqDto);
- }
- }
- /// <summary>
- /// 码垛创建异常任务
- /// </summary>
- /// <param name="reqEntity"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes PalletizingCreateseErrorTasks(PalletizingCreateseErrorTasksRequest reqDto)
- {
- return ConcurrencyReqControl<PalletizingCreateseErrorTasksRequest, SRes>(palletizingCreateseErrorTasks, "PalletizingCreateseErrorTasks" + reqDto.EquNo, reqDto.EquNo, reqDto, _fjService.PalletizingCreateseErrorTasks);
- }
- /// <summary>
- /// 获取任务信息
- /// </summary>
- /// <param name="barCode">条码</param>
- /// <returns></returns>
- [HttpPost]
- public SRes<WCS_TaskOld> GetTaskInfo(FJGetTaskInfoRequest dto)
- {
- return _fjService.GetTaskInfo(dto);
- }
- /// <summary>
- /// 完成任务
- /// </summary>
- /// <param name="reqEntity"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes<int> CompleteTask(CompleteTaskRequest reqDto)
- {
- lock (lockerCompleteTask)
- {
- return _fjService.CompleteTask(reqDto);
- }
- }
- /// <summary>
- /// 取消任务
- /// </summary>
- /// <param name="reqDto"></param>
- /// <returns></returns>
- [HttpPost]
- public SRes<int> CancelTask(CompleteTaskRequest reqDto)
- {
- lock (lockerCancelTask)
- {
- return _fjService.CancelTask(reqDto);
- }
- }
- #region 生成货位基础配置
- /// <summary>
- /// 分拣自动生成货位信息
- /// </summary>
- [HttpPost]
- public void FJAutoGenerateLocation()
- {
- //_fjService.FJ1NorthAutoGenerateLocation();
- _fjService.FJSouthAutoGenerateLocation();
- }
- #endregion 生成货位基础配置
- #region 生成货位基础配置
- /// <summary>
- /// 分拣环形库自动生成库位
- /// </summary>
- [HttpPost]
- public void RingLibraryAutoGenerateLocation(string WareCode)
- {
- _fjService.RingLibraryAutoGenerateLocation(WareCode);
- }
- #endregion 生成货位基础配置
- /// <summary>
- /// 工字轮/芯股进入主线扫码
- /// </summary>
- [HttpPost]
- public SRes<SRes> EnteMainLine(FJEnteMainLineRequest reqDto)
- {
- return ConcurrencyReqControl<FJEnteMainLineRequest, SRes<SRes>>(lockFJEnteMainLineRequest, "EnteMainLine" + reqDto.equNo, reqDto.equNo, reqDto, _fjService.EnteMainLine);
- }
- [HttpPost]
- public string GetId()
- {
- //var list = _fjService.GetBaseMatinfoList(p => p.Id < 1000);
- //foreach (var item in list)
- //{
- // var id = IdFactory.NewId();
- // //var tempid = item.Id;
- // item.WarehouseId = id;
- // _fjService.UpdateMaterModel(item);
- //}
- return IdFactory.NewId().ToString();
- }
- #region 定时器
- [HttpPost]
- public string StartJob(DetailRequest2Str req)
- {
- var res = new SRes();
- var sysjob = _fjService.GetSysJobEntity(new DetailRequest2Str() { Id = req.Id });
- if (sysjob == null)
- {
- res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
- 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 = ResponseStatusCodeEnum.ErrParam.GetHashCode();
- res.ResMsg = "参数错误";
- return res.ToCamelCaseString();
- }
- var jobEntity = _fjService.GetSysJobEntityByCode(reqEntity.Code);
- if (jobEntity == null)
- {
- res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
- res.ResMsg = "没有找到该编码";
- return res.ToCamelCaseString();
- }
- var jobapilist = _fjService.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 = _fjService.GetJobList();
- 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 = _fjService.GetSysJobEntityByCode(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";
- }
- }
- #endregion 定时器
- }
- }
|