| | |
| | | .Where(it => it.EbelnK3id == inventoryDetails.LineK3id) |
| | | .First(); |
| | | |
| | | if (cgddDetails == null) |
| | | throw new Exception("此条码找不到对应采购订单明细!"); |
| | | |
| | | if (inventoryDetails == null) |
| | | throw new Exception("此条码找不到对应收货单明细!"); |
| | | |
| | |
| | | throw new Exception("库位编码 " + sectionCode + " 不存在,请确认!"); |
| | | } |
| | | |
| | | |
| | | // ========== 新增:验证当前库位与物料默认库位是否一致 ========== |
| | | // 获取物料信息 |
| | | var mesItems = Db.Queryable<MesItems>() |
| | | .Where(s => s.Id == itemBarcodeDetails.ItemId) |
| | | .First(); |
| | | |
| | | if (mesItems == null) |
| | | throw new Exception("找不到对应的物料信息!"); |
| | | |
| | | // 检查物料是否有默认库位设置 |
| | | if (!string.IsNullOrEmpty(mesItems.DepotCode)) |
| | | { |
| | | // 获取物料默认库位对应的仓库信息 |
| | | var defaultDepot = Db.Queryable<MesDepots>() |
| | | .Where(d => d.DepotCode == mesItems.DepotCode) |
| | | .First(); |
| | | |
| | | if (mesItems.DepotCode != null && mesItems.DepotCode != "0") |
| | | { |
| | | // 比较当前扫描的库位所属仓库编码与物料默认仓库编码是否一致 |
| | | if (mesDepost.DepotId?.ToString() != mesItems.DepotCode) |
| | | { |
| | | throw new Exception($"当前库位所属仓库[{mesDepost.DepotId}]与物料默认仓库[{mesItems.DepotCode}]不一致,请扫描正确的库位!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //num = Db.Queryable<MesInvItemInCDetails>() |
| | | // .Where(it => it.ItemBarcode == itemBarcode) |
| | |
| | | CreateDate = DateTime.Now, |
| | | LastupdateBy = user, |
| | | LastupdateDate = DateTime.Now, |
| | | UrgentFlag = itemBarcodeDetails.UrgentFlag.Value |
| | | ? "1" |
| | | : "0", |
| | | UrgentFlag = itemBarcodeDetails.UrgentFlag.GetValueOrDefault() ? "1" : "0", |
| | | CbillNo = itemBarcodeDetails.BillNo, |
| | | Fstatus = 0, |
| | | Status = 0, |
| | |
| | | .Where(it => |
| | | it.ItemInId == cId && |
| | | it.ItemId == detail.ItemId && |
| | | it.DepotId == depotCode2 && |
| | | it.DepotId == mesDepost.DepotId.ToString() && |
| | | it.EbelnK3id == detail.EbelnK3id && |
| | | it.LineK3id == detail.LineK3id) |
| | | .Count(); |
| | |
| | | Remark = itemBarcodeDetails.Memo, |
| | | EbelnK3id = detail.EbelnK3id, |
| | | LineK3id = detail.LineK3id, |
| | | DepotId = depotCode2, |
| | | DepotId = mesDepost.DepotId.ToString(), |
| | | itemDabid = itemBarcodeDetails.AboutGuid.ToString() |
| | | }).IgnoreColumns(true).ExecuteCommand(); |
| | | else |
| | |
| | | .Where(it => |
| | | it.ItemInId == cId && |
| | | it.ItemId == detail.ItemId && |
| | | it.DepotId == depotCode2 && |
| | | it.DepotId == mesDepost.DepotId.ToString() && |
| | | it.EbelnK3id == detail.EbelnK3id && |
| | | it.LineK3id == detail.LineK3id) |
| | | .IgnoreColumns(true) |
| | |
| | | .Where(it => |
| | | it.ItemInId == cId && |
| | | it.ItemId == detail.ItemId && |
| | | it.DepotId == depotCode2 && |
| | | it.DepotId == mesDepost.DepotId.ToString() && |
| | | it.EbelnK3id == detail.EbelnK3id && |
| | | it.LineK3id == detail.LineK3id) |
| | | .Count(); |
| | |
| | | EbelnK3id = detail.EbelnK3id, |
| | | LineK3id = detail.LineK3id, |
| | | ItemId = detail.ItemId, |
| | | DepotId = depotCode2 |
| | | DepotId = mesDepost.DepotId.ToString() |
| | | }).IgnoreColumns(true).ExecuteCommand(); |
| | | else |
| | | db.Updateable<MesInvItemInCItems>() |
| | |
| | | .Where(it => |
| | | it.ItemInId == cId && |
| | | it.ItemId == detail.ItemId && |
| | | it.DepotId == depotCode2 && |
| | | it.DepotId == mesDepost.DepotId.ToString() && |
| | | it.EbelnK3id == detail.EbelnK3id && |
| | | it.LineK3id == detail.LineK3id) |
| | | .IgnoreColumns(true) |
| | |
| | | .Where(it => |
| | | it.ItemInId == cId && |
| | | it.ItemId == detailone.ItemId && |
| | | it.DepotId == depotCode2 && |
| | | it.DepotId == mesDepost.DepotId.ToString() && |
| | | it.itemDabid == itemBarcodeDetails.AboutGuid.ToString()) |
| | | .Count(); |
| | | |
| | |
| | | EbelnK3id = itemBarcodeDetails.EbelnK3id, |
| | | LineK3id = itemBarcodeDetails.LineK3id, |
| | | ItemId = itemBarcodeDetails.ItemId, |
| | | DepotId = depotCode2, |
| | | DepotId = mesDepost.DepotId.ToString(), |
| | | itemDabid = itemBarcodeDetails.AboutGuid.ToString() |
| | | }).IgnoreColumns(true).ExecuteCommand(); |
| | | else |
| | |
| | | .Where(it => |
| | | it.ItemInId == cId && |
| | | it.ItemId == detailone.ItemId && |
| | | it.DepotId == depotCode2 && |
| | | it.DepotId == mesDepost.DepotId.ToString() && |
| | | it.itemDabid == itemBarcodeDetails.AboutGuid.ToString()) |
| | | //.IgnoreColumns(true) // 保留 IgnoreColumns |
| | | .ExecuteCommand(); |
| | |
| | | CheckRes = inventoryDetails.CheckRes, |
| | | CheckStates = inventoryDetails.CheckStates, |
| | | ReceiveOrgId = inventory.ReceiveOrgId, |
| | | DepotId = Convert.ToInt64(depotCode2) |
| | | DepotId = Convert.ToInt64(mesDepost.DepotId.ToString()) |
| | | }).IgnoreColumns(true).ExecuteCommand(); |
| | | |
| | | // 插入 mes_inv_business2 表 |
| | |
| | | LineK3id = itemBarcodeDetails.LineK3id, |
| | | ItemId = itemBarcodeDetails.ItemId, |
| | | BillNo = itemBarcodeDetails.BillNo, |
| | | DepotId = Convert.ToInt32(depotCode2), |
| | | DepotId = Convert.ToInt32(mesDepost.DepotId), |
| | | OwnerId = cgddDetails.DemandOrg, |
| | | OwnerType = owner_type, |
| | | StockOrgId = mesDepost.FSubsidiary, |