| | |
| | | else |
| | | { |
| | | |
| | | if ((generate.SourceAddress == "R01-003-041-011-01" || generate.SourceAddress == "R02-003-027-011-01" || generate.SourceAddress == "R02-003-043-011-01")) |
| | | if ((generate.SourceAddress == "R01-003-041-011-01" || generate.SourceAddress == "R01-002-043-001-01" || generate.SourceAddress == "R02-003-027-011-01")) |
| | | { |
| | | Dt_StockInfo dt_StockInfo2 = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == generate.PalletCode); |
| | | if(dt_StockInfo2 == null) |
| | |
| | | CreateDate = DateTime.Now, |
| | | MaterialType = (int)InventoryMaterialType.空æ, |
| | | Materialweight = 0, |
| | | Wlstatus = (int)InventoryMaterialStatus.空æ, |
| | | }; |
| | | _stockService.StockInfoService.Repository.AddData(dt_Stock); |
| | | } |
| | |
| | | Dt_LocationInfo newLocation; |
| | | Dt_LocationInfo newSourceAddress; |
| | | newSourceAddress = _basicService.LocationInfoService.GetLocationplatform(generate.SourceAddress); |
| | | newLocation = _basicService.LocationInfoService.GetLocation(newSourceAddress.RoadwayNo); |
| | | int Locationtype = 9; //é»è®¤ä¸º9 |
| | | if(dt_StockInfo.MaterialType== (int)InventoryMaterialType.æå || (generate.SourceAddress == "R01-003-041-001-01" && dt_StockInfo.MaterialType == (int)InventoryMaterialType.åææ)) |
| | | { |
| | | Locationtype = 11; |
| | | }else if(dt_StockInfo.MaterialType == (int)InventoryMaterialType.åææ) |
| | | { |
| | | Locationtype = 10; |
| | | } |
| | | newLocation = _basicService.LocationInfoService.GetLocation(newSourceAddress.RoadwayNo, Locationtype); |
| | | //string[] Pallet = PalletCode.Split("-"); |
| | | if (newLocation != null && newSourceAddress != null) |
| | | { |
| | |
| | | Creater = "WMS", |
| | | Depth = newLocation.Depth, |
| | | CreateDate = DateTime.Now, |
| | | MaterialType= dt_StockInfo.MaterialType |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | if (newLocation.LocationStatus == LocationStatusEnum.Free.ObjToInt()) |
| | |
| | | /// æ¥è¯¢1å··éåºåï¼æ¯å¦è¿è¡è¿è¡å
¥åº //带åç»éæ°æ¼æ¥ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent Queryinventory(GenerateInv generate) |
| | | public WebResponseContent Queryinventory3(GenerateInv generate) |
| | | { |
| | | try |
| | | { |
| | |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è§£æåºå |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent Queryinventory(GenerateInv generate) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | |
| | | string[] targetCodes = generate.PalletCode.Split("*"); |
| | | if (targetCodes.Length == 4) |
| | | { |
| | | Dt_InboundOrder dt_Inbound = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.OrderName == targetCodes[0]); |
| | | |
| | | if(dt_Inbound != null) |
| | | { |
| | | Dt_StockInfo dt_StockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == generate.PalletCode); |
| | | if (dt_Inbound.OrderType == (int)InventoryMaterialType.åææ) //0ä¸ºåææç¼ç |
| | | { |
| | | List<Dt_LocationInfo> locationInfos = _basicService.LocationInfoService.Repository.QueryData(x => x.RoadwayNo == "2" && x.LocationStatus == (int)LocationStatusEnum.Free && x.Depth == 1 && x.EnableStatus == (int)EnableStatusEnum.Normal && x.LocationType == (int)LocationTypeEnum.MaterialsCube); |
| | | |
| | | if (dt_StockInfo == null) |
| | | { |
| | | Dt_StockInfo dt_Stock = new() |
| | | { |
| | | PalletCode = generate.PalletCode, |
| | | IsFull = true, |
| | | StockStatus = (int)StockStatusEmun.ç»çæå, |
| | | Creater = "WMS", |
| | | CreateDate = DateTime.Now, |
| | | MaterialType = (int)InventoryMaterialType.åææ, |
| | | Materialweight = decimal.Parse(targetCodes[3]), |
| | | Wlstatus = (int)InventoryMaterialStatus.å¾
æ£, |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | _stockService.StockInfoService.Repository.AddData(dt_Stock); |
| | | Dt_StockInfo dt_StockInfo2 = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == generate.PalletCode); |
| | | string part2 = targetCodes[1].Substring(0, 2); //è§£æç©ææ¹æ¬¡æ¾è¯¦æ
|
| | | Dt_InboundOrder dt_Int = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.UpperOrderNo == part2); |
| | | |
| | | Dt_StockInfoDetail dt_StockInfoDetail = new() |
| | | { |
| | | StockId = dt_StockInfo2.Id, |
| | | MaterielCode = dt_Inbound.OrderName, //ç©æå· |
| | | MaterielName = dt_Inbound.UpperOrderNo, //ç©æåç§° |
| | | OrderNo = dt_Inbound.OrderNo, //ç©æè¯¦æ
|
| | | BatchNo = targetCodes[1].ToString(), //ç©ææ¹æ¬¡ |
| | | SerialNumber = targetCodes[2].ToString(), //å
å· |
| | | BatchNoName = dt_Int.OrderNo, |
| | | StockQuantity = decimal.Parse(targetCodes[3].ToString()), //éé |
| | | OutboundQuantity = 1, //åºåå· |
| | | Status = (int)StockStatusEmun.ç»çæå, |
| | | Creater = "WMS", |
| | | CreateDate = DateTime.Now, |
| | | |
| | | }; |
| | | _stockService.StockInfoDetailService.AddData(dt_StockInfoDetail); |
| | | _unitOfWorkManage.CommitTran(); |
| | | if (locationInfos.Count < 50) |
| | | { |
| | | return content = WebResponseContent.Instance.OK(data: 1); |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.OK(data: 3); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (dt_StockInfo.StockStatus == (int)StockStatusEmun.ç»çæå) |
| | | { |
| | | if (locationInfos.Count < 50) |
| | | { |
| | | return content = WebResponseContent.Instance.OK(data: 1); |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.OK(data: 3); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"åºåå·²æè¯¥æ¡ç ï¼æ¡ç ä¿¡æ¯ï¼{generate.PalletCode}"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | else if (dt_Inbound.OrderType == (int)InventoryMaterialType.æå) |
| | | { |
| | | if (dt_StockInfo == null) |
| | | { |
| | | Dt_StockInfo dt_Stock = new() |
| | | { |
| | | PalletCode = generate.PalletCode, |
| | | IsFull = true, |
| | | StockStatus = (int)StockStatusEmun.ç»çæå, |
| | | Creater = "WMS", |
| | | CreateDate = DateTime.Now, |
| | | MaterialType = (int)InventoryMaterialType.æå, |
| | | Materialweight = decimal.Parse(targetCodes[3]), |
| | | Wlstatus = (int)InventoryMaterialStatus.å¾
æ£, |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | _stockService.StockInfoService.Repository.AddData(dt_Stock); |
| | | Dt_StockInfo dt_StockInfo2 = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == generate.PalletCode); |
| | | Dt_StockInfoDetail dt_StockInfoDetail = new() |
| | | { |
| | | StockId = dt_StockInfo2.Id, |
| | | MaterielCode = dt_Inbound.OrderName, //ç©æå· |
| | | MaterielName = dt_Inbound.UpperOrderNo, //ç©æåç§° |
| | | OrderNo = dt_Inbound.OrderNo, //ç©æè¯¦æ
|
| | | BatchNo = targetCodes[1].ToString(), //ç©ææ¹æ¬¡ |
| | | BatchNoName = "", |
| | | SerialNumber = targetCodes[2], //å
å· |
| | | StockQuantity = decimal.Parse(targetCodes[3]), //éé |
| | | OutboundQuantity = 1, //åºåå· |
| | | Status = (int)StockStatusEmun.ç»çæå, |
| | | Creater = "WMS", |
| | | CreateDate = DateTime.Now, |
| | | }; |
| | | _stockService.StockInfoDetailService.AddData(dt_StockInfoDetail); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content = WebResponseContent.Instance.OK(data: 1); |
| | | } |
| | | else |
| | | { |
| | | if (dt_StockInfo.StockStatus == (int)StockStatusEmun.ç»çæå) |
| | | { |
| | | return content = WebResponseContent.Instance.OK(data: 1); |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"åºåå·²æè¯¥æ¡ç ï¼æ¡ç ä¿¡æ¯ï¼{generate.PalletCode}"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"æªæ¾å°æ¡ç è§£æï¼æ¡ç ä¿¡æ¯ï¼{generate.PalletCode}"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"æªæ¾å°å
¥åºåï¼æ¡ç ä¿¡æ¯ï¼{generate.PalletCode}"); |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"è§£æçæçæ¡ç é¿åº¦ä¸è¶³4,æ¡ç ä¿¡æ¯ï¼{generate.PalletCode}"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content=WebResponseContent.Instance.Error($"ç³»ç»å··éå
¥åºæ¥å£è§£æé误ï¼é误ï¼{ex.Message}"); |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent Queryinventory2(GenerateInv generate) |
| | | { |
| | | try |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | string result = generate.PalletCode.Substring(0, 2); |
| | | if (result == "B-") |
| | | { |
| | | Dt_StockInfo dt_StockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == generate.PalletCode); |
| | | if (dt_StockInfo == null) |
| | | { |
| | | Dt_StockInfo dt_Stock = new() |
| | | { |
| | | PalletCode = generate.PalletCode, |
| | | IsFull = true, |
| | | StockStatus = (int)StockStatusEmun.ç»çæå, |
| | | Creater = "WMS", |
| | | CreateDate = DateTime.Now, |
| | | MaterialType = (int)InventoryMaterialType.æå, |
| | | Materialweight = 0, |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | _stockService.StockInfoService.Repository.AddData(dt_Stock); |
| | | |
| | | //string part2 = generate.PalletCode.Substring(2, 8); |
| | | |
| | | //string part3 = generate.PalletCode.Split('#')[1]; |
| | | Dt_StockInfo dt_StockInfo2 = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == generate.PalletCode); |
| | | Dt_StockInfoDetail dt_StockInfoDetail = new() |
| | | { |
| | | StockId = dt_StockInfo2.Id, |
| | | MaterielCode = dt_StockInfo2.PalletCode, //ç©æç¼å· |
| | | MaterielName = dt_StockInfo2.PalletCode, //æè´¨ |
| | | OrderNo = dt_StockInfo2.PalletCode, //åæ®ï¼æçæ¡ç ï¼ |
| | | BatchNo = dt_StockInfo2.PalletCode, //æ¹æ¬¡å· |
| | | SerialNumber = dt_StockInfo2.PalletCode, //åºåå· |
| | | StockQuantity = 1, //åºåå· |
| | | OutboundQuantity = 1, //åºåå· |
| | | Status = (int)StockStatusEmun.ç»çæå, |
| | | Creater = "WMS", |
| | | CreateDate = DateTime.Now, |
| | | }; |
| | | _stockService.StockInfoDetailService.AddData(dt_StockInfoDetail); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content = WebResponseContent.Instance.OK(data: 1); |
| | | } |
| | | else |
| | | { |
| | | if(dt_StockInfo.StockStatus== (int)StockStatusEmun.ç»çæå) |
| | | { |
| | | return content = WebResponseContent.Instance.OK(data:1); |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"åºåå·²æè¯¥æ¡ç ï¼æ¡ç ä¿¡æ¯ï¼{generate.PalletCode}"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Dt_InboundOrder dt_Inbound = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.UpperOrderNo == result); |
| | | Dt_StockInfo dt_StockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == generate.PalletCode); |
| | | List<Dt_LocationInfo> locationinfoData = _basicService.LocationInfoService.Repository.QueryData(x => x.RoadwayNo == "2" && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() |
| | | && x.LocationType == (int)LocationTypeEnum.MaterialsCube); |
| | | if (dt_Inbound != null) |
| | | { |
| | | if (dt_StockInfo == null) |
| | | { |
| | | Dt_StockInfo dt_Stock = new() |
| | | { |
| | | PalletCode = generate.PalletCode, |
| | | IsFull = true, |
| | | StockStatus = (int)StockStatusEmun.ç»çæå, |
| | | Creater = "WMS", |
| | | CreateDate = DateTime.Now, |
| | | MaterialType = (int)InventoryMaterialType.åææ, |
| | | Materialweight = 0, |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | _stockService.StockInfoService.Repository.AddData(dt_Stock); |
| | | |
| | | string part2 = generate.PalletCode.Substring(2, 8); |
| | | |
| | | string part3 = generate.PalletCode.Split('#')[1]; |
| | | Dt_StockInfo dt_StockInfo2 = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == generate.PalletCode); |
| | | Dt_StockInfoDetail dt_StockInfoDetail = new() |
| | | { |
| | | StockId = dt_StockInfo2.Id, |
| | | MaterielCode = result, //ç©æç¼å· |
| | | MaterielName = dt_Inbound.OrderNo, //æè´¨ |
| | | OrderNo = generate.PalletCode, //åæ®ï¼æçæ¡ç ï¼ |
| | | BatchNo = part2, //æ¹æ¬¡å· |
| | | SerialNumber = part3, //åºåå· |
| | | StockQuantity = 1, //åºåå· |
| | | OutboundQuantity = 1, //åºåå· |
| | | Status = (int)StockStatusEmun.ç»çæå, |
| | | Creater = "WMS", |
| | | CreateDate = DateTime.Now, |
| | | }; |
| | | _stockService.StockInfoDetailService.AddData(dt_StockInfoDetail); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | |
| | | if (locationinfoData.Count > 40) |
| | | { |
| | | return content = WebResponseContent.Instance.OK(data: 3); |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.OK(data: 1); |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | if (dt_StockInfo.StockStatus == (int)StockStatusEmun.ç»çæå) |
| | | { |
| | | if (locationinfoData.Count > 40) |
| | | { |
| | | return content = WebResponseContent.Instance.OK(data: 3); |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.OK(data: 1); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"åºåå·²æè¯¥æ¡ç ï¼æ¡ç ä¿¡æ¯ï¼{generate.PalletCode}"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error("æªæ¾å°è¯¥ç±»åçè§£æ"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent PalletQueryinventory() |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | List<Dt_LocationInfo> locationinfoData = _basicService.LocationInfoService.Repository.QueryData(x => x.RoadwayNo=="2" && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() |
| | | && x.LocationType == (int)LocationTypeEnum.MaterialsCube && x.EnableStatus == (int)EnableStatusEnum.Normal); |
| | | if (locationinfoData.Count < 20) |
| | | { |
| | | return content = WebResponseContent.Instance.OK(data: 1); |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.OK(data: 3); |
| | | } |
| | | } |
| | | } |
| | | } |