| | |
| | | using NewPdaSqlServer.DB; |
| | | using NewPdaSqlServer.Dto.service; |
| | | using NewPdaSqlServer.entity; |
| | | using NewPdaSqlServer.service.@base; |
| | | using NewPdaSqlServer.util; |
| | | using SqlSugar; |
| | | |
| | |
| | | var p_transction_no = 601; |
| | | |
| | | // 检查库位代码是否为空 |
| | | if (string.IsNullOrEmpty(p_section_code)) |
| | | throw new Exception("002[请扫库位条码!"); |
| | | // if (string.IsNullOrEmpty(p_section_code)) |
| | | // throw new Exception("002[请扫库位条码!"); |
| | | |
| | | // 查询库区库位信息 |
| | | var depotSection = Db.Queryable<MesDepotSections, MesDepots>((a, b) => |
| | |
| | | .Single(); |
| | | |
| | | // 如果库位代码不存在,则返回错误信息 |
| | | if (depotSection == null) |
| | | throw new Exception("库位编码 " + p_section_code + " 不存在,请确认!"); |
| | | // if (depotSection == null) |
| | | // throw new Exception("库位编码 " + p_section_code + " 不存在,请确认!"); |
| | | |
| | | // 检查是否已经收货 |
| | | var c_num = Db.Queryable<MesInvItemIns, MesInvItemInCDetails>((a, b) => |
| | | new JoinQueryInfos( |
| | | JoinType.Inner, a.Guid == b.ItemInId |
| | | )) |
| | | .Where((a, b) => b.ItemBarcode == p_item_barcode) |
| | | .Count(); |
| | | // var c_num = Db.Queryable<MesInvItemIns, MesInvItemInCDetails>((a, b) => |
| | | // new JoinQueryInfos( |
| | | // JoinType.Inner, a.Guid == b.ItemInId |
| | | // )) |
| | | // .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(); |
| | | // 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>() |
| | | .Where(t => t.ItemBarcode == p_item_barcode) |
| | | .Single(); |
| | | |
| | | if (c_mes_inv_item_barcodes == null) |
| | | throw new Exception("002[条码不存在,请核对!"); |
| | | // if (c_mes_inv_item_barcodes == null) |
| | | // throw new Exception("002[条码不存在,请核对!"); |
| | | |
| | | if (c_mes_inv_item_barcodes.ComeFlg != 0) |
| | | if (c_mes_inv_item_barcodes.Memo != "期初") |
| | | throw new Exception("002[条码不是期初条码,无法用期初入库!"); |
| | | |
| | | var wmsManager = new WmsBaseMangeer(); |
| | | // 新增入库校验(调用存储过程) |
| | | var checkResult = wmsManager.pdaInvJY( |
| | | db: Db, |
| | | edtUserNo: query.userName, |
| | | barcode: p_item_barcode, |
| | | sectionCode: p_section_code, |
| | | stockId: depotSection.DepotId.ToString(), |
| | | stockOrgId: depotSection.FSubsidiary, |
| | | billNo: "", // 根据实际单据号传值 |
| | | transactionNo: "601" // 事务类型与存储过程匹配 |
| | | ); |
| | | |
| | | if (checkResult.result < "1") |
| | | throw new Exception($"入库校验失败:{checkResult.strMsg}"); |
| | | |
| | | UseTransaction(db => |
| | | { |
| | |
| | | CbillNo = c_mes_inv_item_barcodes.BillNo, |
| | | Fstatus = 0, |
| | | ReceiveOrgId = depotSection.FSubsidiary, |
| | | InType = "期初入库", |
| | | }; |
| | | db.Insertable(newMesInvItemIns) |
| | | .IgnoreColumns(true) |