| | |
| | | using WIDESEA_Core.CodeConfigEnum; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.Log; |
| | | using WIDESEA_Core.Utilities; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_DTO.Basic; |
| | |
| | | { |
| | | string serialNumber = serialNumberObj?.ToString(); |
| | | if (!string.IsNullOrEmpty(serialNumber)) |
| | | { |
| | | { |
| | | serialNumbers.Add(serialNumber); |
| | | } |
| | | else |
| | |
| | | decimal totalQuantity = stockInfo.Details.Sum(x => x.StockQuantity); |
| | | |
| | | inboundOrder.OrderStatus = InOrderStatusEnum.入库中.ObjToInt(); |
| | | |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | if (stockInfo.Id == 0) |
| | | { |
| | |
| | | |
| | | 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).FirstOrDefault(); |
| | | |
| | | if (notGroupDetail.MaterielType == 1) |
| | | { |
| | | stockInfo.WarehouseId = 6; |
| | |
| | | QtyOfpcs = item.QtyOfpcs, |
| | | QtyOfxout = item.QtyOfxout, |
| | | CPStockDetailStatus = (int)StockStatusEmun.组盘暂存, |
| | | LPNNO = item.LPNNO, |
| | | OrinalLocation = item.OrinalLocation, |
| | | Creater = "上游WMS", |
| | | }; |
| | | stockInfoDetailCP.Add(stockInfoDetailCP1); |
| | |
| | | } |
| | | |
| | | // 更新订单明细 |
| | | if (detailsToUpdate.Count > 0) |
| | | if (detailsToUpdate.Count > 0) |
| | | { |
| | | _inboundRepository.InboundOrderDetailRepository.UpdateData(detailsToUpdate); |
| | | } |
| | |
| | | #endregion |
| | | |
| | | public string ReceiveWMSTaskin = WIDESEA_Core.Helper.AppSettings.Configuration["ReceiveWMSTaskin"]; |
| | | |
| | | /// <summary> |
| | | /// 组盘合托 |
| | | /// </summary> |
| | |
| | | WebResponseContent webResponseContent = new WebResponseContent(); |
| | | try |
| | | { |
| | | var soussAddress = saveModel.MainData["soussAddress"]; |
| | | var soussAddress = saveModel.MainData["soussAddress"]; |
| | | var targetAddress = saveModel.MainData["targetAddress"]; |
| | | |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == soussAddress).First(); |
| | |
| | | |
| | | 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, |
| | |
| | | _inboundOrderDetailService.DeleteData(item); |
| | | } |
| | | BaseDal.DeleteData(oldOutboundOrder); |
| | | WriteLog.Write_Log("API", "SMOM推送入库单据取消", "请求成功", new { 请求报文 = oldOutboundOrder, 接收报文 = content }); |
| | | content = WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | 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); |
| | |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | Db.InsertNav(erpProScrapSheet).Include(x => x.Details).ExecuteCommand(); |
| | | WriteLog.Write_Log("API", "erp单据下发", "请求成功", new { 请求报文 = erpProScrapSheet, 接收报文 = WebResponseContent.Instance.OK() }); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | |
| | | } |
| | |
| | | } |
| | | //反拣回库单 |
| | | public WebResponseContent ReceiveReturnOrder(List<HouseReturnOrder> houseReturnOrder) |
| | | { |
| | | { |
| | | try |
| | | { |
| | | Random random = new Random(); |