| | |
| | | string json = JsonConvert.SerializeObject(item); |
| | | Dictionary<string, object> delKeyDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(json); |
| | | |
| | | string serialNumber = string.Empty; |
| | | decimal quantity = 0; |
| | | |
| | | // 第一步:读取serialNumber并校验 |
| | | if (delKeyDict.TryGetValue("serialNumber", out object serialNumberObj)) |
| | | { |
| | | string serialNumber = serialNumberObj?.ToString(); |
| | | if (!string.IsNullOrEmpty(serialNumber)) |
| | | { |
| | | serialNumbers.Add(serialNumber); |
| | | } |
| | | else |
| | | serialNumber = serialNumberObj?.ToString(); |
| | | if (string.IsNullOrEmpty(serialNumber)) |
| | | { |
| | | return WebResponseContent.Instance.Error("serialNumber的值为空"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("缺少serialNumber字段"); |
| | | } |
| | | |
| | | if (delKeyDict.TryGetValue("quantity", out object quantityObj)) |
| | | { |
| | | if (quantityObj == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("物料数量的值为空"); |
| | | } |
| | | decimal quantity; |
| | | try |
| | | { |
| | | quantity = Convert.ToDecimal(quantityObj); |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error("物料数量必须大于0"); |
| | | } |
| | | |
| | | quantitys.Add(quantity); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("缺少物料数量字段"); |
| | | } |
| | | |
| | | var keyValuePairs = serialNumber.Split(','); |
| | | List<string> newKeyValuePairs = new List<string>(); |
| | | bool qFieldUpdated = false; |
| | | |
| | | foreach (var pair in keyValuePairs) |
| | | { |
| | | if (pair.StartsWith("Q:")) |
| | | { |
| | | newKeyValuePairs.Add($"Q:{quantity}"); |
| | | qFieldUpdated = true; |
| | | } |
| | | else |
| | | { |
| | | newKeyValuePairs.Add(pair); |
| | | } |
| | | } |
| | | string updatedSerialNumber = string.Join(',', newKeyValuePairs); |
| | | serialNumbers.Add(updatedSerialNumber); |
| | | } |
| | | Dt_Warehouse warehouse = _warehouseService.Repository.QueryFirst(x => x.WarehouseId == warehouseId); |
| | | if (warehouse == null) |
| | |
| | | return WebResponseContent.Instance.Error($"托盘号重复,该托盘已组过物料"); |
| | | } |
| | | List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | foreach (var model in models) |
| | | { |
| | | |
| | | Dt_InboundOrderDetail notGroupDetail = new Dt_InboundOrderDetail(); |
| | | |
| | | notGroupDetail = inboundOrder.Details.Where(x => x.OrderDetailStatus <= OrderDetailStatusEnum.Inbounding.ObjToInt() && x.MaterielCode == model.MaterielCode && x.BatchNo == model.LotNo).FirstOrDefault(); |
| | | notGroupDetail = inboundOrder.Details.Where(x => x.OrderDetailStatus <= OrderDetailStatusEnum.Inbounding.ObjToInt() && x.MaterielCode == model.MaterielCode && x.SupplierBatch == model.LotNo && x.OrderQuantity > x.ReceiptQuantity && x.OrderQuantity == model.Quantity).FirstOrDefault(); |
| | | if (notGroupDetail == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"请检查物料信息条码和入库单明细是否对应正确"); |
| | | } |
| | | |
| | | if (notGroupDetail.MaterielType == 1) |
| | | { |
| | | stockInfo.WarehouseId = 6; |
| | |
| | | |
| | | inboundOrder.OrderStatus = InOrderStatusEnum.入库中.ObjToInt(); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | if (stockInfo.Id == 0) |
| | | { |
| | | _stockRepository.StockInfoRepository.Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand(); |
| | |
| | | QtyOfpcs = item.QtyOfpcs, |
| | | QtyOfxout = item.QtyOfxout, |
| | | CPStockDetailStatus = (int)StockStatusEmun.组盘暂存, |
| | | LPNNO = item.LPNNO, |
| | | OrinalLocation = item.OrinalLocation, |
| | | Creater = "上游WMS", |
| | | }; |
| | | stockInfoDetailCP.Add(stockInfoDetailCP1); |
| | |
| | | #endregion |
| | | |
| | | public string ReceiveWMSTaskin = WIDESEA_Core.Helper.AppSettings.Configuration["ReceiveWMSTaskin"]; |
| | | |
| | | /// <summary> |
| | | /// 组盘合托 |
| | | /// </summary> |
| | |
| | | |
| | | public int GetPalletType(Dt_Warehouse warehouse, string palletCode) |
| | | { |
| | | if (warehouse.WarehouseCode == WarehouseEnum.SC01_BC.ObjToString()) |
| | | if (warehouse.WarehouseCode.Contains("BC")) |
| | | { |
| | | Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 3)); |
| | | if (palletTypeInfo == null) |
| | |
| | | } |
| | | return palletTypeInfo.PalletType; |
| | | } |
| | | |
| | | //else if (warehouse.WarehouseCode == WarehouseEnum.HA152.ObjToString()) |
| | | //{ |
| | | // Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 2)); |
| | | // if (palletTypeInfo == null) |
| | | // { |
| | | // throw new Exception($"托盘号错误"); |
| | | // } |
| | | // return palletTypeInfo.PalletType; |
| | | //} |
| | | //else if (warehouse.WarehouseCode == WarehouseEnum.HA57.ObjToString()) |
| | | //{ |
| | | // Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 3)); |
| | | // if (palletTypeInfo == null) |
| | | // { |
| | | // throw new Exception($"托盘号错误"); |
| | | // } |
| | | // return palletTypeInfo.PalletType; |
| | | //} |
| | | //else if (warehouse.WarehouseCode == WarehouseEnum.HA58.ObjToString()) |
| | | //{ |
| | | // Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 2)); |
| | | // if (palletTypeInfo == null) |
| | | // { |
| | | // throw new Exception($"托盘号错误"); |
| | | // } |
| | | // return palletTypeInfo.PalletType; |
| | | //} |
| | | return -1; |
| | | return 0; |
| | | } |
| | | /// <summary> |
| | | /// 判断正确时间格式 |
| | |
| | | } |
| | | if (warehouse.WarehouseCode.Contains("CP")) |
| | | { |
| | | if (item.SupplierBatch == null) |
| | | { |
| | | return content.Error("供应商批次不可为空"); |
| | | } |
| | | Dt_InboundOrder inboundOrderOld = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == model.AsnNo).Includes(x => x.Details).First(); |
| | | |
| | | if (inboundOrderOld != null) |
| | |
| | | QtyOfpcs = (float)list.QtyOfpcs, |
| | | QtyOfxout = (float)list.QtyOfxout, |
| | | CPOrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt(), |
| | | LPNNO = list.LPNNO, |
| | | OrinalLocation = list.OrinalLocation, |
| | | Creater = "上游WMS", |
| | | }; |
| | | cPInboundOrderDetail.Add(cPInboundOrderDetail1); |
| | |
| | | QtyOfpcs = (float)list.QtyOfpcs, |
| | | QtyOfxout = (float)list.QtyOfxout, |
| | | CPOrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt(), |
| | | LPNNO = list.LPNNO, |
| | | OrinalLocation = list.OrinalLocation, |
| | | Creater = "上游WMS", |
| | | }; |
| | | cPInboundOrderDetail.Add(cPInboundOrderDetail1); |
| | |
| | | OrinalLocation = item.OrinalLocation, |
| | | CPDetails = cPInboundOrderDetail |
| | | }; |
| | | |
| | | Dt_InboundOrder inboundOrder = new Dt_InboundOrder() |
| | | { |
| | | OrderNo = model.AsnNo, |
| | |
| | | } |
| | | else |
| | | { |
| | | if (item.SupplierBatch == null) |
| | | { |
| | | return content.Error("供应商批次不可为空"); |
| | | } |
| | | //if (item.SupplierBatch == null) |
| | | //{ |
| | | // return content.Error("供应商批次不可为空"); |
| | | //} |
| | | Dt_InboundOrder inboundOrderOld = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == model.AsnNo).Includes(x => x.Details).First(); |
| | | |
| | | if (inboundOrderOld != null) |
| | |
| | | { |
| | | OrderId = orderDetail1.OrderId, |
| | | MaterielCode = item.MaterielCode, |
| | | MaterielType=item.MaterielType, |
| | | MaterielType = item.MaterielType, |
| | | BatchNo = item.BatchNo, |
| | | OrderQuantity = item.OrderQuantity, |
| | | ReceiptQuantity = 0, |
| | |
| | | List<Dt_InboundOrder> dt_ReceiveOrders = new List<Dt_InboundOrder>(); |
| | | if (string.IsNullOrEmpty(orderNo)) |
| | | { |
| | | dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderStatus < InboundStatusEnum.入库完成.ObjToInt() && x.WarehouseId == warehouseId).Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 10); |
| | | dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderStatus < InboundStatusEnum.入库完成.ObjToInt() && x.WarehouseId == warehouseId).Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 50); |
| | | } |
| | | else |
| | | { |
| | | dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => (x.OrderNo.Contains(orderNo)) && x.OrderStatus < InboundStatusEnum.入库完成.ObjToInt() && x.WarehouseId == warehouseId).Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 10); |
| | | dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => (x.OrderNo.Contains(orderNo)) && x.OrderStatus < InboundStatusEnum.入库完成.ObjToInt() && x.WarehouseId == warehouseId).Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 50); |
| | | } |
| | | |
| | | content.OK(data: dt_ReceiveOrders); |
| | |
| | | } |
| | | //反拣回库单 |
| | | public WebResponseContent ReceiveReturnOrder(List<HouseReturnOrder> houseReturnOrder) |
| | | { |
| | | { |
| | | try |
| | | { |
| | | Random random = new Random(); |