1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144 |
- 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 数据归档
- /// <summary>
- /// 库存流水信息数据归档
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public SRes InvFlowMoveToHistory()
- {
- return ConcurrencyReqControl<SRes>("InvFlowMoveToHistory", "流水数据归档", _fjService.InvFlowMoveToHistory);
- }
- #endregion 数据归档
- #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 定时器
- }
- }
|