| | |
| | | |
| | | // 检查库位代码是否为空 |
| | | if (string.IsNullOrEmpty(p_section_code)) |
| | | { |
| | | throw new Exception("002[请扫库位条码!"); |
| | | } |
| | | |
| | | // 查询库区库位信息 |
| | | var depotSection = Db.Queryable<MesDepotSections, MesDepots>((a, b) => |
| | |
| | | |
| | | // 如果库位代码不存在,则返回错误信息 |
| | | if (depotSection == null) |
| | | { |
| | | throw new Exception("库位编码 " + p_section_code + " 不存在,请确认!"); |
| | | } |
| | | |
| | | // 返回成功信息 |
| | | return "仓库:" + depotSection.DepotName + " 库位:" + |
| | |
| | | |
| | | // 检查库位代码是否为空 |
| | | if (string.IsNullOrEmpty(p_section_code)) |
| | | { |
| | | throw new Exception("002[请扫库位条码!"); |
| | | } |
| | | |
| | | // 查询库区库位信息 |
| | | var depotSection = Db.Queryable<MesDepotSections, MesDepots>((a, b) => |
| | |
| | | |
| | | // 如果库位代码不存在,则返回错误信息 |
| | | if (depotSection == null) |
| | | { |
| | | throw new Exception("库位编码 " + p_section_code + " 不存在,请确认!"); |
| | | } |
| | | |
| | | // 检查是否已经收货 |
| | | var c_num = Db.Queryable<MesInvItemIns, MesInvItemInCDetails>((a, b) => |
| | |
| | | .Where((a, b) => b.ItemBarcode == p_item_barcode) |
| | | .Count(); |
| | | |
| | | if (c_num > 0) |
| | | { |
| | | throw new Exception("002[条码重复扫描,请核对!"); |
| | | } |
| | | if (c_num > 0) throw new Exception("002[条码重复扫描,请核对!"); |
| | | |
| | | // 查询条码信息 |
| | | c_num = Db.Queryable<MesInvItemStocks>() |
| | | .Where(t => t.ItemBarcode == p_item_barcode) |
| | | .Count(); |
| | | |
| | | if (c_num > 0) |
| | | { |
| | | throw new Exception("002[条码已在库存中,请核对!"); |
| | | } |
| | | if (c_num > 0) throw new Exception("002[条码已在库存中,请核对!"); |
| | | |
| | | // 查询条码详细信息 |
| | | var c_mes_inv_item_barcodes = Db.Queryable<MesInvItemBarcodes>() |
| | |
| | | .Single(); |
| | | |
| | | if (c_mes_inv_item_barcodes == null) |
| | | { |
| | | throw new Exception("002[条码不存在,请核对!"); |
| | | } |
| | | |
| | | if (c_mes_inv_item_barcodes.ComeFlg != 0) |
| | | { |
| | | throw new Exception("002[条码不是期初条码,无法用期初入库!"); |
| | | } |
| | | |
| | | UseTransaction(db => |
| | | { |
| | |
| | | BillNo = billNo, |
| | | SuppId = c_mes_inv_item_barcodes.SuppId, |
| | | SuppNo = c_mes_inv_item_barcodes.SuppNo, |
| | | UrgentFlag = c_mes_inv_item_barcodes.UrgentFlag == null ? null : c_mes_inv_item_barcodes.UrgentFlag.Value ? "1" : "0", |
| | | UrgentFlag = c_mes_inv_item_barcodes.UrgentFlag == null |
| | | ? |
| | | null |
| | | : c_mes_inv_item_barcodes.UrgentFlag.Value |
| | | ? "1" |
| | | : "0", |
| | | CbillNo = c_mes_inv_item_barcodes.BillNo, |
| | | Fstatus = 0 |
| | | }; |
| | |
| | | ItemNo = c_mes_inv_item_barcodes.ItemNo, |
| | | LotNo = c_mes_inv_item_barcodes.LotNo, |
| | | Quantity = c_mes_inv_item_barcodes.Quantity, |
| | | EpFlag = c_mes_inv_item_barcodes.EpFlag == null ? null : (byte)(c_mes_inv_item_barcodes.EpFlag.Value ? 1 : 0), |
| | | EpFlag = c_mes_inv_item_barcodes.EpFlag == null |
| | | ? null |
| | | : (byte)(c_mes_inv_item_barcodes.EpFlag.Value ? 1 : 0), |
| | | DepotsCode = depotSection.DepotCode, |
| | | DepotsId = depotSection.DepotId, |
| | | DepotSectionsCode = p_section_code, |
| | |
| | | }); |
| | | |
| | | var mesItems = Db.Queryable<MesItems>() |
| | | .Where(s=>s.Id == c_mes_inv_item_barcodes.ItemId) |
| | | .Where(s => s.Id == c_mes_inv_item_barcodes.ItemId) |
| | | .First(); |
| | | |
| | | query.itemNo = mesItems.ItemNo; |