啊鑫
2024-08-16 21d72e7e8765511977efc0b034d474148e385efa
MES.Service/service/Warehouse/MesInvItemMovesManager.cs
@@ -15,12 +15,10 @@
    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(
@@ -30,9 +28,7 @@
            .First();
        if (depotQuery == null)
        {
            throw new Exception($"002[库位编码 {query.sectionCode} 不存在,请确认!");
        }
        var cDepotCode = depotQuery.DepotCode;
@@ -48,10 +44,7 @@
            .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;
@@ -66,14 +59,10 @@
            .First();
        if (depotValidationQuery == null)
        {
            throw new Exception($"002[库位编码 {query.sectionCode} 不存在,请确认!");
        }
        if (iDepotCode != depotValidationQuery.DepotCode)
        {
            throw new Exception("实际仓库与申请调入仓库不符,请核对!");
        }
        var barcodeCount = Db.Queryable<MesInvItemMovesCDetails>()
            .Where(b =>
@@ -81,19 +70,13 @@
                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 =>
        {
@@ -140,15 +123,12 @@
                .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;
@@ -180,7 +160,7 @@
    public MovesDto GetItems(WarehouseQuery query)
    {
        MovesDto dto = new MovesDto();
        var dto = new MovesDto();
        dto.BarcodeList = GetItemMovesCDetails(query);
        dto.OutItems = GetItemOutItems(query);
@@ -287,7 +267,7 @@
        if (sumqty > quantity)
            throw new Exception(
                "已扫条码数量或本次扫码数量:" + sumqty + " 大于申请数量:" + quantity + ",请核对!");
        UseTransaction(db =>
        {
            SaveMesInvItemMovesCDetails(db, query, mesInvItemMoves,