| | |
| | | } |
| | | if (warehouse.WarehouseCode.Contains("CP")) |
| | | { |
| | | Dt_NewOutboundOrder newOutboundOrder = BaseDal.Db.Queryable<Dt_NewOutboundOrder>().Where(x => x.UpperOrderNo == orderAddDTO.No).Includes(x => x.Details).First(); |
| | | |
| | | Dt_Production production1 = new Dt_Production(); |
| | | if (newOutboundOrder != null) |
| | | { |
| | | if (newOutboundOrder.OutWareHouse != warehouse.WarehouseCode) |
| | | { |
| | | return WebResponseContent.Instance.Error($"仓库不一致"); |
| | | } |
| | | else |
| | | { |
| | | OutboundOrderAddDTO orderAddDTO1 = new OutboundOrderAddDTO(); |
| | | orderAddDTO1.Details = orderAddDTO.DetailList.DicToIEnumerable<OutboundOrderDetailAddDTO>(); |
| | | var details = orderAddDTO1.Details.FirstOrDefault(); |
| | | Dt_NewOutboundOrderDetail outboundOrderDetail = new Dt_NewOutboundOrderDetail() |
| | | { |
| | | LPNNo = details.LPNNo, |
| | | BatchNo = details.BatchNo, |
| | | MaterielCode = details.MaterielCode, |
| | | MaterielName = details.MaterielName, |
| | | MaterieSpec = details.MaterieSpec, |
| | | OrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt(), |
| | | OrderQuantity = details.OrderQuantity, |
| | | LinId = details.LinId, |
| | | OrderId = newOutboundOrder.Id, |
| | | Creater = "WMS", |
| | | CreateDate = DateTime.Now, |
| | | Remark = details.Remark, |
| | | SupplierBatch = details.SupplierBatch, |
| | | OrinalLocation = details.OrinalLocation, |
| | | }; |
| | | _newOutboundOrderDetailRepository.AddData(outboundOrderDetail); |
| | | foreach (var item in orderAddDTO1.Details) |
| | | { |
| | | if (string.IsNullOrWhiteSpace(item.Remark)) |
| | | { |
| | | continue; |
| | | } |
| | | string[] remarkEntries = item.Remark.Split( |
| | | new[] { ';' }, |
| | | StringSplitOptions.RemoveEmptyEntries |
| | | ); |
| | | |
| | | foreach (var entry in remarkEntries) |
| | | { |
| | | string[] keyValuePairs = entry.Split( |
| | | new[] { ',' }, |
| | | StringSplitOptions.RemoveEmptyEntries |
| | | ); |
| | | |
| | | foreach (var kvp in keyValuePairs) |
| | | { |
| | | int colonIndex = kvp.IndexOf(':'); |
| | | if (colonIndex <= 0 || colonIndex >= kvp.Length - 1) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | string key = kvp.Substring(0, colonIndex).Trim(); |
| | | string value = kvp.Substring(colonIndex + 1).Trim(); |
| | | |
| | | switch (key) |
| | | { |
| | | case "制造单号": |
| | | production1.ProductionNo = value; |
| | | break; |
| | | case "制造部件": |
| | | production1.ManufacturingCo = value; |
| | | break; |
| | | case "出库数量": |
| | | if (decimal.TryParse(value, out decimal outQuantity)) |
| | | { |
| | | production1.OutQuantity = outQuantity; |
| | | } |
| | | else |
| | | { |
| | | Console.WriteLine($"出库数量格式错误:{value}(应为数值,如14.0000)"); |
| | | } |
| | | break; |
| | | default: |
| | | Console.WriteLine($"未知键名:{key}(对应值:{value},跳过该键值对)"); |
| | | break; |
| | | } |
| | | |
| | | } |
| | | production1.Creater = "WMS"; |
| | | production1.OrderId = outboundOrderDetail.Id; |
| | | _productionRepository.AddData(production1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | OutboundOrderAddDTO orderAddDTO1 = new OutboundOrderAddDTO(); |
| | | orderAddDTO1.OrderNo = orderAddDTO.No; |
| | | orderAddDTO1.UpperOrderNo = orderAddDTO.No; |
| | |
| | | } |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | if (item.Details.Count <= 0) |
| | | { |
| | | return content.Error($"未找到{item.PalletCode}库存明细数据"); |
| | | } |
| | | if (item.System.Contains("SMOM")) |
| | | { |
| | | return content.Error($"SMOM系统库存数据不可手动盘点,托盘号{item.PalletCode}"); |
| | | } |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == item.LocationCode); |
| | | if (locationInfo != null && (locationInfo.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || locationInfo.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && locationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && item.StockStatus == StockStatusEmun.入库完成.ObjToInt()) |