已删除4个文件
已修改43个文件
已添加6个文件
已重命名1个文件
| | |
| | | [Description("æååºåº")] |
| | | OutProduct = 230, |
| | | /// <summary> |
| | | /// æåå¯å®è½¬ä» |
| | | /// æåå¯å®åºåº |
| | | /// </summary> |
| | | [Description("æåå¯å®è½¬ä»")] |
| | | [Description("æåå¯å®åºåº")] |
| | | OutSendProduct = 240, |
| | | /// <summary> |
| | | /// æåMESåºåº/æåº |
| | | /// </summary> |
| | | [Description("æåMESåºåº/æåº")] |
| | | OutMesRworkProduct = 250, |
| | | /// <summary> |
| | | /// éè´å
¥åº |
| | | /// </summary> |
| | | [Description("éè´å
¥åº")] |
| | |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); |
| | | return null; |
| | | } |
| | | HttpHelper.Post($"{url}?taskNum={task.TaskNum}&locationCode={task.NextAddress}", "");//todo è°ç¨WMSä»»å¡å®ææ¹æ³ |
| | | //HttpHelper.Post($"{url}?taskNum={task.TaskNum}&locationCode={task.NextAddress}", "");//todo è°ç¨WMSä»»å¡å®ææ¹æ³ |
| | | } |
| | | |
| | | return task; |
| | |
| | | if (device != null) |
| | | { |
| | | OtherDevice client = (OtherDevice)device; |
| | | if (!client.GetValue<R_ConveyorLineDB, bool>(R_ConveyorLineDB.Goods, stationManger.StationCode))//åºåºç«å°æªè¢«å ç¨ |
| | | if (client.GetValue<R_ConveyorLineDB, bool>(R_ConveyorLineDB.Goods, stationManger.StationCode))//åºåºç«å°æªè¢«å ç¨ |
| | | { |
| | | task.NextAddress = stationManger.StackerCraneStationCode; |
| | | _taskRepository.UpdateData(task); |
| | |
| | | let year = date.getFullYear(); |
| | | let month = String(date.getMonth() + 1).padStart(2, "0"); |
| | | let day = String(date.getDate()).padStart(2, "0"); |
| | | this.editFormFields.lotNo = year + month + day; |
| | | let hour= String(date.getHours()).padStart(2, "0"); |
| | | let minute= String(date.getMinutes()).padStart(2, "0"); |
| | | let second= String(date.getSeconds()).padStart(2, "0"); |
| | | //å°yearæªååä¸¤ä½ |
| | | this.editFormFields.lotNo = (year.toString().substr(-2)) + month+day + hour + minute+second; |
| | | this.editFormFields.productionDate = year + "-" + month + "-" + day; |
| | | this.editFormFields.effectiveDate = year + 2 + "-" + month + "-" + day; |
| | | } |
| | |
| | | { title: "ç®æ å°å", field: "targetAddress", type: "like" }, |
| | | { title: "å建æ¶é´", field: "createDate", type: "datetime" }, |
| | | ], |
| | | [ |
| | | { title: "æå±ä»åº", field: "warehouseId",type: "selectList",dataKey: "warehouses",data: [],} |
| | | ], |
| | | ]); |
| | | const columns = ref([ |
| | | { |
| | |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "warehouseId", |
| | | title: "æå±ä»åº", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | bind: { key: "warehouses", data: [] }, |
| | | }, |
| | | { |
| | | field: "palletCode", |
| | | title: "æçç¼å·", |
| | | type: "string", |
| | |
| | | { title: "ç®æ å°å", field: "targetAddress", type: "like" }, |
| | | { title: "å建æ¶é´", field: "createDate", type: "datetime" }, |
| | | ], |
| | | [ |
| | | { title: "æå±ä»åº", field: "warehouseId",type: "selectList",dataKey: "warehouses",data: [],} |
| | | ], |
| | | ]); |
| | | const columns = ref([ |
| | | { |
| | |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "warehouseId", |
| | | title: "æå±ä»åº", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | bind: { key: "warehouses", data: [] }, |
| | | }, |
| | | { |
| | | field: "palletCode", |
| | | title: "æçç¼å·", |
| | | type: "string", |
| | |
| | | public IWarehouseRepository WarehouseRepository { get; } |
| | | |
| | | public IPalletTypeInfoRepository PalletTypeInfoRepository { get; } |
| | | public ICustomerInfoRepository CustomerInfoRepository { get; } |
| | | |
| | | public BasicRepository(ILocationInfoRepository locationInfoRepository, IMaterielInfoRepository materielInfoRepository, IWarehouseRepository warehouseRepository, IPalletTypeInfoRepository palletTypeInfoRepository) |
| | | public BasicRepository(ILocationInfoRepository locationInfoRepository, IMaterielInfoRepository materielInfoRepository, IWarehouseRepository warehouseRepository, IPalletTypeInfoRepository palletTypeInfoRepository, ICustomerInfoRepository customerInfoRepository) |
| | | { |
| | | LocationInfoRepository = locationInfoRepository; |
| | | MaterielInfoRepository = materielInfoRepository; |
| | | WarehouseRepository = warehouseRepository; |
| | | PalletTypeInfoRepository = palletTypeInfoRepository; |
| | | CustomerInfoRepository = customerInfoRepository; |
| | | } |
| | | } |
| | | } |
| | |
| | | List<Dt_PalletCodeInfo> palletCodeInfos = new List<Dt_PalletCodeInfo>(); |
| | | int serialNo = 0; |
| | | DateTime now = DateTime.Now; |
| | | Dt_PalletCodeInfo palletCodeInfo = BaseDal.QueryFirst(x => x.WarehouseId == warehouseId && x.PalletTypeId==palletTypeId, new Dictionary<string, OrderByType> { { nameof(Dt_PalletCodeInfo.SerialNo), OrderByType.Desc } }); |
| | | Dt_PalletCodeInfo palletCodeInfo = BaseDal.QueryFirst(x => x.WarehouseId == warehouseId && x.PalletTypeId==palletTypeId && x.CreateDate.Year == now.Year && x.CreateDate.Month == now.Month && x.CreateDate.Day == now.Day, new Dictionary<string, OrderByType> { { nameof(Dt_PalletCodeInfo.SerialNo), OrderByType.Desc } }); |
| | | if (palletCodeInfo != null && palletCodeInfo.CreateDate.Year == now.Year && palletCodeInfo.CreateDate.Month == now.Month && palletCodeInfo.CreateDate.Day == now.Day) |
| | | { |
| | | serialNo = palletCodeInfo.SerialNo + 1; |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | /// MES忥æååºåº |
| | | /// </summary> |
| | | [Description("MES忥æååºåº")] |
| | | WMS_MES_ShipmentOrderSync |
| | | WMS_MES_ShipmentOrderSync, |
| | | /// <summary> |
| | | /// åºåæ¿åºåº |
| | | /// </summary> |
| | | [Description("åºåæ¿åºåº")] |
| | | WMS_MES_ProductOutBound |
| | | } |
| | | } |
| | |
| | | [Description("æå¨åºæ¿åºåºæ£é")] |
| | | HandSubstrateOutPick = 400, |
| | | } |
| | | public enum MesRworkOutTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// 客é |
| | | /// </summary> |
| | | [Description("客é")] |
| | | ReturnGuest = 1, |
| | | |
| | | /// <summary> |
| | | /// åºåä¸è¯ |
| | | /// </summary> |
| | | [Description("åºåä¸è¯")] |
| | | OutOfStock = 2, |
| | | |
| | | /// <summary> |
| | | /// 使°æä» |
| | | /// </summary> |
| | | [Description("使°æä»")] |
| | | Withdrawn = 3 |
| | | } |
| | | } |
| | |
| | | [Description("æ£é宿")] |
| | | æ£é宿 =14, |
| | | |
| | | [Description("å¹³åºå
¥åºå®æ")] |
| | | å¹³åºå
¥åºå®æ = 15, |
| | | |
| | | [Description("éåº")] |
| | | MESéåº = 21, |
| | | |
| | |
| | | [Description("æååºåº")] |
| | | OutProduct = 230, |
| | | /// <summary> |
| | | /// æåå¯å®è½¬ä» |
| | | /// æåå¯å®åºåº |
| | | /// </summary> |
| | | [Description("æåå¯å®è½¬ä»")] |
| | | [Description("æåå¯å®åºåº")] |
| | | OutSendProduct = 240, |
| | | /// <summary> |
| | | /// æåMESåºåº/æåº |
| | | /// </summary> |
| | | [Description("æåMESåºåº/æåº")] |
| | | OutMesRworkProduct =250, |
| | | /// <summary> |
| | | /// éè´å
¥åº |
| | | /// </summary> |
| | | [Description("éè´å
¥åº")] |
| | |
| | | [Description("油墨ä»")] |
| | | HA153 |
| | | } |
| | | public enum WarehouseTypEnum |
| | | { |
| | | /// <summary> |
| | | /// åæ |
| | | /// </summary> |
| | | [Description("åæ")] |
| | | åæ, |
| | | /// <summary> |
| | | /// æå |
| | | /// </summary> |
| | | [Description("æå")] |
| | | æå, |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | [Description("æåå
¥åºåå·ç¼ç è§å")] |
| | | ProInCodeRule, |
| | | /// <summary> |
| | | /// æååºåºåå·ç¼ç è§å |
| | | /// </summary> |
| | | [Description("æååºåºåå·ç¼ç è§å")] |
| | | ProOutCOdeRule |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_DTO.ERP |
| | | { |
| | | /// <summary> |
| | | /// æå颿åºåº |
| | | /// </summary> |
| | | public class ErpProOutLingOrder |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public int RowId { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string OrderNo { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string PCode { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string PVer { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string PLot { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public int DateCode { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string WaType { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public float SetQty { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public float QtyPcs { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public float XQty { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string XSite { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string Unit { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string OrderDate { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string Note { get; set; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_DTO.MES |
| | | { |
| | | /// <summary> |
| | | /// åºåæ¿åºåº |
| | | /// </summary> |
| | | public class MesProductOutBound |
| | | { |
| | | /// <summary> |
| | | /// ä»»å¡åå· |
| | | /// </summary> |
| | | public string TaskNo { get; set; } |
| | | /// <summary> |
| | | /// 产åç¼ç |
| | | /// </summary> |
| | | public string ProductCode { get; set; } |
| | | /// <summary> |
| | | /// 产åçæ¬ |
| | | /// </summary> |
| | | public string ProductVersion { get; set; } |
| | | /// <summary> |
| | | /// 卿 |
| | | /// </summary> |
| | | public string DateCode { get; set; } |
| | | /// <summary> |
| | | /// éå®è®¢å |
| | | /// </summary> |
| | | public string SaleOrder { get; set; } |
| | | /// <summary> |
| | | /// ä»åºä¿¡æ¯ |
| | | /// </summary> |
| | | public List<MesInventoryInfo> InventoryInfo { get; set; } |
| | | } |
| | | /// <summary> |
| | | /// ä»åºä¿¡æ¯ |
| | | /// </summary> |
| | | public class MesInventoryInfo |
| | | { |
| | | /// <summary> |
| | | /// ä»åºä»£ç |
| | | /// </summary> |
| | | public string Warhouseno { get; set; } |
| | | /// <summary> |
| | | /// å
å
å· |
| | | /// </summary> |
| | | public string InternalPackageNumber { get; set; } |
| | | /// <summary> |
| | | /// SETæ°é |
| | | /// </summary> |
| | | public string SetCount { get; set; } |
| | | /// <summary> |
| | | /// åæ ¼PCSæ°é |
| | | /// </summary> |
| | | public string EligiblePcsCount { get; set; } |
| | | } |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Attributes; |
| | | |
| | | namespace WIDESEA_DTO.MES |
| | | { |
| | | /// <summary> |
| | | /// è¿å·¥æåº |
| | | /// </summary> |
| | | [ModelValidate] |
| | | public class RworkTaskModel |
| | | { |
| | | /// <summary> |
| | | /// ä»»å¡åå· |
| | | /// </summary> |
| | | [PropertyValidate("ä»»å¡åå·", NotNullAndEmpty = true)] |
| | | public string TaskNo { get; set; } |
| | | /// <summary> |
| | | /// 产åç¼ç |
| | | /// </summary> |
| | | [PropertyValidate("产åç¼ç ", NotNullAndEmpty = true)] |
| | | public string ProductCode { get; set; } |
| | | /// <summary> |
| | | /// 产ååç§° |
| | | /// </summary> |
| | | [PropertyValidate("产ååç§°", NotNullAndEmpty = true)] |
| | | public string ProductName { get; set; } |
| | | /// <summary> |
| | | /// 产åçæ¬ |
| | | /// </summary> |
| | | [PropertyValidate("产åçæ¬", NotNullAndEmpty = true)] |
| | | public string ProductVersion { get; set; } |
| | | /// <summary> |
| | | /// 卿 |
| | | /// </summary> |
| | | [PropertyValidate("卿", NotNullAndEmpty = true)] |
| | | public string DateCode { get; set; } |
| | | /// <summary> |
| | | /// éæ±æ°é |
| | | /// </summary> |
| | | [PropertyValidate("éæ±æ°é", NotNullAndEmpty = true)] |
| | | public float RequiredQuantity { get; set; } |
| | | /// <summary> |
| | | /// å·¥å |
| | |
| | | /// <summary> |
| | | /// éå®è®¢å |
| | | /// </summary> |
| | | [PropertyValidate("éå®è®¢å", NotNullAndEmpty = true)] |
| | | public string SaleOrder { get; set; } |
| | | /// <summary> |
| | | /// åºåç±»å |
| | | /// 1:客é<br/> |
| | | /// 2:åºåä¸è¯<br/> |
| | | /// 3:使°æä»<br/> |
| | | /// </summary> |
| | | [PropertyValidate("åºåç±»å", NotNullAndEmpty = true, Check = new object[] { 1, 2,3 })] |
| | | public int InventoryType { get; set; } |
| | | } |
| | | } |
| | |
| | | return response; |
| | | } |
| | | /// <summary> |
| | | /// æå仿£æ¥åºåºåºæ¨éERP |
| | | /// </summary> |
| | | /// <param name="checkModel"></param> |
| | | /// <returns></returns> |
| | | public string InvokeProCheckApi(ERPProductCheckModel checkModel) |
| | | { |
| | | Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.InvokeErpApi.ToString()); |
| | | ERPBaseModel<ERPProductCheckModel> model = new ERPBaseModel<ERPProductCheckModel>() |
| | | { |
| | | Data = checkModel, |
| | | Desc = "æåæ£éªå", |
| | | Type = " toFGIIqcChecked", |
| | | SecurityCode = "TeChuang" |
| | | }; |
| | | string request = JsonConvert.SerializeObject(model, settings); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, request); |
| | | return response; |
| | | } |
| | | /// <summary> |
| | | /// æåè¶
卿æ¥åºæ¨éERP |
| | | /// </summary> |
| | | /// <param name="sheetModel"></param> |
| | | /// <returns></returns> |
| | | public string InvokeProScrapSheetApi(ERPScrapSheetModel sheetModel) |
| | | { |
| | | Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.InvokeErpApi.ToString()); |
| | | ERPBaseModel<ERPScrapSheetModel> model = new ERPBaseModel<ERPScrapSheetModel>() |
| | | { |
| | | Data = sheetModel, |
| | | Desc = "æåæ¥åºå", |
| | | Type = " toFGIScrapSheet", |
| | | SecurityCode = "TeChuang" |
| | | }; |
| | | string request = JsonConvert.SerializeObject(model, settings); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, request); |
| | | return response; |
| | | } |
| | | /// <summary> |
| | | /// æåçç¹çèµ¢/çäº |
| | | /// </summary> |
| | | /// <param name="stockCheckModel"></param> |
| | | /// <returns></returns> |
| | | public string InvokeProStockCheckApi(ERPProStockCheckModel stockCheckModel) |
| | | { |
| | | Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.InvokeErpApi.ToString()); |
| | | ERPBaseModel<ERPProStockCheckModel> model = new ERPBaseModel<ERPProStockCheckModel>() |
| | | { |
| | | Data = stockCheckModel, |
| | | Desc = "æåçç¹å", |
| | | Type = "toStockCheck", |
| | | SecurityCode = "TeChuang" |
| | | }; |
| | | string request = JsonConvert.SerializeObject(model, settings); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, request); |
| | | return response; |
| | | } |
| | | /// <summary> |
| | | /// ERPç©æåºåºæ¥å£è°ç¨ |
| | | /// </summary> |
| | | /// <param name="outboundModel"></param> |
| | |
| | | /// <param name="inboundModel"></param> |
| | | /// <returns></returns> |
| | | string InvokeProInApi(ERPProInboundModel inboundModel); |
| | | /// <summary> |
| | | /// æå仿£æ¥åºåºåºæ¨éERP |
| | | /// </summary> |
| | | /// <param name="checkModel"></param> |
| | | /// <returns></returns> |
| | | string InvokeProCheckApi(ERPProductCheckModel checkModel); |
| | | /// <summary> |
| | | /// æåè¶
卿æ¥åºæ¨éERp |
| | | /// </summary> |
| | | /// <param name="sheetModel"></param> |
| | | /// <returns></returns> |
| | | string InvokeProScrapSheetApi(ERPScrapSheetModel sheetModel); |
| | | /// <summary> |
| | | /// æåçç¹çèµ¢/çäº |
| | | /// </summary> |
| | | /// <param name="stockCheckModel"></param> |
| | | /// <returns></returns> |
| | | string InvokeProStockCheckApi(ERPProStockCheckModel stockCheckModel); |
| | | } |
| | | } |
ÎļþÃû´Ó ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPStockCheckModel.cs ÐÞ¸Ä |
| | |
| | | /// <summary> |
| | | /// æåçç¹ |
| | | /// </summary> |
| | | public class ERPStockCheckModel |
| | | public class ERPProStockCheckModel |
| | | { |
| | | /// <summary> |
| | | /// æä½ç±»å |
| | |
| | | IWarehouseRepository WarehouseRepository { get; } |
| | | |
| | | IPalletTypeInfoRepository PalletTypeInfoRepository { get; } |
| | | ICustomerInfoRepository CustomerInfoRepository { get; } |
| | | |
| | | } |
| | | } |
| | |
| | | IOutStockLockInfoRepository OutboundStockLockInfoRepository { get; } |
| | | |
| | | IMesPPCutOutboundOrderRepository MesPPCutOutboundOrderRepository { get; } |
| | | IProOutOrderRepository ProOutOrderRepository { get; } |
| | | IProOutOrderDetailRepository ProOutOrderDetailRepository { get; } |
| | | IMesRworkOutboundOrderRepository RworkOutboundOrderRepository { get; } |
| | | } |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_Model.Models; |
| | |
| | | public interface IMesRworkOutboundOrderService : IService<Dt_MesRworkOutboundOrder> |
| | | { |
| | | IMesRworkOutboundOrderRepository Repository { get; } |
| | | /// <summary> |
| | | /// æåºä»»å¡åé
åºå |
| | | /// </summary> |
| | | /// <param name="mesOutboundOrder"></param> |
| | | /// <returns></returns> |
| | | (List<Dt_ProStockInfo>?, Dt_MesRworkOutboundOrder?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>) AssignMesStocks(Dt_MesRworkOutboundOrder mesRworkOutboundOrders); |
| | | /// <summary> |
| | | /// å¤çåºåºæ°æ® |
| | | /// </summary> |
| | | WebResponseContent LockOutboundStockDataUpdate(List<Dt_ProStockInfo> stockInfos, List<Dt_OutProStockInfo> outStockLockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null); |
| | | } |
| | | } |
| | |
| | | { |
| | | IOutProStockInfoRepository Repository { get; } |
| | | Dt_OutProStockInfo GetOutStockLockInfo(Dt_ProOutOrder proOutOrder, Dt_ProOutOrderDetail proOutOrderDetail, Dt_ProStockInfo proStockInfo, float assignQty, int? taskNum = null); |
| | | //å¤çæåºåºåºè¯¦æ
|
| | | Dt_OutProStockInfo GetOutStockLockInfo(Dt_MesRworkOutboundOrder mesOutboundOrder, Dt_ProStockInfo outStock, float assignQuantity, int? taskNum = null); |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// åé
åºåå¤çè´§ä½æ°æ® |
| | | /// </summary> |
| | | (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(int warehouseId,Dt_ProOutOrder proOutOrder); |
| | | (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(List<Dt_ProOutOrderDetail> proOutOrderDetails); |
| | | /// <summary> |
| | | /// åºåºä»»å¡æ°æ®å¤ç |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | WebResponseContent ProductDeliveryOrder(ErpProOutOrderDTO outOrderDTO); |
| | | /// <summary> |
| | | /// æååºå¾
åè´§åº(å¹³åº)+忥ERPåºåº |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | WebResponseContent OutProductPK(string[] OutPKCodes, string ProOutNo); |
| | | } |
| | | } |
| | |
| | | /// æ¥æ¾å¯ç¨åºå |
| | | /// </summary> |
| | | List<Dt_ProStockInfo> GetProStocks(Dt_ProOutOrderDetail proOutOrderDetail,List<string> locationInfos); |
| | | /// <summary> |
| | | /// è·åæååºå |
| | | /// </summary> |
| | | List<Dt_ProStockInfo> GetProStocks(Dt_MesRworkOutboundOrder mesRworkOutboundOrder, List<string> locationInfos); |
| | | } |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IStockRepository; |
| | | using WIDESEA_Model.Models; |
| | |
| | | { |
| | | IProStockInfoRepository Repository { get; } |
| | | /// <summary> |
| | | /// æ ¹æ®å¤å
ä¿¡æ¯è§£ç»å
å
ä¸è¶æ¡åºåä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="proStockInfoDetails"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent UnBindStock(List<Dt_ProStockInfoDetail> proStockInfoDetails); |
| | | /// <summary> |
| | | /// æ¥æ¾å¯ç¨åºå |
| | | /// </summary> |
| | | List<Dt_ProStockInfo> GetUseableStocks(int warehoseId, Dt_ProOutOrderDetail proOutOrderDetail); |
| | |
| | | /// è·ååºåºåºå |
| | | /// </summary> |
| | | List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_ProOutOrderDetail outOrderDetail, float needQuantity, out float residueQuantity); |
| | | |
| | | /// <summary> |
| | | /// MESæåºå¯ç¨åºå |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<Dt_ProStockInfo> GetUseableStocks(Dt_MesRworkOutboundOrder mesRworkOutboundOrder); |
| | | /// <summary> |
| | | /// è·åMESæåºåºå |
| | | /// </summary> |
| | | List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_MesRworkOutboundOrder mesRworkOutboundOrder, float needQuantity, out float residueQuantity); |
| | | } |
| | | } |
| | |
| | | *----------------------------------------------------------------*/ |
| | | #endregion << ç æ¬ 注 é >> |
| | | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | /// <param name="ProOutNo">åºåºè®¢åå·</param> |
| | | /// <param name="StationCode">ç«å°å°å</param> |
| | | /// <returns></returns> |
| | | WebResponseContent OutProductTask(string ProOutNo, string StationCode); |
| | | WebResponseContent OutProductTask(int[] keys, string StationCode); |
| | | //åºåæ¿åºåº |
| | | WebResponseContent ProductOutBoundSync(MesProductOutBound model); |
| | | } |
| | | } |
| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.Globalization; |
| | | using System.Linq; |
| | | using System.Linq.Expressions; |
| | | using System.Reflection.Metadata; |
| | |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å
¥åºåæç»ä¿¡æ¯"); |
| | | } |
| | | List<MatSerNumAnalysisModel> models = CodeAnalysisHelper.CodeAnalysis<MatSerNumAnalysisModel>(AnalysisCodeEnum.MatSerNumAnalysis, serNums); |
| | | //éªè¯å¤ææ¶é´æ ¼å¼ |
| | | WebResponseContent IsValidContent = IsValidMCDates(models); |
| | | if (!IsValidContent.Status) |
| | | { |
| | | return content.Error(IsValidContent.Message); |
| | | } |
| | | //é¤éè´å
¥åºå以å¤å
¶ä»å
¥åºåç»çæ°æ®å¤ç |
| | | if (inboundOrder.OrderType != InOrderTypeEnum.Purchase.ObjToInt()) |
| | | { |
| | |
| | | } |
| | | |
| | | List<string> purchaseOrderNos = receiveOrder.Details.Select(x => x.PurchaseOrderNo).ToList(); |
| | | |
| | | if (models.Select(x => x.MaterielCode).Distinct().Count() > 1) |
| | | { |
| | | return WebResponseContent.Instance.Error($"ç©æä¸å¯æ··æ¾"); |
| | |
| | | { |
| | | return content.Error($"ç©æä¸å¯æ··æ¾"); |
| | | } |
| | | |
| | | //éªè¯å¤ææ¶é´æ ¼å¼ |
| | | WebResponseContent IsValidContent = IsValidMCDates(models); |
| | | if (!IsValidContent.Status) |
| | | { |
| | | return content.Error(IsValidContent.Message); |
| | | } |
| | | string materielCode = models.FirstOrDefault()?.MaterielCode ?? ""; |
| | | Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == materielCode); |
| | | if (materielInfo == null) |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"ç©æä¸å¯æ··æ¾"); |
| | | } |
| | | |
| | | //éªè¯å¤ææ¶é´æ ¼å¼ |
| | | WebResponseContent IsValidContent = IsValidMCDates(models); |
| | | if (!IsValidContent.Status) |
| | | { |
| | | return content.Error(IsValidContent.Message); |
| | | } |
| | | string materielCode = models.FirstOrDefault()?.MaterielCode ?? ""; |
| | | Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == materielCode); |
| | | if (materielInfo == null) |
| | |
| | | } |
| | | return -1; |
| | | } |
| | | /// <summary> |
| | | /// 夿æ£ç¡®æ¶é´æ ¼å¼ |
| | | /// </summary> |
| | | public WebResponseContent IsValidMCDates(List<MatSerNumAnalysisModel> analysisModels) |
| | | { |
| | | string[] effDates = analysisModels.Select(x => x.EffectiveDate).Distinct().ToArray(); |
| | | string[] ProDates = analysisModels.Select(x => x.ProductionDate).Distinct().ToArray(); |
| | | foreach (string effDate in effDates) |
| | | { |
| | | string format = "yyyy-MM-dd"; // ç®æ æ ¼å¼ |
| | | DateTime parsedDate; |
| | | // è§£æå¹¶éªè¯æ ¼å¼ |
| | | bool isValid = DateTime.TryParseExact( |
| | | effDate, |
| | | format, |
| | | CultureInfo.InvariantCulture, |
| | | DateTimeStyles.None, |
| | | out parsedDate |
| | | ); |
| | | |
| | | if (!isValid) |
| | | { |
| | | return WebResponseContent.Instance.Error("æ ¼å¼æ æææ¥æä¸åæ³"); |
| | | } |
| | | } |
| | | foreach (string ProDate in ProDates) |
| | | { |
| | | string format = "yyyy-MM-dd"; // ç®æ æ ¼å¼ |
| | | DateTime parsedDate; |
| | | // è§£æå¹¶éªè¯æ ¼å¼ |
| | | bool isValid = DateTime.TryParseExact( |
| | | ProDate, |
| | | format, |
| | | CultureInfo.InvariantCulture, |
| | | DateTimeStyles.None, |
| | | out parsedDate |
| | | ); |
| | | |
| | | if (!isValid) |
| | | { |
| | | return WebResponseContent.Instance.Error("æ ¼å¼æ æææ¥æä¸åæ³"); |
| | | } |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | } |
| | | } |
| | |
| | | using AutoMapper; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Globalization; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.CodeConfigEnum; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_ICheckRepository; |
| | | using WIDESEA_IInboundRepository; |
| | | using WIDESEA_IInboundService; |
| | | using WIDESEA_IStockRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_InboundService |
| | |
| | | private readonly IInboundRepository _inboundRepository; |
| | | private readonly IBasicRepository _basicRepository; |
| | | private readonly ICheckOrderRepository _checkOrderRepository; |
| | | private readonly IStockRepository _stockRepository; |
| | | |
| | | public ReceiveOrderDetailService(IReceiveOrderDetailRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IInboundRepository inboundRepository, IBasicRepository basicRepository, ICheckOrderRepository checkOrderRepository) : base(BaseDal) |
| | | public ReceiveOrderDetailService(IReceiveOrderDetailRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IInboundRepository inboundRepository, IBasicRepository basicRepository, ICheckOrderRepository checkOrderRepository, IStockRepository stockRepository) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _inboundRepository = inboundRepository; |
| | | _basicRepository = basicRepository; |
| | | _checkOrderRepository = checkOrderRepository; |
| | | _stockRepository = stockRepository; |
| | | } |
| | | |
| | | private static object _rowNoLocker = new object(); |
| | |
| | | } |
| | | |
| | | MatSerNumAnalysisModel model = CodeAnalysisHelper.CodeAnalysis<MatSerNumAnalysisModel>(AnalysisCodeEnum.MatSerNumAnalysis, serNum); |
| | | //æ¶è´§å¢å æ¹æ¬¡å¡æ§ |
| | | //æ¥è¯¢æ¶è´§æç»æ¯å¦æåå¨åä¸ä¸ªæ¹æ¬¡ |
| | | Dt_ReceiveOrderDetail receiveOrderDetailOld = _inboundRepository.ReceiveOrderDetailRepository.QueryFirst(x => x.LotNo == model.LotNo); |
| | | Dt_ReceiveOrder? receiveOrderOld = null; |
| | | if (receiveOrderDetailOld!=null) |
| | | { |
| | | receiveOrderOld = _inboundRepository.ReceiveOrderRepository.QueryFirst(x => x.ReceiveOrderId == receiveOrderDetailOld.ReceiveOrderId); |
| | | } |
| | | if (receiveOrderDetailOld!=null && receiveOrderOld?.WarehouseId== receiveOrder.WarehouseId) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æ¶è´§åå·{receiveOrderOld.ReceiveOrderNo}䏿¹æ¬¡{model.LotNo}å·²åå¨"); |
| | | } |
| | | //æ¥è¯¢åºåæ¹æ¬¡æ¯å¦æåå¨åä¸ä¸ªæ¹æ¬¡ |
| | | Dt_StockInfoDetail stockInfoDetail = _stockRepository.StockInfoDetailRepository.QueryFirst(x => x.BatchNo == model.LotNo); |
| | | Dt_StockInfo? stockInfo = null; |
| | | if (stockInfoDetail!=null) |
| | | { |
| | | stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.Id == stockInfoDetail.Id); |
| | | } |
| | | if (stockInfoDetail!=null && stockInfo?.WarehouseId==receiveOrder.WarehouseId) |
| | | { |
| | | return WebResponseContent.Instance.Error($"åºå{stockInfo.PalletCode}䏿¹æ¬¡{model.LotNo}å·²åå¨"); |
| | | } |
| | | if (model!=null) |
| | | { |
| | | string format = "yyyy-MM-dd"; // ç®æ æ ¼å¼ |
| | | DateTime parsedDate; |
| | | // è§£æéªè¯æ ¼å¼ |
| | | bool isValidEffDate = DateTime.TryParseExact( |
| | | model.EffectiveDate, |
| | | format, |
| | | CultureInfo.InvariantCulture, |
| | | DateTimeStyles.None, |
| | | out parsedDate |
| | | ); |
| | | bool isValidProDate = DateTime.TryParseExact( |
| | | model.ProductionDate, |
| | | format, |
| | | CultureInfo.InvariantCulture, |
| | | DateTimeStyles.None, |
| | | out parsedDate |
| | | ); |
| | | |
| | | if (!isValidEffDate || !isValidProDate) |
| | | { |
| | | return WebResponseContent.Instance.Error("æ ¼å¼æ æææ¥æä¸åæ³"); |
| | | } |
| | | } |
| | | Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == model.MaterielCode); |
| | | if (materielInfo == null) |
| | | { |
| | |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ä»»å¡åå·")] |
| | | public string TaskNo { get; set; } |
| | | |
| | | ///// <summary> |
| | | ///// åæ®æ°é |
| | | ///// </summary> |
| | | //[SugarColumn(IsNullable = false, ColumnDescription = "åæ®æ°é")] |
| | | //public float OrderQuantity { get; set; } |
| | | /// <summary> |
| | | /// é宿°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "é宿°é", DefaultValue = "0")] |
| | | public float LockQuantity { get; set; } |
| | | |
| | | ///// <summary> |
| | | ///// é宿°é |
| | | ///// </summary> |
| | | //[SugarColumn(IsNullable = false, ColumnDescription = "é宿°é", DefaultValue = "0")] |
| | | //public float LockQuantity { get; set; } |
| | | |
| | | ///// <summary> |
| | | ///// å·²åºæ°é |
| | | ///// </summary> |
| | | //[SugarColumn(IsNullable = false, ColumnDescription = "å·²åºæ°é", DefaultValue = "0")] |
| | | //public float OverOutQuantity { get; set; } |
| | | /// <summary> |
| | | /// å·²åºæ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "å·²åºæ°é", DefaultValue = "0")] |
| | | public float OverOutQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®ç¶æ |
| | |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "å建æ¹å¼", IsOnlyIgnoreUpdate = true)] |
| | | public int CreateType { get; set; } |
| | | |
| | | ///// <summary> |
| | | ///// åæ®ç±»å |
| | | ///// </summary> |
| | | //[SugarColumn(IsNullable = false, ColumnDescription = "åæ®ç±»å", IsOnlyIgnoreUpdate = true)] |
| | | //public int OrderType { get; set; } |
| | | /// <summary> |
| | | /// åæ®ç±»å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ®ç±»å", IsOnlyIgnoreUpdate = true)] |
| | | public int OrderType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 产åç¼ç |
| | |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "éå®è®¢å")] |
| | | public string SaleOrder { get; set; } |
| | | /// <summary> |
| | | /// åºåç±»å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åºåç±»å", IsOnlyIgnoreUpdate = true)] |
| | | public int InventoryType { get; set; } |
| | | } |
| | | } |
| | |
| | | public IOutStockLockInfoRepository OutboundStockLockInfoRepository { get; } |
| | | |
| | | public IMesPPCutOutboundOrderRepository MesPPCutOutboundOrderRepository { get; } |
| | | public IProOutOrderRepository ProOutOrderRepository { get; } |
| | | public IProOutOrderDetailRepository ProOutOrderDetailRepository { get; } |
| | | public IMesRworkOutboundOrderRepository RworkOutboundOrderRepository { get; } |
| | | |
| | | public OutboundRepository(IOutboundOrderDetailRepository outboundOrderDetailRepository, IOutboundOrderRepository outboundOrderRepository, IOutStockLockInfoRepository outboundStockLockInfoRepository,IMesPPCutOutboundOrderRepository mesPPCutOutboundOrderRepository) |
| | | public OutboundRepository(IOutboundOrderDetailRepository outboundOrderDetailRepository, IOutboundOrderRepository outboundOrderRepository, IOutStockLockInfoRepository outboundStockLockInfoRepository,IMesPPCutOutboundOrderRepository mesPPCutOutboundOrderRepository, IProOutOrderRepository proOutOrderRepository, IProOutOrderDetailRepository proOutOrderDetailRepository, IMesRworkOutboundOrderRepository rworkOutboundOrderRepository) |
| | | { |
| | | OutboundOrderDetailRepository = outboundOrderDetailRepository; |
| | | OutboundOrderRepository = outboundOrderRepository; |
| | | OutboundStockLockInfoRepository = outboundStockLockInfoRepository; |
| | | MesPPCutOutboundOrderRepository = mesPPCutOutboundOrderRepository; |
| | | ProOutOrderRepository = proOutOrderRepository; |
| | | ProOutOrderDetailRepository = proOutOrderDetailRepository; |
| | | RworkOutboundOrderRepository = rworkOutboundOrderRepository; |
| | | } |
| | | } |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IOutboundRepository; |
| | |
| | | private readonly IOutStockLockInfoService _outStockLockInfoService; |
| | | private readonly IBasicService _basicService; |
| | | private readonly IRecordService _recordService; |
| | | private readonly IOutProStockInfoService _outProStockInfoService; |
| | | |
| | | public IMesRworkOutboundOrderRepository Repository => BaseDal; |
| | | |
| | | public MesRworkOutboundOrderService(IMesRworkOutboundOrderRepository BaseDal, IBasicRepository basicRepository, IStockService stockService, IOutStockLockInfoService outStockLockInfoService, IBasicService basicService, IRecordService recordService) : base(BaseDal) |
| | | public MesRworkOutboundOrderService(IMesRworkOutboundOrderRepository BaseDal, IBasicRepository basicRepository, IStockService stockService, IOutStockLockInfoService outStockLockInfoService, IBasicService basicService, IRecordService recordService, IOutProStockInfoService outProStockInfoService) : base(BaseDal) |
| | | { |
| | | _basicRepository = basicRepository; |
| | | _stockService = stockService; |
| | | _outStockLockInfoService = outStockLockInfoService; |
| | | _basicService = basicService; |
| | | _recordService = recordService; |
| | | _outProStockInfoService = outProStockInfoService; |
| | | } |
| | | /// <summary> |
| | | /// æåºä»»å¡åé
åºå |
| | | /// </summary> |
| | | public (List<Dt_ProStockInfo>?,Dt_MesRworkOutboundOrder?,List<Dt_OutProStockInfo>?,List<Dt_LocationInfo>) AssignMesStocks(Dt_MesRworkOutboundOrder mesRworkOutboundOrder) |
| | | { |
| | | List<Dt_ProStockInfo> proStockInfos = new List<Dt_ProStockInfo>(); |
| | | Dt_MesRworkOutboundOrder assignOutOrder= new Dt_MesRworkOutboundOrder(); |
| | | List<Dt_OutProStockInfo> outProStockInfos=new List<Dt_OutProStockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos=new List<Dt_LocationInfo>(); |
| | | float originalNeedQuantity = mesRworkOutboundOrder.RequiredQuantity; |
| | | |
| | | float needQuantity = originalNeedQuantity; |
| | | |
| | | //æ¥æ¾å¯ç¨åºå |
| | | List<Dt_ProStockInfo> stockInfoss = _stockService.ProStockInfoService.GetUseableStocks(mesRworkOutboundOrder); |
| | | if (!stockInfoss.Any()) |
| | | { |
| | | throw new Exception("æªæ¾å°å¯åé
åºå"); |
| | | } |
| | | List<Dt_ProStockInfo> autoAssignStocks = _stockService.ProStockInfoService.GetOutboundStocks(stockInfoss,mesRworkOutboundOrder, needQuantity,out float residueQuantity); |
| | | mesRworkOutboundOrder.LockQuantity += needQuantity - residueQuantity; |
| | | autoAssignStocks.OrderBy(x => x.proStockInfoDetails.FirstOrDefault()?.StockPcsQty).ToList(); |
| | | proStockInfos.AddRange(autoAssignStocks); |
| | | float assignQuantity = needQuantity - residueQuantity; |
| | | |
| | | float orderQuantity = mesRworkOutboundOrder.RequiredQuantity; |
| | | for (int j = 0; j < autoAssignStocks.Count; j++) |
| | | { |
| | | //åºåºè®¢åæç»å·²åé
æ°é |
| | | float detailAssignQuantity = outProStockInfos |
| | | .Where(x => x.SaleOrder == mesRworkOutboundOrder.SaleOrder |
| | | && x.PCode == mesRworkOutboundOrder.ProductCode |
| | | && x.PVer == mesRworkOutboundOrder.ProductVersion) |
| | | .Sum(x => x.AssignQuantity); |
| | | |
| | | //åºåºè¯¦æ
å·²åé
æ°é |
| | | float palletAssignQuantity = outProStockInfos |
| | | .Where(x => x.SaleOrder == mesRworkOutboundOrder.SaleOrder |
| | | && x.PCode == mesRworkOutboundOrder.ProductCode |
| | | && x.PVer == mesRworkOutboundOrder.ProductVersion |
| | | && x.PalletCode == autoAssignStocks[j].PalletCode) |
| | | .Sum(x => x.AssignQuantity); |
| | | |
| | | float palletOutboundQuantity = autoAssignStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity); |
| | | if (palletAssignQuantity < palletOutboundQuantity)//妿åºåºè¯¦æ
å·²åé
æ°éå°äºæçå·²åé
æ°éï¼åå¯ä»¥ç»§ç»æ·»å 该æçåºåºä¿¡æ¯ |
| | | { |
| | | float orderDetailNeedQuantity = mesRworkOutboundOrder.RequiredQuantity - detailAssignQuantity; |
| | | if (orderDetailNeedQuantity > autoAssignStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity) - palletAssignQuantity) |
| | | { |
| | | mesRworkOutboundOrder.LockQuantity += autoAssignStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity) - palletAssignQuantity; |
| | | Dt_OutProStockInfo outStockLockInfo = _outProStockInfoService.GetOutStockLockInfo(mesRworkOutboundOrder, autoAssignStocks[j], autoAssignStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity) - palletAssignQuantity); |
| | | outProStockInfos.Add(outStockLockInfo); |
| | | } |
| | | else |
| | | { |
| | | Dt_OutProStockInfo outStockLockInfo = _outProStockInfoService.GetOutStockLockInfo(mesRworkOutboundOrder, autoAssignStocks[j], mesRworkOutboundOrder.RequiredQuantity-mesRworkOutboundOrder.LockQuantity); |
| | | outProStockInfos.Add(outStockLockInfo); |
| | | mesRworkOutboundOrder.LockQuantity = mesRworkOutboundOrder.RequiredQuantity; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(proStockInfos.Select(x => x.LocationCode).ToList())); |
| | | |
| | | return (proStockInfos, assignOutOrder, outProStockInfos, locationInfos); |
| | | } |
| | | public WebResponseContent LockOutboundStockDataUpdate(List<Dt_ProStockInfo> stockInfos, List<Dt_OutProStockInfo> outStockLockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null) |
| | | { |
| | | try |
| | | { |
| | | stockInfos.ForEach(x => { |
| | | x.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | }); |
| | | _stockService.ProStockInfoService.Repository.UpdateData(stockInfos); |
| | | List<Dt_ProStockInfoDetail> stockInfoDetails = new List<Dt_ProStockInfoDetail>(); |
| | | foreach (var item in stockInfos) |
| | | { |
| | | stockInfoDetails.AddRange(item.proStockInfoDetails); |
| | | } |
| | | _stockService.ProStockInfoDetailService.Repository.UpdateData(stockInfoDetails); |
| | | |
| | | List<Dt_OutProStockInfo> addOutStockLockInfos = outStockLockInfos.Where(x => x.Id == 0).ToList(); |
| | | if (addOutStockLockInfos != null && addOutStockLockInfos.Any()) |
| | | { |
| | | if (tasks != null) |
| | | { |
| | | addOutStockLockInfos.ForEach(x => |
| | | { |
| | | x.TaskNum = tasks.FirstOrDefault(v => v.PalletCode == x.PalletCode)?.TaskNum; |
| | | }); |
| | | } |
| | | |
| | | _outProStockInfoService.Repository.AddData(addOutStockLockInfos); |
| | | } |
| | | List<Dt_OutProStockInfo> updateOutStockLockInfos = outStockLockInfos.Where(x => x.Id > 0).ToList(); |
| | | if (updateOutStockLockInfos != null && updateOutStockLockInfos.Any()) |
| | | { |
| | | _outProStockInfoService.Repository.UpdateData(updateOutStockLockInfos); |
| | | } |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, locationStatus, LocationChangeType.OutboundAssignLocation, "", tasks?.Select(x => x.TaskNum).ToList()); |
| | | _basicService.LocationInfoService.Repository.UpdateLocationStatus(locationInfos, locationStatus); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | }; |
| | | return outProStockInfo; |
| | | } |
| | | public Dt_OutProStockInfo GetOutStockLockInfo(Dt_MesRworkOutboundOrder mesOutboundOrder, Dt_ProStockInfo outStock, float assignQuantity, int? taskNum = null) |
| | | { |
| | | |
| | | Dt_OutProStockInfo outProStockInfo = new Dt_OutProStockInfo() |
| | | { |
| | | OrderNo = mesOutboundOrder.OrderNo, |
| | | OrderDetailId = mesOutboundOrder.Id, |
| | | OrderType = mesOutboundOrder.OrderType, |
| | | BatchNo = outStock.proStockInfoDetails.FirstOrDefault()?.LotNumber, |
| | | SaleOrder = mesOutboundOrder.SaleOrder, |
| | | Customer = "", |
| | | PCode = mesOutboundOrder.ProductCode, |
| | | PVer = mesOutboundOrder.ProductVersion, |
| | | PLot = outStock.proStockInfoDetails.FirstOrDefault()?.LotNumber, |
| | | DateCode = mesOutboundOrder.DateCode, |
| | | StockId = outStock.Id, |
| | | OrderQuantity = mesOutboundOrder.RequiredQuantity, |
| | | OriginalQuantity = outStock.proStockInfoDetails.Sum(x => x.StockPcsQty), |
| | | AssignQuantity = assignQuantity, |
| | | LocationCode = outStock.LocationCode, |
| | | PalletCode = outStock.PalletCode, |
| | | Unit = "PCS", |
| | | TaskNum = taskNum, |
| | | Status = taskNum == null ? OutLockStockStatusEnum.å·²åé
.ObjToInt() : OutLockStockStatusEnum.åºåºä¸.ObjToInt() |
| | | }; |
| | | |
| | | return outProStockInfo; |
| | | } |
| | | } |
| | | } |
| | |
| | | int pageNo = saveModel.MainData["pageNo"].ObjToInt(); |
| | | string? orderNo = saveModel.MainData["orderNo"].ToString(); |
| | | int warehouseId = saveModel.MainData["warehouseId"].ObjToInt(); |
| | | List<Dt_OutboundOrder> dt_ReceiveOrders = new List<Dt_OutboundOrder>(); |
| | | List<Dt_OutboundOrder> _OutboundOrders = new List<Dt_OutboundOrder>(); |
| | | if (string.IsNullOrEmpty(orderNo)) |
| | | { |
| | | dt_ReceiveOrders = Db.Queryable<Dt_OutboundOrder>().Where(x => x.OrderStatus < OutLockStockStatusEnum.åºåºå®æ.ObjToInt() && x.WarehouseId == warehouseId).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5); |
| | | _OutboundOrders = Db.Queryable<Dt_OutboundOrder>().Where(x => x.OrderStatus < OutOrderStatusEnum.åºåºå®æ.ObjToInt() && x.WarehouseId == warehouseId).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5); |
| | | } |
| | | else |
| | | { |
| | | dt_ReceiveOrders = Db.Queryable<Dt_OutboundOrder>().Where(x => (x.OrderNo.Contains(orderNo)) && x.OrderStatus < OutLockStockStatusEnum.åºåºå®æ.ObjToInt() && x.WarehouseId == warehouseId).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5); |
| | | _OutboundOrders = Db.Queryable<Dt_OutboundOrder>().Where(x => (x.OrderNo.Contains(orderNo)) && x.OrderStatus < OutOrderStatusEnum.åºåºå®æ.ObjToInt() && x.WarehouseId == warehouseId).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5); |
| | | } |
| | | |
| | | content.OK(data: dt_ReceiveOrders); |
| | | content.OK(data: _OutboundOrders); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | Dt_OutboundOrder oldOutboundOrder = BaseDal.Db.Queryable<Dt_OutboundOrder>().Where(x => x.UpperOrderNo == model.OrderNo && x.OrderStatus < OutOrderStatusEnum.å
³é.ObjToInt()).Includes(x => x.Details).OrderBy(x => x.CreateDate).First(); |
| | | Dt_MaterielInfo materielInfo = _basicService.MaterielInfoService.Repository.QueryFirst(x => x.MaterielCode == model.MCode); |
| | | |
| | | if (materielInfo == null) |
| | | { |
| | | DelOutOrder(oldOutboundOrder); |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥ç©æä¿¡æ¯"); |
| | | } |
| | | |
| | | Dt_Warehouse warehouse = _basicService.WarehouseService.Repository.QueryFirst(x => x.WarehouseCode == model.WaId); |
| | | if (warehouse == null) |
| | | { |
| | | DelOutOrder(oldOutboundOrder); |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥ä»åºä¿¡æ¯"); |
| | | } |
| | | |
| | | Dt_OutboundOrder oldOutboundOrder = BaseDal.Db.Queryable<Dt_OutboundOrder>().Where(x => x.UpperOrderNo == model.OrderNo).Includes(x => x.Details).First(); |
| | | |
| | | if (model.Way == 1) |
| | | { |
| | |
| | | { |
| | | if (oldOutboundOrder.Details.FirstOrDefault(x => x.RowNo == Convert.ToInt32(model.RowNo)) != null) |
| | | { |
| | | DelOutOrder(oldOutboundOrder); |
| | | return WebResponseContent.Instance.Error($"该æç»è¡å·å·²åå¨"); |
| | | } |
| | | if (oldOutboundOrder.WarehouseId != warehouse.WarehouseId) |
| | | { |
| | | DelOutOrder(oldOutboundOrder); |
| | | return WebResponseContent.Instance.Error($"ä»åºä¸ä¸è´"); |
| | | } |
| | | else |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// è¯¥åæ®å¤±è´¥è¿è¡å é¤ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public void DelOutOrder(Dt_OutboundOrder outboundOrder) |
| | | { |
| | | try |
| | | { |
| | | if (outboundOrder != null && outboundOrder.Details.Count > 0) |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | _outboundOrderRepository.DeleteAndMoveIntoHty(outboundOrder, OperateTypeEnum.èªå¨å é¤); |
| | | _outboundOrderDetailRepository.DeleteAndMoveIntoHty(outboundOrder.Details, OperateTypeEnum.èªå¨å é¤); |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | //䏿¥åºåºå®æ |
| | | public WebResponseContent TestOutUpload(int id, List<Dt_OutStockLockInfo>? outStockLockInfos) |
| | | { |
| | |
| | | private readonly IStockService _stockInfoService; |
| | | private readonly IBasicService _basicService; |
| | | private readonly IOutProStockInfoService _outProStockInfoService; |
| | | private readonly IProOutOrderRepository _proOutOrderRepository; |
| | | private readonly IRecordService _recordService; |
| | | public ProOutOrderDetailService(IProOutOrderDetailRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockService stockInfoService, IBasicService basicService,IOutProStockInfoService outProStockInfoService, IRecordService recordService) : base(BaseDal) |
| | | public ProOutOrderDetailService(IProOutOrderDetailRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockService stockInfoService, IBasicService basicService,IOutProStockInfoService outProStockInfoService, IRecordService recordService, IProOutOrderRepository proOutOrderRepository) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _stockInfoService = stockInfoService; |
| | | _basicService = basicService; |
| | | _outProStockInfoService = outProStockInfoService; |
| | | _recordService = recordService; |
| | | _proOutOrderRepository=proOutOrderRepository; |
| | | } |
| | | /// <summary> |
| | | /// åºåºåºååé
åï¼æ´æ°æ°æ®åºæ°æ® |
| | |
| | | /// <summary> |
| | | /// åé
åºåå¤çè´§ä½æ°æ® |
| | | /// </summary> |
| | | public (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(int warehouseId, Dt_ProOutOrder proOutOrder) |
| | | public (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(List<Dt_ProOutOrderDetail> proOutOrderDetails) |
| | | { |
| | | List<Dt_ProOutOrderDetail> OutOrderDetails = proOutOrder.Details; |
| | | if (!OutOrderDetails.Any()) |
| | | { |
| | | throw new Exception($"æªæ¾å°åºåºåæç»ä¿¡æ¯"); |
| | | } |
| | | List<Dt_ProStockInfo> outStocks = new List<Dt_ProStockInfo>(); |
| | | List<Dt_OutProStockInfo> outProStockInfos = new List<Dt_OutProStockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | List<Dt_ProOutOrderDetail> groupDetails = OutOrderDetails.GroupBy(x => new { x.SaleOrder, x.PCode, x.PVer, x.PLot, x.DateCode }).Select(x => new Dt_ProOutOrderDetail() |
| | | //è·åæå订å |
| | | Dt_ProOutOrder proOutOrder = _proOutOrderRepository.QueryFirst(x=>x.Id==proOutOrderDetails.FirstOrDefault().ProOrderId); |
| | | if (proOutOrder==null) |
| | | { |
| | | throw new Exception("æªæ¾å°æå订å"); |
| | | } |
| | | List<Dt_ProOutOrderDetail> groupDetails = proOutOrderDetails.GroupBy(x => new { x.SaleOrder, x.PCode, x.PVer, x.PLot, x.DateCode }).Select(x => new Dt_ProOutOrderDetail() |
| | | { |
| | | QtyPcs = x.Sum(x => x.QtyPcs) - x.Sum(x => x.OverQtyPcs), |
| | | SaleOrder = x.Key.SaleOrder, |
| | |
| | | { |
| | | float needQty = item.QtyPcs; |
| | | //æ¥æ¾å¯ç¨åºå |
| | | List<Dt_ProStockInfo> stockInfoss = _stockInfoService.ProStockInfoService.GetUseableStocks(warehouseId, item); |
| | | List<Dt_ProStockInfo> stockInfoss = _stockInfoService.ProStockInfoService.GetUseableStocks(proOutOrder.WarehouseId, item); |
| | | if (!stockInfoss.Any()) |
| | | { |
| | | throw new Exception("æªæ¾å°å¯åé
åºå"); |
| | |
| | | float assignQuantity = needQty - residueQuantity; |
| | | bool isCanLot = !string.IsNullOrEmpty(item.PLot); |
| | | bool isCanDate = !string.IsNullOrEmpty(item.DateCode); |
| | | List<Dt_ProOutOrderDetail> details = OutOrderDetails |
| | | List<Dt_ProOutOrderDetail> details = proOutOrderDetails |
| | | .Where(x => x.SaleOrder == item.SaleOrder && x.PCode == item.PCode && x.PVer == item.PVer |
| | | && (isCanLot ? x.PLot == item.PLot : true) |
| | | && (isCanDate ? x.DateCode == item.DateCode : true)) |
| | |
| | | locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(locationArr)); |
| | | |
| | | } |
| | | return (outStocks, OutOrderDetails, outProStockInfos, locationInfos); |
| | | return (outStocks, proOutOrderDetails, outProStockInfos, locationInfos); |
| | | } |
| | | } |
| | | } |
| | |
| | | using AutoMapper; |
| | | using Castle.Core.Resource; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.WareHouseEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.CodeConfigEnum; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.ERP; |
| | | using WIDESEA_External.ERPService; |
| | | using WIDESEA_External.Model; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_IOutboundService; |
| | | using WIDESEA_IRecordService; |
| | | using WIDESEA_IStockRepository; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_Model.Models; |
| | | |
| | |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly IBasicRepository _basicRepository; |
| | | private readonly IMapper _mapper; |
| | | private readonly IStockRepository _stockRepository; |
| | | private readonly IOutboundRepository _outboundRepository; |
| | | private readonly IOutboundOrderService _outboundOrderService; |
| | | private readonly IInvokeERPService _invokeERPService; |
| | | |
| | | public IProOutOrderRepository Repository => BaseDal; |
| | | |
| | | public ProOutOrderService(IProOutOrderRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IBasicRepository basicRepository, IMapper mapper) : base(BaseDal) |
| | | public ProOutOrderService(IProOutOrderRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IBasicRepository basicRepository, IMapper mapper, IStockRepository stockRepository, IOutboundRepository outboundRepository, IOutboundOrderService outboundOrderService,IInvokeERPService invokeERPService) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _basicRepository = basicRepository; |
| | | _mapper = mapper; |
| | | _stockRepository = stockRepository; |
| | | _outboundRepository = outboundRepository; |
| | | _outboundOrderService = outboundOrderService; |
| | | _invokeERPService = invokeERPService; |
| | | } |
| | | /// <summary> |
| | | /// æ¥æ¶ERPæååºåºå |
| | |
| | | return content.Error($"åºåºåå·{outOrderDTO.OrderNo}å·²åå¨!"); |
| | | } |
| | | Dt_Warehouse warehouse=null; |
| | | List<Dt_CustomerInfo> customerInfos = _basicRepository.CustomerInfoRepository.QueryData(); |
| | | if (outOrderDTO.OType==1 && string.IsNullOrEmpty(outOrderDTO.WaType)) |
| | | { |
| | | warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseCode==WarehouseEnum.HA71.ToString()); |
| | |
| | | List<Dt_ProOutOrderDetail> proOutOrderDetails = new List<Dt_ProOutOrderDetail>(); |
| | | foreach (var item in outOrderDTO.OrderDetails) |
| | | { |
| | | //å¤æå®¢æ·æ¯å¦åå¨ |
| | | Dt_CustomerInfo? customerInfo = customerInfos.Where(x=>x.Code== item.Customer).FirstOrDefault(); |
| | | if (customerInfo==null) |
| | | { |
| | | return content.Error($"客æ·{item.Customer}ä¸åå¨!"); |
| | | } |
| | | proOutOrderDetails.Add(_mapper.Map<Dt_ProOutOrderDetail>(item)); |
| | | } |
| | | Dt_ProOutOrder proOutOrder= new Dt_ProOutOrder() |
| | |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// æååºå¾
åè´§åº(å¹³åº)+忥ERPåºåº |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent OutProductPK(string[] OutPKCodes,string ProOutNo) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (OutPKCodes.IsNullOrEmpty()) |
| | | { |
| | | return content.Error("ä¸è½ä¸ºç©º"); |
| | | } |
| | | Dt_ProOutOrder proOutOrder = _outboundRepository.ProOutOrderRepository.Db.Queryable<Dt_ProOutOrder>().Where(x => x.ProOutOrderNo == ProOutNo).Includes(x => x.Details).First(); |
| | | if (proOutOrder == null) |
| | | { |
| | | return content.Error($"åºåºå{ProOutNo}ä¸åå¨"); |
| | | } |
| | | if (proOutOrder.ProOrderStatus==OutOrderStatusEnum.åºåºå®æ.ObjToInt()) |
| | | { |
| | | return content.Error($"åºåºå{ProOutNo}已宿"); |
| | | } |
| | | string? userName = App.User.UserName;//GSWMS |
| | | //è·åææå¤ç®±çæ°æ® |
| | | List<Dt_ProStockInfo> AllproStockInfos = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>() |
| | | .Where(x => OutPKCodes.Contains(x.PalletCode) && x.StockStatus == StockStatusEmun.å¹³åºå
¥åºå®æ.ObjToInt()) |
| | | .Includes(x => x.proStockInfoDetails).ToList(); |
| | | List<Dt_ProStockInfo> proStockInfos = new List<Dt_ProStockInfo>(); |
| | | List<Dt_ProStockInfoDetail> proStockInfoDetails=new List<Dt_ProStockInfoDetail>(); |
| | | List<Dt_Warehouse> warehouses = _basicRepository.WarehouseRepository.QueryData(x => x.WarehouseType == WarehouseTypEnum.æå.ToString()); |
| | | foreach (var item in OutPKCodes) |
| | | { |
| | | //è·ååºå |
| | | Dt_ProStockInfo? proStockInfo = AllproStockInfos.Where(x => x.PalletCode == item).FirstOrDefault(); |
| | | if (proStockInfo == null) |
| | | { |
| | | return content.Error($"æªæ¾å°{item}åºå"); |
| | | } |
| | | Dt_Warehouse? dt_Warehouse = warehouses.Where(x=>x.WarehouseId== proStockInfo.WarehouseId).FirstOrDefault(); |
| | | if (dt_Warehouse==null) |
| | | { |
| | | return content.Error($"å¤ç®±å·{item},ä¸å±äºæåä»"); |
| | | } |
| | | if (proStockInfo.ShipmentOrder!= proOutOrder.ProOutOrderNo) |
| | | { |
| | | return content.Error($"å¤ç®±å·{item},ä¸å±äºåºåºè®¢å{proOutOrder.ProOutOrderNo}"); |
| | | } |
| | | proStockInfos.Add(proStockInfo); |
| | | proStockInfoDetails.AddRange(proStockInfo.proStockInfoDetails); |
| | | } |
| | | |
| | | if (proOutOrder.Details.Sum(x=>x.LockQtyPcs-x.OverQtyPcs)< proStockInfoDetails.Sum(x=>x.StockPcsQty)) |
| | | { |
| | | return content.Error($"åºåºæ°é{proStockInfoDetails.Sum(x => x.StockPcsQty)}>æå©è®¢åæ°é{proOutOrder.Details.Sum(x => x.LockQtyPcs - x.OverQtyPcs)}"); |
| | | } |
| | | List<StockOutItemsItem> stockOutItems = new List<StockOutItemsItem>(); |
| | | List<Dt_ProOutOrderDetail> proOutOrderDetails = proOutOrder.Details.Where(x=> proStockInfoDetails.Select(x=>x.SaleOrder).Contains(x.SaleOrder) && proStockInfoDetails.Select(x=>x.ProductCode).Contains(x.PCode) && proStockInfoDetails.Select(x => x.ProductVersion).Contains(x.PVer)).ToList(); |
| | | if (proOutOrderDetails==null || proOutOrderDetails.Count<=0) |
| | | { |
| | | return content.Error("对åºåºåºè®¢åæç»ä¸ºç©º"); |
| | | } |
| | | foreach (var item in proStockInfoDetails) |
| | | { |
| | | //è·åå¯¹åºæç»å¤çåºåºæ°æ® |
| | | Dt_ProOutOrderDetail? proOutOrderDetail = proOutOrderDetails.Where(x => x.SaleOrder == item.SaleOrder && x.PVer == item.ProductVersion && x.PCode == item.ProductCode).FirstOrDefault(); |
| | | if (proOutOrderDetail==null) |
| | | { |
| | | return content.Error("æªæ¾å°å¯¹åºåºåºè®¢åæç»"); |
| | | } |
| | | proOutOrderDetail.OverQtyPcs += item.StockPcsQty; |
| | | if (proOutOrderDetail.OverQtyPcs> proOutOrderDetail.QtyPcs) |
| | | { |
| | | return content.Error($"åºåºè®¢åæç»è¡{proOutOrderDetail.RowId},溢åº{proOutOrderDetail.QtyPcs - proOutOrderDetail.OverQtyPcs}"); |
| | | } |
| | | if (proOutOrderDetail.OverQtyPcs == proOutOrderDetail.QtyPcs) |
| | | { |
| | | proOutOrderDetail.ProOrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); |
| | | } |
| | | StockOutItemsItem outItemsItem = new StockOutItemsItem() |
| | | { |
| | | PartNum=item.ProductCode, |
| | | Rev=item.ProductVersion, |
| | | SoNumber=item.SaleOrder, |
| | | BatchNumber=item.BagNo, |
| | | QtyPcs=item.StockPcsQty, |
| | | QtySet=item.SETQty |
| | | }; |
| | | stockOutItems.Add(outItemsItem); |
| | | } |
| | | int OldOverCount = proOutOrder.Details.Where(x => x.ProOrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).Count(); |
| | | int AddOverCount = proOutOrderDetails.Where(x => x.ProOrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).Count(); |
| | | if (proOutOrder.Details.Count== (OldOverCount + AddOverCount)) |
| | | { |
| | | proOutOrder.ProOrderStatus = OutOrderStatusEnum.åºåºå®æ.ObjToInt(); |
| | | } |
| | | Dt_Warehouse warehouse = warehouses.Where(x => x.WarehouseId == proOutOrder.WarehouseId).FirstOrDefault(); |
| | | //å¤çåºåæ°æ®åä¸ä¼ ERP |
| | | _unitOfWorkManage.BeginTran(); |
| | | _stockRepository.ProStockInfoRepository.DeleteAndMoveIntoHty(proStockInfos, OperateTypeEnum.èªå¨å®æ); |
| | | _stockRepository.ProStockInfoDetailRepository.DeleteAndMoveIntoHty(proStockInfoDetails, OperateTypeEnum.èªå¨å®æ); |
| | | _outboundRepository.ProOutOrderDetailRepository.UpdateData(proOutOrderDetails); |
| | | BaseDal.UpdateData(proOutOrder); |
| | | //æååºåè®°å½åå¨å¾
å å
¥ |
| | | ERPProOutOrderModel proOutOrderModel = new ERPProOutOrderModel() |
| | | { |
| | | Way = 1, |
| | | StockOutCode = _outboundOrderService.CreateCodeByRule(nameof(RuleCodeEnum.ProOutCOdeRule)), |
| | | ConfirmedUserNo=userName, |
| | | AssignUserNo=userName, |
| | | WarehouseCode=warehouse.WarehouseCode, |
| | | ShipDate=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | DeliverplanCode=proOutOrder.ProOutOrderNo, |
| | | Remark=proOutOrder.Remark, |
| | | StockOutItems= stockOutItems |
| | | }; |
| | | string response = _invokeERPService.InvokeProOutApi(proOutOrderModel); |
| | | ErpRequestContent erpRequestContent= response.DeserializeObject<ErpRequestContent>(); |
| | | if (erpRequestContent.res==1) |
| | | { |
| | | _unitOfWorkManage.CommitTran(); |
| | | content.OK(); |
| | | } |
| | | else |
| | | { |
| | | throw new Exception(erpRequestContent.Data); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |
| | |
| | | proStockInfos = Db.Queryable<Dt_ProStockInfo>().Where(x => locationInfos.Contains(x.LocationCode)) |
| | | .Includes(x => x.proStockInfoDetails) |
| | | .Where(x => x.proStockInfoDetails |
| | | .Any(x => x.SaleOrder == proOutOrderDetail.SaleOrder |
| | | && x.ProductCode == proOutOrderDetail.PCode |
| | | && x.ProductVersion == proOutOrderDetail.PVer |
| | | && (isCanLot ? x.LotNumber == proOutOrderDetail.PLot : true) |
| | | && (isCanDate ? x.DateCode == proOutOrderDetail.DateCode : true) |
| | | .Any(v => v.SaleOrder==proOutOrderDetail.SaleOrder |
| | | && v.ProductCode==proOutOrderDetail.PCode |
| | | && v.ProductVersion==proOutOrderDetail.PVer |
| | | && (isCanLot? v.LotNumber== proOutOrderDetail.PLot:true) |
| | | && (isCanDate ? v.DateCode == proOutOrderDetail.DateCode : true) |
| | | )) |
| | | .ToList(); |
| | | proStockInfos = proStockInfos.OrderBy(x => x.proStockInfoDetails.FirstOrDefault().DateCode).ToList(); |
| | | |
| | | proStockInfos = proStockInfos.OrderBy(x => x.proStockInfoDetails.FirstOrDefault()?.DateCode).ThenBy(x=>x.proStockInfoDetails.Sum(x=>x.StockPcsQty)).ToList(); |
| | | return proStockInfos; |
| | | } |
| | | /// <summary> |
| | | /// è·åMESæåºåºå |
| | | /// </summary> |
| | | /// <param name="mesRworkOutboundOrder"></param> |
| | | /// <param name="locationInfos"></param> |
| | | /// <returns></returns> |
| | | public List<Dt_ProStockInfo> GetProStocks(Dt_MesRworkOutboundOrder mesRworkOutboundOrder, List<string> locationInfos) |
| | | { |
| | | List<Dt_ProStockInfo>? proStockInfos = null; |
| | | bool isCanDate = !string.IsNullOrEmpty(mesRworkOutboundOrder.DateCode); |
| | | proStockInfos = Db.Queryable<Dt_ProStockInfo>().Where(x => locationInfos.Contains(x.LocationCode)) |
| | | .Includes(x => x.proStockInfoDetails) |
| | | .Where(x => x.proStockInfoDetails |
| | | .Any(v => v.SaleOrder == mesRworkOutboundOrder.SaleOrder |
| | | && v.ProductCode == mesRworkOutboundOrder.ProductCode |
| | | && v.ProductVersion == mesRworkOutboundOrder.ProductVersion |
| | | && (isCanDate ? v.DateCode == mesRworkOutboundOrder.DateCode : true) |
| | | )) |
| | | .ToList(); |
| | | proStockInfos = proStockInfos.OrderBy(x => x.proStockInfoDetails.FirstOrDefault()?.DateCode).ThenBy(x => x.proStockInfoDetails.Sum(x => x.StockPcsQty)).ToList(); |
| | | return proStockInfos; |
| | | } |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IStockRepository; |
| | | using WIDESEA_IStockService; |
| | |
| | | //æ ¹æ®å
å
å·è¿è¡åºåæ£é¤ |
| | | try |
| | | { |
| | | //è·ååºå |
| | | List<string> BagNos = proStockInfoDetails.Select(x => x.BagNo).Distinct().ToList(); |
| | | List<Dt_ProStockInfo> proStockInfos = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>() |
| | | .Where(x => x.StockStatus == StockStatusEmun.åºåºå®æ.ObjToInt()) |
| | | .Includes(x => x.proStockInfoDetails) |
| | | .Where(x => x.proStockInfoDetails.Any(v => BagNos.Contains(v.BagNo))).Distinct().ToList(); |
| | | List<Dt_ProStockInfoDetail> delProStockDetails=new List<Dt_ProStockInfoDetail>(); |
| | | //foreach (var item in collection) |
| | | //{ |
| | | // Dt_ProStockInfoDetail delProStockDetal= |
| | | //} |
| | | List<Dt_ProStockInfoDetail> upProStockDetails = new List<Dt_ProStockInfoDetail>(); |
| | | List<Dt_ProStockInfo> delProStockInfos = new List<Dt_ProStockInfo>(); |
| | | foreach (var item in proStockInfoDetails) |
| | | { |
| | | Dt_ProStockInfo? proStockInfo = proStockInfos.Where(x => x.proStockInfoDetails.Any(v => v.BagNo == item?.BagNo)).FirstOrDefault(); |
| | | Dt_ProStockInfoDetail? proStockInfoDetail = proStockInfo?.proStockInfoDetails.Where(x => x.BagNo == item?.BagNo).FirstOrDefault(); |
| | | if (proStockInfo==null || proStockInfoDetail == null) |
| | | { |
| | | return content.Error($"æªæ¾å°{item?.BagNo}åºå"); |
| | | } |
| | | //夿æç»æ¯å¦å
¨é¨æ«åº |
| | | if (proStockInfoDetail.StockPcsQty==item.StockPcsQty) |
| | | { |
| | | delProStockDetails.Add(proStockInfoDetail); |
| | | proStockInfo.proStockInfoDetails.Remove(proStockInfoDetail); |
| | | } |
| | | else |
| | | { |
| | | proStockInfoDetail.StockPcsQty -= item.StockPcsQty; |
| | | proStockInfoDetail.SETQty -= item.SETQty; |
| | | upProStockDetails.Add(proStockInfoDetail); |
| | | } |
| | | |
| | | if (proStockInfo.proStockInfoDetails.Count==0) |
| | | { |
| | | delProStockInfos.Add(proStockInfo); |
| | | } |
| | | } |
| | | if (delProStockInfos.Count>0) |
| | | { |
| | | BaseDal.DeleteAndMoveIntoHty(delProStockInfos, OperateTypeEnum.èªå¨å é¤); |
| | | } |
| | | if (delProStockDetails.Count > 0) |
| | | { |
| | | _stockRepository.ProStockInfoDetailRepository.DeleteAndMoveIntoHty(delProStockDetails, OperateTypeEnum.èªå¨å é¤); |
| | | } |
| | | if (upProStockDetails.Count > 0) |
| | | { |
| | | _stockRepository.ProStockInfoDetailRepository.UpdateData(upProStockDetails); |
| | | } |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | List<string> locationCodes = _basicRepository.LocationInfoRepository.GetCanOutLocationCodes(warehoseId); |
| | | return BaseDal.GetProStocks(proOutOrderDetail,locationCodes); |
| | | } |
| | | /// <summary> |
| | | /// MESæåºå¯ç¨åºå |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<Dt_ProStockInfo> GetUseableStocks(Dt_MesRworkOutboundOrder mesRworkOutboundOrder) |
| | | { |
| | | List<string> locationCodes = _basicRepository.LocationInfoRepository.GetCanOutLocationCodes(mesRworkOutboundOrder.WarehouseId); |
| | | return BaseDal.GetProStocks(mesRworkOutboundOrder, locationCodes); |
| | | } |
| | | /// <summary> |
| | | /// è·ååºåºåºå |
| | |
| | | residueQuantity = needQuantity; |
| | | return assignOutStocks; |
| | | } |
| | | /// <summary> |
| | | /// è·åMESæåºåºå |
| | | /// </summary> |
| | | public List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_MesRworkOutboundOrder mesRworkOutboundOrder, float needQuantity, out float residueQuantity) |
| | | { |
| | | List<Dt_ProStockInfo> assignOutStocks = new List<Dt_ProStockInfo>(); |
| | | float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x); |
| | | //stockInfos = stockInfos.OrderBy(x => x.Id).ToList(); |
| | | if (stockTotalQuantity >= needQuantity)//åºåå¤ |
| | | { |
| | | int index = 0; |
| | | while (needQuantity > 0) |
| | | { |
| | | Dt_ProStockInfo stockInfo = stockInfos[index]; |
| | | float useableStockQuantity = stockInfo.proStockInfoDetails |
| | | .Where(x => x.SaleOrder == mesRworkOutboundOrder.SaleOrder && x.ProductCode == mesRworkOutboundOrder.ProductCode && x.ProductVersion == mesRworkOutboundOrder.ProductVersion) |
| | | .Sum(x => x.StockPcsQty - x.OutboundQuantity); |
| | | if (useableStockQuantity < needQuantity) |
| | | { |
| | | stockInfo.proStockInfoDetails.ForEach(x => x.OutboundQuantity = x.StockPcsQty); |
| | | needQuantity -= useableStockQuantity; |
| | | } |
| | | else |
| | | { |
| | | stockInfo.proStockInfoDetails.ForEach(x => |
| | | { |
| | | if ((x.StockPcsQty > x.OutboundQuantity) && x.SaleOrder == mesRworkOutboundOrder.SaleOrder && x.ProductCode == mesRworkOutboundOrder.ProductCode && x.ProductVersion == mesRworkOutboundOrder.ProductVersion) |
| | | { |
| | | if (x.StockPcsQty - x.OutboundQuantity >= needQuantity) |
| | | { |
| | | x.OutboundQuantity += needQuantity; |
| | | needQuantity = 0; |
| | | } |
| | | else |
| | | { |
| | | needQuantity -= (x.StockPcsQty - x.OutboundQuantity); |
| | | x.OutboundQuantity = x.StockPcsQty; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | assignOutStocks.Add(stockInfo); |
| | | index++; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < stockInfos.Count; i++) |
| | | { |
| | | Dt_ProStockInfo stockInfo = stockInfos[i]; |
| | | float useableStockQuantity = stockInfo.proStockInfoDetails |
| | | .Where(x => x.SaleOrder == mesRworkOutboundOrder.SaleOrder && x.ProductCode == mesRworkOutboundOrder.ProductCode && x.ProductVersion == mesRworkOutboundOrder.ProductVersion) |
| | | .Sum(x => x.StockPcsQty - x.OutboundQuantity); |
| | | if (useableStockQuantity < needQuantity) |
| | | { |
| | | stockInfo.proStockInfoDetails.ForEach(x => x.OutboundQuantity = x.StockPcsQty); |
| | | needQuantity -= useableStockQuantity; |
| | | } |
| | | else |
| | | { |
| | | stockInfo.proStockInfoDetails.ForEach(x => |
| | | { |
| | | if (x.StockPcsQty > x.OutboundQuantity && x.SaleOrder == mesRworkOutboundOrder.SaleOrder && x.ProductCode == mesRworkOutboundOrder.ProductCode && x.ProductVersion == mesRworkOutboundOrder.ProductVersion) |
| | | { |
| | | if (x.StockPcsQty - x.OutboundQuantity >= needQuantity) |
| | | { |
| | | x.OutboundQuantity += needQuantity; |
| | | needQuantity = 0; |
| | | } |
| | | else |
| | | { |
| | | needQuantity -= (x.StockPcsQty - x.OutboundQuantity); |
| | | x.OutboundQuantity = x.StockPcsQty; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | assignOutStocks.Add(stockInfo); |
| | | } |
| | | } |
| | | residueQuantity = needQuantity; |
| | | return assignOutStocks; |
| | | } |
| | | ////å¤çåºåºåºå |
| | | //public (List<Dt_ProStockInfoDetail>?, List<Dt_ProStockInfoDetail>?) HandleOutProStock(Dt_ProStockInfo proStockInfo) |
| | | //{ |
| | | // List<Dt_ProStockInfoDetail>? deleteStockDetails = null; |
| | | // List<Dt_ProStockInfoDetail>? updateStockDetails = null; |
| | | // foreach (var item in proStockInfo.proStockInfoDetails) |
| | | // { |
| | | // if (item.StockPcsQty==item.OutboundQuantity) |
| | | // { |
| | | // item.ProOutDetailStatus = StockStatusEmun.åºåºå®æ.ObjToInt(); |
| | | // deleteStockDetails.Add(item); |
| | | // } |
| | | // else if(item.StockPcsQty> item.OutboundQuantity && item.OutboundQuantity>0) |
| | | // { |
| | | // item.StockPcsQty-=item.OutboundQuantity; |
| | | // updateStockDetails.Add(item); |
| | | // } |
| | | // } |
| | | // return (deleteStockDetails, updateStockDetails); |
| | | //} |
| | | } |
| | | } |
| | |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// WMS忥æååºåºè³MES |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent ShipmentOrderSync(MesShipmentOrderSync model) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMS_MES_ShipmentOrderSync.ToString()); |
| | | MESRoot<MesShipmentOrderSync> root = new MESRoot<MesShipmentOrderSync>() |
| | | { |
| | | From = "WMS", |
| | | DateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Content = model |
| | | }; |
| | | JsonSerializerSettings settings = new JsonSerializerSettings |
| | | { |
| | | ContractResolver = new CamelCasePropertyNamesContractResolver() |
| | | }; |
| | | string request = JsonConvert.SerializeObject(root, settings); |
| | | string response = HttpMesHelper.Post(apiInfo.ApiAddress, request); |
| | | MesResponseContent mesResponseContent = response.DeserializeObject<MesResponseContent>(); |
| | | //è°ç¨æ¥å£ |
| | | if (mesResponseContent.BSucc == true) |
| | | { |
| | | content.OK(mesResponseContent.StrMsg); |
| | | } |
| | | else |
| | | { |
| | | content.Error(mesResponseContent.StrMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="stockInfo"></param> |
| | |
| | | |
| | | Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() |
| | | { |
| | | MaterielSpec = stockInfoDetail_Hty.MaterielSpec, |
| | | BatchNo = stockInfoDetail_Hty?.BatchNo ?? "", |
| | | EffectiveDate = model.ExpirationDate, |
| | | MaterielCode = model.MaterialCode, |
| | |
| | | try |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA101.ToString()); |
| | | //夿MESä¼ å
¥çåºåºåå·æ¯å¦åå¨ |
| | | Dt_ProOutOrder proOutOrder = _outboundRepository.ProOutOrderRepository.Db.Queryable<Dt_ProOutOrder>().Where(x=>x.ProOutOrderNo== boxInfoModel.ShipmentOrder).Includes(x=>x.Details).First(); |
| | | if (proOutOrder==null) |
| | | { |
| | | return content.Error($"åå·{boxInfoModel.ShipmentOrder}ä¸åå¨"); |
| | | } |
| | | //è·åæææååºåºå
å
ä¿¡æ¯ |
| | | List<Dt_ProStockInfoDetail> dt_ProStockInfos = _stockRepository.ProStockInfoDetailRepository.QueryData(x=>x.ProOutDetailStatus==StockStatusEmun.åºåºå®æ.ObjToInt()); |
| | | //è·åMESå
å
ä¿¡æ¯ |
| | | List<Dt_MesProInOrderDetail> mesProInOrderDetails = new List<Dt_MesProInOrderDetail>(); |
| | | foreach (var item in boxInfoModel.Bags) |
| | | { |
| | | foreach (var child in item.BagItems) |
| | | { |
| | | Dt_ProStockInfoDetail? proStockInfoDetail = dt_ProStockInfos.Where(x=>x.BagNo==item.BagNo)?.FirstOrDefault(); |
| | | if (proStockInfoDetail==null) |
| | | { |
| | | return content.Error($"å
å
{item.BagNo}è´§ç©ç¶æå¼å¸¸"); |
| | | } |
| | | Dt_MesProInOrderDetail mesProInOrderDetail = new Dt_MesProInOrderDetail() |
| | | { |
| | | BagNo = item.BagNo, |
| | |
| | | { |
| | | proStockInfoDetails.Add(_mapper.Map<Dt_ProStockInfoDetail>(item)); |
| | | } |
| | | proStockInfoDetails.ForEach(x => |
| | | { |
| | | x.ProOutDetailStatus = StockStatusEmun.å¹³åºå
¥åºå®æ.ObjToInt(); |
| | | }); |
| | | |
| | | Dt_ProStockInfo proStockInfo = new Dt_ProStockInfo() |
| | | { |
| | | PalletCode = boxInfoModel.BoxNo, |
| | | PalletType = 0, |
| | | WarehouseId = warehouse.WarehouseId, |
| | | ShipmentOrder = boxInfoModel.ShipmentOrder, |
| | | StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(), |
| | | StockStatus = StockStatusEmun.å¹³åºå
¥åºå®æ.ObjToInt(), |
| | | proStockInfoDetails = proStockInfoDetails |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | //æ ¹æ®å¤å
ä¿¡æ¯è§£ç»å
å
ä¸è¶æ¡åºåå
³ç³» |
| | | WebResponseContent UnBindContent = _stockService.ProStockInfoService.UnBindStock(proStockInfoDetails); |
| | | if (!UnBindContent.Status) |
| | | { |
| | | throw new Exception(UnBindContent.Message); |
| | | } |
| | | Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand(); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content.OK("å¤å
æ¥æ¶æå"); |
| | |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// æåè¿å·¥æåº |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public MesResponseContent RworkTask(RworkTaskModel model) |
| | | { |
| | | MesResponseContent content = new MesResponseContent(); |
| | | try |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA72.ToString()); |
| | | if (warehouse==null) |
| | | { |
| | | return MesResponseContent.Instance.Error("æªæ¾å°æ¤ä»åº"); |
| | | } |
| | | Dt_MesRworkOutboundOrder mesRworkOutboundOrder = new Dt_MesRworkOutboundOrder() |
| | | { |
| | | WarehouseId=warehouse.WarehouseId, |
| | | TaskNo=model.TaskNo, |
| | | OrderStatus = InOrderStatusEnum.æªå¼å§.ObjToInt(), |
| | | CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(), |
| | | ProductCode=model.ProductCode, |
| | | ProductName=model.ProductName, |
| | | ProductVersion=model.ProductVersion, |
| | | DateCode=model.DateCode, |
| | | RequiredQuantity=model.RequiredQuantity, |
| | | FactoryCode= model.FactoryCode, |
| | | SaleOrder=model.SaleOrder, |
| | | InventoryType=model.InventoryType, |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | _outboundService.RworkOutboundOrderService.AddData(mesRworkOutboundOrder); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content.OK("æä¾è¿åºåæ¥æ¶æå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// MESæååºåºååæ¥æ°æ®å¤ç |
| | | /// </summary> |
| | | public MesShipmentOrderSync MesOutSync(Dt_OutProStockInfo outProStockInfo, Dt_ProOutOrderDetail proOutOrderDetail) |
| | | { |
| | | List<MesShipOrderDetail> mesShipOrderDetails = new List<MesShipOrderDetail>(); |
| | | //è·ååºåºå |
| | | Dt_ProOutOrder proOutOrder = _outboundService.ProOutOrderService.Repository.QueryFirst(x=>x.Id== proOutOrderDetail.ProOrderId); |
| | | //è·åå®¢æ· |
| | | Dt_CustomerInfo customerInfo = _basicRepository.CustomerInfoRepository.QueryFirst(x=>x.Code==proOutOrderDetail.Customer); |
| | | |
| | | MesShipOrderDetail orderDetail = new MesShipOrderDetail() |
| | | { |
| | | ProductCode = proOutOrderDetail.PCode, |
| | | ProductVersion = proOutOrderDetail.PVer, |
| | | Qty = outProStockInfo.AssignQuantity, |
| | | SaleOrder = proOutOrderDetail.SaleOrder, |
| | | Sequence = outProStockInfo.Id, |
| | | WorkCenter = "SPCK_OUTER-001" |
| | | }; |
| | | mesShipOrderDetails.Add(orderDetail); |
| | | MesShipmentOrderSync shipmentOrderSync = new MesShipmentOrderSync() |
| | | { |
| | | ShipmentOrder = proOutOrder.ProOutOrderNo, |
| | | PlantShipDate = proOutOrder.PlantShipDate.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Customer = proOutOrderDetail.Customer, |
| | | FactoryCode = proOutOrderDetail.FactoryCode, |
| | | ShipName = customerInfo.Name, |
| | | ShippingAddress = customerInfo.NickName, |
| | | OrderDetails = mesShipOrderDetails |
| | | }; |
| | | return shipmentOrderSync; |
| | | } |
| | | /// <summary> |
| | | /// WMS忥æååºåºè³MES |
| | | /// </summary> |
| | | public WebResponseContent ShipmentOrderSync(MesShipmentOrderSync model) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMS_MES_ShipmentOrderSync.ToString()); |
| | | MESRoot<MesShipmentOrderSync> root = new MESRoot<MesShipmentOrderSync>() |
| | | { |
| | | From = "WMS", |
| | | DateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Content = model |
| | | }; |
| | | JsonSerializerSettings settings = new JsonSerializerSettings |
| | | { |
| | | ContractResolver = new CamelCasePropertyNamesContractResolver() |
| | | }; |
| | | string request = JsonConvert.SerializeObject(root, settings); |
| | | string response = HttpMesHelper.Post(apiInfo.ApiAddress, request); |
| | | MesResponseContent mesResponseContent = response.DeserializeObject<MesResponseContent>(); |
| | | //è°ç¨æ¥å£ |
| | | if (mesResponseContent.BSucc == true) |
| | | { |
| | | content.OK(mesResponseContent.StrMsg); |
| | | } |
| | | else |
| | | { |
| | | content.Error(mesResponseContent.StrMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// MESæåè¿å·¥æåº |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public MesResponseContent RworkTask(RworkTaskModel model) |
| | | { |
| | | MesResponseContent content = new MesResponseContent(); |
| | | try |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA72.ToString()); |
| | | if (warehouse == null) |
| | | { |
| | | return content.Error($"å°¾æ°ä»ä¿¡æ¯æªé
ç½®"); |
| | | } |
| | | Dt_MesRworkOutboundOrder rworkOutboundOrderOld = _outboundRepository.RworkOutboundOrderRepository.QueryFirst(x=>x.TaskNo== model.TaskNo); |
| | | if (rworkOutboundOrderOld==null) |
| | | { |
| | | return content.Error($"æåºä»»å¡å{model.TaskNo}å·²åå¨"); |
| | | } |
| | | Dt_MesRworkOutboundOrder mesRworkOutboundOrder = new Dt_MesRworkOutboundOrder() |
| | | { |
| | | WarehouseId = warehouse.WarehouseId, |
| | | TaskNo = model.TaskNo, |
| | | OrderStatus = OutOrderStatusEnum.æªå¼å§.ObjToInt(), |
| | | CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(), |
| | | ProductCode = model.ProductCode, |
| | | ProductName = model.ProductName, |
| | | ProductVersion = model.ProductVersion, |
| | | DateCode = model.DateCode, |
| | | RequiredQuantity = model.RequiredQuantity, |
| | | FactoryCode = model.FactoryCode, |
| | | SaleOrder = model.SaleOrder, |
| | | OrderType = model.InventoryType, |
| | | }; |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_ProStockInfo>? proStockInfos = null; |
| | | List<Dt_OutProStockInfo>? outProStockInfos = null; |
| | | List<Dt_LocationInfo>? locationInfos = null; |
| | | //åé
åºåçææåºä»»å¡ |
| | | (List<Dt_ProStockInfo>?, Dt_MesRworkOutboundOrder?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>) result = _outboundService.RworkOutboundOrderService.AssignMesStocks(mesRworkOutboundOrder); |
| | | if (result.Item1!=null && result.Item1.Count>0) |
| | | { |
| | | tasks = GetTasks(result.Item1, TaskTypeEnum.MesOutbound); |
| | | result.Item2.OrderStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | result.Item3.ForEach(x => |
| | | { |
| | | x.Status = OutLockStockStatusEnum.åºåºä¸.ObjToInt(); |
| | | }); |
| | | |
| | | proStockInfos = result.Item1; |
| | | mesRworkOutboundOrder = result.Item2; |
| | | outProStockInfos = result.Item3; |
| | | locationInfos = result.Item4; |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("æ åºååé
"); |
| | | } |
| | | tasks.ForEach(x => |
| | | { |
| | | x.TargetAddress = "5236"; |
| | | x.OrderNo = mesRworkOutboundOrder.TaskNo; |
| | | }); |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | int id = BaseDal.AddData(tasks); |
| | | outProStockInfos.ForEach(x => |
| | | { |
| | | x.OrderNo = mesRworkOutboundOrder.TaskNo; |
| | | x.OrderDetailId = id; |
| | | }); |
| | | if (proStockInfos != null && proStockInfos.Count > 0 && outProStockInfos != null && outProStockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0) |
| | | { |
| | | WebResponseContent updateContent = _outboundService.RworkOutboundOrderService.LockOutboundStockDataUpdate(proStockInfos, outProStockInfos, locationInfos, tasks: tasks); |
| | | |
| | | if (!updateContent.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content.Error(updateContent.Message); |
| | | } |
| | | } |
| | | _outboundService.RworkOutboundOrderService.Repository.AddData(mesRworkOutboundOrder); |
| | | return content.OK("æä¾è¿åºåæ¥æ¶æå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// åºåæ¿åæ¥æ¥å£ |
| | | /// </summary> |
| | | public WebResponseContent ProductOutBoundSync(MesProductOutBound model) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMS_MES_ProductOutBound.ToString()); |
| | | MESRoot<MesProductOutBound> root = new MESRoot<MesProductOutBound>() |
| | | { |
| | | From = "WMS", |
| | | DateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Content = model |
| | | }; |
| | | JsonSerializerSettings settings = new JsonSerializerSettings |
| | | { |
| | | ContractResolver = new CamelCasePropertyNamesContractResolver() |
| | | }; |
| | | string request = JsonConvert.SerializeObject(root, settings); |
| | | string response = HttpMesHelper.Post(apiInfo.ApiAddress, request); |
| | | MesResponseContent mesResponseContent = response.DeserializeObject<MesResponseContent>(); |
| | | //è°ç¨æ¥å£ |
| | | if (mesResponseContent.BSucc == true) |
| | | { |
| | | content.OK(mesResponseContent.StrMsg); |
| | | } |
| | | else |
| | | { |
| | | content.Error(mesResponseContent.StrMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |
| | |
| | | using WIDESEA_ITaskInfoRepository; |
| | | using WIDESEA_ITaskInfoService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_OutboundRepository; |
| | | using WIDESEA_TaskInfoRepository; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | |
| | | private readonly IInboundRepository _inboundRepository; |
| | | private readonly IInboundOrderService _inboundOrderService; |
| | | private readonly IPalletTypeInfoRepository _palletTypeInfoRepository; |
| | | |
| | | private readonly IOutProStockInfoRepository _outProStockInfoRepository; |
| | | private readonly IOutboundRepository _outboundRepository; |
| | | public ITaskRepository Repository => BaseDal; |
| | | |
| | | private Dictionary<string, OrderByType> _taskOrderBy = new() |
| | |
| | | |
| | | public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList(); |
| | | |
| | | public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService, IOutboundService outboundService, IStockService stockService, IBasicRepository basicRepository, IApiInfoRepository apiInfoRepository, IInvokeERPService invokeERPService, IInboundRepository inboundRepository, IInboundOrderService inboundOrderService, IPalletTypeInfoRepository palletTypeInfoRepository) : base(BaseDal) |
| | | public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService, IOutboundService outboundService, IStockService stockService, IBasicRepository basicRepository, IApiInfoRepository apiInfoRepository, IInvokeERPService invokeERPService, IInboundRepository inboundRepository, IInboundOrderService inboundOrderService, IPalletTypeInfoRepository palletTypeInfoRepository, IOutProStockInfoRepository outProStockInfoRepository, IOutboundRepository outboundRepository) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | _inboundRepository = inboundRepository; |
| | | _inboundOrderService = inboundOrderService; |
| | | _palletTypeInfoRepository = palletTypeInfoRepository; |
| | | _outProStockInfoRepository = outProStockInfoRepository; |
| | | _outboundRepository = outboundRepository; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// æåä»ä»»å¡å®æ |
| | | /// æåä»å
¥åºä»»å¡å®æ |
| | | /// </summary> |
| | | public WebResponseContent InProductCompleted(Dt_Task task) |
| | | { |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ä»»å¡ä¿¡æ¯"); |
| | | } |
| | | |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == task.WarehouseId); |
| | | //æååºåºä»»å¡å®æ |
| | | if (warehouse.WarehouseCode==WarehouseEnum.HA71.ToString()) |
| | | { |
| | | return OutProCompleted(task); |
| | | } |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è´§ä½ä¿¡æ¯"); |
| | | } |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == task.WarehouseId); |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = _outboundService.OutboundStockLockInfoService.Repository.QueryData(x => x.TaskNum == taskNum); |
| | | List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>(); |
| | | List<Dt_MesOutboundOrder> mesOutboundOrders = new List<Dt_MesOutboundOrder>(); |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | //æååºåºä»»å¡å®æ |
| | | public WebResponseContent OutProCompleted(Dt_Task task) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //è·åè´§ä½ |
| | | Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | if (locationInfo==null) |
| | | { |
| | | return content.Error("æªæ¾å°è´§ä½ä¿¡æ¯"); |
| | | } |
| | | //æ ¹æ®ä»»å¡è·åæååºåºè¯¦æ
ä»»å¡åç©æä¿¡æ¯ |
| | | Dt_OutProStockInfo outProStockInfo = _outProStockInfoRepository.QueryFirst(x=>x.TaskNum==task.TaskNum); |
| | | if (outProStockInfo == null) |
| | | { |
| | | return content.Error("æªæ¾å°æååºåºè¯¦æ
"); |
| | | } |
| | | //è·åæååºåºè®¢å |
| | | Dt_ProOutOrder proOutOrder = _outboundService.ProOutOrderService.Repository.Db.Queryable<Dt_ProOutOrder>().Where(x => x.ProOutOrderNo == outProStockInfo.OrderNo).Includes(x => x.Details).First(); |
| | | if (proOutOrder==null) |
| | | { |
| | | return content.Error("æªæ¾å°æååºåºè®¢å"); |
| | | } |
| | | //è·åæååºå |
| | | Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>().Where(x=>x.PalletCode==task.PalletCode).Includes(x=>x.proStockInfoDetails).First(); |
| | | if (proStockInfo==null) |
| | | { |
| | | return content.Error("æªæ¾å°æååºåä¿¡æ¯"); |
| | | } |
| | | List<Dt_ProStockInfoDetail> proStockInfoDetails = proStockInfo.proStockInfoDetails; |
| | | if (proStockInfoDetails.Count<=0) |
| | | { |
| | | return content.Error("æååºåæç»"); |
| | | } |
| | | proStockInfoDetails.ForEach(x => |
| | | { |
| | | x.OutboundQuantity = 0; |
| | | x.ProOutDetailStatus = StockStatusEmun.åºåºå®æ.ObjToInt(); |
| | | }); |
| | | //å¤çåºåæ°æ® |
| | | //List<Dt_ProStockInfoDetail>? deleteStockDetails = null; |
| | | //List<Dt_ProStockInfoDetail>? updateStockDetails = null; |
| | | //(List<Dt_ProStockInfoDetail>?, List<Dt_ProStockInfoDetail>?) result = _stockService.ProStockInfoService.HandleOutProStock(proStockInfo); |
| | | //if (result.Item1!=null && result.Item1.Count>0) |
| | | //{ |
| | | // deleteStockDetails.AddRange(result.Item1); |
| | | //} |
| | | //if (result.Item1 != null && result.Item1.Count > 0) |
| | | //{ |
| | | // updateStockDetails.AddRange(updateStockDetails); |
| | | //} |
| | | //è·åæååºåºåæç» |
| | | Dt_ProOutOrderDetail? proOutOrderDetail = proOutOrder.Details.FirstOrDefault(x=>x.Id== outProStockInfo.OrderDetailId); |
| | | if (proOutOrderDetail==null) |
| | | { |
| | | return content.Error("æªæ¾å°å¯¹åºä»»å¡æå订åæç»"); |
| | | } |
| | | //if (deleteStockDetails?.Sum(x=>x.StockPcsQty)== proStockInfo.proStockInfoDetails.Sum(x=>x.StockPcsQty)) |
| | | //{ |
| | | proStockInfo.StockStatus = StockStatusEmun.åºåºå®æ.ObjToInt(); |
| | | proStockInfo.LocationCode = "åºè³æåå¾
åè´§åº"; |
| | | //} |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | outProStockInfo.Status = OutLockStockStatusEnum.åºåºå®æ.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | //è´§ä½åå¨è®°å½ |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, proStockInfo.PalletType, LocationStatusEnum.Free, proStockInfo.WarehouseId); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, (LocationStatusEnum)beforeStatus, LocationStatusEnum.Free, LocationChangeType.OutboundCompleted, proOutOrder?.ProOutOrderNo ?? "", task.TaskNum); |
| | | if (proOutOrder.ProOrderStatus == OutOrderStatusEnum.æªå¼å§.ObjToInt()) |
| | | { |
| | | proOutOrder.ProOrderStatus = OutOrderStatusEnum.åºåºä¸.ObjToInt(); |
| | | _outboundService.ProOutOrderService.UpdateData(proOutOrder); |
| | | } |
| | | |
| | | //if (deleteStockDetails!=null && deleteStockDetails.Count>0) |
| | | //{ |
| | | // _stockRepository.ProStockInfoDetailRepository.DeleteAndMoveIntoHty(deleteStockDetails, OperateTypeEnum.èªå¨å®æ); |
| | | //} |
| | | //if (updateStockDetails!=null && updateStockDetails.Count>0) |
| | | //{ |
| | | _stockRepository.ProStockInfoRepository.UpdateData(proStockInfo); |
| | | _stockRepository.ProStockInfoDetailRepository.UpdateData(proStockInfoDetails); |
| | | _outProStockInfoRepository.UpdateData(outProStockInfo); |
| | | //} |
| | | //else |
| | | //{ |
| | | //_stockRepository.ProStockInfoRepository.DeleteAndMoveIntoHty(proStockInfo, OperateTypeEnum.èªå¨å®æ); |
| | | //} |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //MESæååºåºåæ¥ |
| | | ShipmentOrderSync(MesOutSync(outProStockInfo, proOutOrderDetail)); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |
| | |
| | | using MailKit.Search; |
| | | using WIDESEA_External.Model; |
| | | using WIDESEA_Core.CodeConfigEnum; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | |
| | | /// <param name="ProOutNo">åºåºè®¢åå·</param> |
| | | /// <param name="StationCode">ç«å°å°å</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent OutProductTask(string ProOutNo, string StationCode) |
| | | public WebResponseContent OutProductTask(int[] keys, string StationCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //è·åæååºåºè®¢å |
| | | Dt_ProOutOrder proOutOrder = _outboundService.ProOutOrderService.Repository.Db.Queryable<Dt_ProOutOrder>().Where(x => x.ProOutOrderNo == ProOutNo).Includes(x => x.Details).First(); |
| | | if (proOutOrder==null) |
| | | List<Dt_ProOutOrderDetail> _ProOutOrderDetails = _outboundRepository.ProOutOrderDetailRepository.QueryData(x => keys.Contains(x.Id)); |
| | | if (_ProOutOrderDetails.Count<=0) |
| | | { |
| | | return content.Error("åºåºè®¢åä¸åå¨"); |
| | | return content.Error("å¾é订åæç»ä¸åå¨"); |
| | | } |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<StockSelectViewDTO> stockSelectViews = new List<StockSelectViewDTO>(); |
| | |
| | | List<Dt_OutProStockInfo> outProStockInfos = new List<Dt_OutProStockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ProOutOrderDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) result = |
| | | OutProductTaskDataHandle(proOutOrder); |
| | | OutProductTaskDataHandle(_ProOutOrderDetails); |
| | | if (result.Item2 != null && result.Item2.Count > 0) |
| | | { |
| | | proStockInfos.AddRange(result.Item2); |
| | |
| | | /// å¤çæååºåºæ°æ® |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ProOutOrderDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) OutProductTaskDataHandle(Dt_ProOutOrder proOutOrder) |
| | | public (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ProOutOrderDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) OutProductTaskDataHandle(List<Dt_ProOutOrderDetail> proOutOrderDetails) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_ProStockInfo> proStockInfos = new List<Dt_ProStockInfo>(); |
| | | List<Dt_ProOutOrderDetail> proOutOrderDetails = new List<Dt_ProOutOrderDetail>(); |
| | | List<Dt_ProOutOrderDetail> assignOutOrderDetails = new List<Dt_ProOutOrderDetail>(); |
| | | List<Dt_OutProStockInfo> outProStockInfos=new List<Dt_OutProStockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | //åé
åºå |
| | | (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) result = _outboundService.ProOutOrderDetailService.AssignProStockOut(proOutOrder.WarehouseId, proOutOrder); |
| | | (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) result = _outboundService.ProOutOrderDetailService.AssignProStockOut(proOutOrderDetails); |
| | | if (result.Item1!=null&&result.Item1.Count>0) |
| | | { |
| | | //è·åæåå |
| | | Dt_ProOutOrder proOutOrder = _outboundRepository.ProOutOrderRepository.QueryFirst(x => x.Id == proOutOrderDetails.FirstOrDefault().ProOrderId); |
| | | if (proOutOrder==null) |
| | | { |
| | | throw new Exception("æªæ¾å°æå订å"); |
| | | } |
| | | TaskTypeEnum typeEnum = proOutOrder.ProOrderType switch |
| | | { |
| | | (int)OutProTypeEnum.ProOut => TaskTypeEnum.OutProduct, |
| | |
| | | else return Instance.Error(content.Message); |
| | | } |
| | | /// <summary> |
| | | /// æ¥æ¶ERPæååºåºåä¿¡æ¯ |
| | | /// æ¥æ¶ERPæååºåºåä¿¡æ¯(订ååºåº/å¯å®åºåº) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("ProductDeliveryOrder"), AllowAnonymous, MethodParamsValidate] |
| | |
| | | WebResponseContent content = _outboundService.ProOutOrderService.ProductDeliveryOrder(erpProOutOrder.Content); |
| | | if (content.Status) return Instance.OK(); |
| | | else return Instance.Error(content.Message); |
| | | } |
| | | /// <summary> |
| | | /// æåå¯å®è½¬å
¥/è°æ¨å
¥åº |
| | | /// </summary> |
| | | /// <param name="root"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("ProductWarehousingOrder"), AllowAnonymous, MethodParamsValidate] |
| | | public ErpResponseContent ProductWarehousingOrder([FromBody] Root<ErpProductWarehousingOrderDTO> root) |
| | | { |
| | | return Instance.OK(); |
| | | } |
| | | /// <summary> |
| | | /// æåè°æ¨åºï¼ç åï¼ |
| | | /// </summary> |
| | | /// <param name="root"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("ProductTransferOrder"), AllowAnonymous, MethodParamsValidate] |
| | | public ErpResponseContent ProductTransferOrder([FromBody] Root<ErpProductTransferOrder> root) |
| | | { |
| | | return Instance.OK(); |
| | | } |
| | | /// <summary> |
| | | /// æåæ¥åºåºåºåæ¥æ¶ |
| | | /// </summary> |
| | | /// <param name="root"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("ProductScrappedOrder"), AllowAnonymous, MethodParamsValidate] |
| | | public ErpResponseContent ProductScrappedOrder([FromBody] Root<ErpProductScrappedOrderDTO> root) |
| | | { |
| | | return Instance.OK(); |
| | | } |
| | | /// <summary> |
| | | /// æå颿åºåºåæ¥æ¶ |
| | | /// </summary> |
| | | /// <param name="root"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("ProductOutOrder"), AllowAnonymous, MethodParamsValidate] |
| | | public ErpResponseContent ProductOutOrder([FromBody] Root<ErpProOutLingOrder> root) |
| | | { |
| | | return Instance.OK(); |
| | | } |
| | | /// <summary> |
| | | /// éå®ææ´¾åæ¥æ¶ |
| | | /// </summary> |
| | | [HttpPost, Route("ProductSpecifyVer"), AllowAnonymous, MethodParamsValidate] |
| | | public ErpResponseContent ProductSpecifyVer([FromBody] Root<ErpProductSpecifyVerDTO> root) |
| | | { |
| | | return Instance.OK(); |
| | | } |
| | | /// <summary> |
| | | /// æ¥æ¶ERPéæåä¿¡æ¯ |
| | |
| | | { |
| | | return _invokeERPService.InvokeProOutApi(outOrderModel); |
| | | } |
| | | /// <summary> |
| | | /// æå仿£æ¥åºåºåºæ¨éERP |
| | | /// </summary> |
| | | /// <param name="checkModel"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("InvokeProCheckApi"), AllowAnonymous] |
| | | public string InvokeProCheckApi([FromBody] ERPProductCheckModel checkModel) |
| | | { |
| | | return _invokeERPService.InvokeProCheckApi(checkModel); |
| | | } |
| | | /// <summary> |
| | | /// æåè¶
卿æ¥åºæ¨éERp |
| | | /// </summary> |
| | | /// <param name="sheetModel"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("InvokeProScrapSheetApi"), AllowAnonymous] |
| | | public string InvokeProScrapSheetApi([FromBody] ERPScrapSheetModel sheetModel) |
| | | { |
| | | return _invokeERPService.InvokeProScrapSheetApi(sheetModel); |
| | | } |
| | | /// <summary> |
| | | /// æåçç¹çèµ¢/çäº |
| | | /// </summary> |
| | | /// <param name="stockCheckModel"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("InvokeProStockCheckApi"), AllowAnonymous] |
| | | public string InvokeProStockCheckApi([FromBody] ERPProStockCheckModel stockCheckModel) |
| | | { |
| | | return _invokeERPService.InvokeProStockCheckApi(stockCheckModel); |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost,Route("RworkTask"),AllowAnonymous] |
| | | public MesResponseContent RworkTask([FromBody] RworkTaskModel model) |
| | | public MesResponseContent RworkTask([FromBody] Root<RworkTaskModel> model) |
| | | { |
| | | return _taskService.RworkTask(model); |
| | | return _taskService.RworkTask(model.Content); |
| | | } |
| | | /// <summary> |
| | | /// åºåæ¿åºåºåæ¥æ¥å£ |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("ProductOutBoundSync"), AllowAnonymous] |
| | | public WebResponseContent ProductOutBoundSync([FromBody] MesProductOutBound model) |
| | | { |
| | | return _taskService.ProductOutBoundSync(model); |
| | | } |
| | | /// <summary> |
| | | /// çæMESPPä»å¤§å·åºåºä»»å¡ |
| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseController; |
| | | using WIDESEA_IOutboundService; |
| | | using WIDESEA_Model.Models; |
| | |
| | | public ProOutOrderController(IProOutOrderService service) : base(service) |
| | | { |
| | | } |
| | | /// <summary> |
| | | /// æååºå¾
åè´§åº(å¹³åº)+忥ERPåºåº |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("OutProductPK"), AllowAnonymous] |
| | | public WebResponseContent OutProductPK([FromBody] string[] OutPKCodes, string ProOutNo) |
| | | { |
| | | return Service.OutProductPK(OutPKCodes, ProOutNo); |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <param name="StationCode">ç«å°å°å</param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("OutProductTask"), AllowAnonymous] |
| | | public WebResponseContent OutProductTask(string ProOutNo, string StationCode) |
| | | public WebResponseContent OutProductTask([FromBody] int[] keys, string StationCode) |
| | | { |
| | | return Service.OutProductTask(ProOutNo, StationCode); |
| | | return Service.OutProductTask(keys, StationCode); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// çææåæåºä»»å¡ |
| | | /// </summary> |
| | | [HttpPost, HttpGet, Route("OutProRworkTask"), AllowAnonymous] |
| | | public WebResponseContent OutProRworkTask([FromBody] int[] keys, string StationCode) |
| | | { |
| | | return Service.OutProductTask(keys, StationCode); |
| | | } |
| | | ///// <summary> |
| | | ///// çæMESPPä»å¤§å·åºåºä»»å¡ |