| | |
| | | public MovesDto ScanInBarcode(WarehouseQuery query) |
| | | { |
| | | if (string.IsNullOrEmpty(query.sectionCode)) |
| | | { |
| | | throw new Exception("请扫库位条码!"); |
| | | } |
| | | |
| | | int pBillTypeId = 300; |
| | | int pTransctionNo = 301; |
| | | var pBillTypeId = 300; |
| | | var pTransctionNo = 301; |
| | | |
| | | var depotQuery = Db.Queryable<MesDepotSections, MesDepots>((a, b) => |
| | | new JoinQueryInfos( |
| | |
| | | .First(); |
| | | |
| | | if (depotQuery == null) |
| | | { |
| | | throw new Exception($"002[库位编码 {query.sectionCode} 不存在,请确认!"); |
| | | } |
| | | |
| | | var cDepotCode = depotQuery.DepotCode; |
| | | |
| | |
| | | .Select((a, b) => new { a.Id, a.BillNo, a.InvDepotsCode }) |
| | | .First(); |
| | | |
| | | if (itemMoveQuery == null) |
| | | { |
| | | throw new Exception("条码未做调拔出库扫码,请核对!"); |
| | | } |
| | | if (itemMoveQuery == null) throw new Exception("条码未做调拔出库扫码,请核对!"); |
| | | |
| | | var cBillNo = itemMoveQuery.BillNo; |
| | | var iDepotCode = itemMoveQuery.InvDepotsCode; |
| | | |
| | | // 验证库区与仓库 |
| | | var depotValidationQuery = Db.Queryable<MesDepotSections, MesDepots>( |
| | | (a, b) => new JoinQueryInfos( |
| | | var depotValidationQuery = Db |
| | | .Queryable<MesDepotSections, MesDepots>((a, b) => |
| | | new JoinQueryInfos( |
| | | JoinType.Inner, a.Zuid.ToString() == b.Zuid)) |
| | | .Where((a, b) => a.DepotSectionCode == query.sectionCode && |
| | | b.DepotCode == iDepotCode) |
| | |
| | | .First(); |
| | | |
| | | if (depotValidationQuery == null) |
| | | { |
| | | throw new Exception($"002[库位编码 {query.sectionCode} 不存在,请确认!"); |
| | | } |
| | | |
| | | if (iDepotCode != depotValidationQuery.DepotCode) |
| | | { |
| | | throw new Exception("实际仓库与申请调入仓库不符,请核对!"); |
| | | } |
| | | |
| | | var barcodeCount = Db.Queryable<MesInvItemMovesCDetails>() |
| | | .Where(b => |
| | |
| | | b.ItemMoveId == itemMoveQuery.Id && b.MoveOk == 1) |
| | | .Count(); |
| | | |
| | | if (barcodeCount > 0) |
| | | { |
| | | throw new Exception("条码调拔已完成,请核对!"); |
| | | } |
| | | if (barcodeCount > 0) throw new Exception("条码调拔已完成,请核对!"); |
| | | |
| | | var barcodeInfo = Db.Queryable<MesInvItemBarcodes>() |
| | | .Where(t => t.ItemBarcode == query.barcode) |
| | | .First(); |
| | | |
| | | if (barcodeInfo == null) |
| | | { |
| | | throw new Exception("条码不存在,请核对!"); |
| | | } |
| | | if (barcodeInfo == null) throw new Exception("条码不存在,请核对!"); |
| | | |
| | | var isAudit = UseTransaction(db => |
| | | { |
| | |
| | | .Where(a => a.ItemMoveId == itemMoveQuery.Id && a.MoveOk == 1) |
| | | .Sum(a => SqlFunc.IsNull(a.Quantity, 0)); |
| | | |
| | | if (totalQuantity == scannedQuantity) |
| | | { |
| | | return 1; |
| | | } |
| | | if (totalQuantity == scannedQuantity) return 1; |
| | | |
| | | return 0; |
| | | }); |
| | | |
| | | MovesDto dto = new MovesDto(); |
| | | var dto = new MovesDto(); |
| | | dto.InAudit = isAudit == 1; |
| | | dto.BarcodesInfo = barcodeInfo; |
| | | return dto; |
| | |
| | | |
| | | public MovesDto GetItems(WarehouseQuery query) |
| | | { |
| | | MovesDto dto = new MovesDto(); |
| | | var dto = new MovesDto(); |
| | | |
| | | dto.BarcodeList = GetItemMovesCDetails(query); |
| | | dto.OutItems = GetItemOutItems(query); |
| | |
| | | private List<MesInvItemMovesCDetails> GetItemMovesCDetails( |
| | | WarehouseQuery query) |
| | | { |
| | | return Db.Queryable<MesInvItemMovesCDetails, MesItems, MesSupplier>( |
| | | (b, c, f) => new JoinQueryInfos( |
| | | JoinType.Left, |
| | | b.ItemNo == c.ItemNo && b.Company == c.Company && |
| | | b.Factory == c.Factory, |
| | | JoinType.Left, b.SuppNo == f.SuppNo |
| | | )) |
| | | return Db |
| | | .Queryable<MesInvItemMovesCDetails, MesItems, |
| | | MesSupplier>((b, c, f) => new JoinQueryInfos( |
| | | JoinType.Left, |
| | | b.ItemNo == c.ItemNo && b.Company == c.Company && |
| | | b.Factory == c.Factory, |
| | | JoinType.Left, b.SuppNo == f.SuppNo |
| | | )) |
| | | .Where((b, c, f) => b.ItemMoveId == query.id) |
| | | .Select((b, c, f) => new MesInvItemMovesCDetails |
| | | { |
| | |
| | | if (mesInvItemMoves == null) |
| | | throw new Exception("出库单 " + query.billNo + "不存在,请确认!"); |
| | | |
| | | var count = Db.Queryable<MesInvItemMoves, MesInvItemMovesCDetails>( |
| | | (a, b) => |
| | | new JoinQueryInfos(JoinType.Inner, a.Id == b.ItemMoveId)) |
| | | var count = Db |
| | | .Queryable<MesInvItemMoves, MesInvItemMovesCDetails>((a, b) => |
| | | new JoinQueryInfos(JoinType.Inner, a.Id == b.ItemMoveId)) |
| | | .Where((a, b) => b.ItemBarcode == query.barcode |
| | | && a.TransactionNo == TransctionNo && |
| | | SqlFunc.IsNull(a.Status, 0) == 0).Count(); |
| | |
| | | if (sumqty > quantity) |
| | | throw new Exception( |
| | | "已扫条码数量或本次扫码数量:" + sumqty + " 大于申请数量:" + quantity + ",请核对!"); |
| | | |
| | | |
| | | UseTransaction(db => |
| | | { |
| | | SaveMesInvItemMovesCDetails(db, query, mesInvItemMoves, |