111
啊鑫
2 天以前 971e03ccbe5124d4761f56e71025453d1d4742bc
111
已修改2个文件
131 ■■■■ 文件已修改
service/Warehouse/MesInvItemInCDetailsManager.cs 112 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/base/WmsBaseMangeer.cs 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/Warehouse/MesInvItemInCDetailsManager.cs
@@ -17,6 +17,16 @@
    public ItemInBaseModel SaveBarCodes(WarehouseQuery entity)
    {
        // 参数验证
        if (entity == null)
            throw new ArgumentNullException(nameof(entity), "参数对象不能为空");
        if (string.IsNullOrEmpty(entity.userName))
            throw new ArgumentException("用户名不能为空", nameof(entity.userName));
        if (string.IsNullOrEmpty(entity.barcode))
            throw new ArgumentException("条码不能为空", nameof(entity.barcode));
        string functionName = "采购入库", fieldName = null, inFieldVal = null;
        string user = entity.userName,
            sectionCode = entity.sectionCode,
@@ -29,22 +39,32 @@
        if (string.IsNullOrEmpty(sectionCode))
            throw new Exception("请扫库位条码!");
        var itemBarcodeDetails = Db.Queryable<MesInvItemBarcodes>()
        MesInvItemBarcodes itemBarcodeDetails;
        try
        {
            itemBarcodeDetails = Db.Queryable<MesInvItemBarcodes>()
            .Where(it => it.ItemBarcode == itemBarcode)
            .First();
        if (itemBarcodeDetails == null)
        }
        catch
        {
            throw new Exception("条码不存在,请核对!");
        }
        if (string.IsNullOrEmpty(itemBarcodeDetails.Memo) || itemBarcodeDetails.Memo != "采购入库")
            throw new Exception("此条码不属于到货条码,无法用采购入库!");
        var inventory = Db.Queryable<MesInvItemArn>()
        MesInvItemArn inventory;
        try
        {
            inventory = Db.Queryable<MesInvItemArn>()
            .Where(it => it.BillNo == itemBarcodeDetails.BillNo && it.Fstatus == true )
            .First();
        if (inventory == null)
        }
        catch
        {
            throw new Exception("此条码找不到对应收货单或未审核!");
        }
        // var inventoryDetails = Db.Queryable<MesInvItemArnDetail>()
        //     .Where(it => it.ParentGuid == inventory.Guid
@@ -53,47 +73,76 @@
        //                  && it.Ebeln == itemBarcodeDetails.WorkNo)
        //     .First();
        var inventoryDetails = Db.Queryable<MesInvItemArnDetail>()
        MesInvItemArnDetail inventoryDetails;
        try
        {
            inventoryDetails = Db.Queryable<MesInvItemArnDetail>()
            .Where(it => it.Guid == itemBarcodeDetails.AboutGuid)
            .First();
        }
        catch
        {
            throw new Exception("此条码找不到对应收货单明细!");
        }
        var cgddDetails = Db.Queryable<MesRohInData>()
        MesRohInData cgddDetails;
        try
        {
            cgddDetails = Db.Queryable<MesRohInData>()
            .Where(it => it.EbelnK3id == inventoryDetails.LineK3id)
            .First();
        if (cgddDetails == null)
        }
        catch
        {
            throw new Exception("此条码找不到对应采购订单明细!");
        if (inventoryDetails == null)
            throw new Exception("此条码找不到对应收货单明细!");
        }
        //获取到货检验明细
        var sqlParams = new List<SugarParameter> { new("@dhmxGuid", itemBarcodeDetails.AboutGuid) };
        var sql1 = @"SELECT *FROM v_dhmx WHERE dhmxGuid = @dhmxGuid ";
        var dhjymx = Db.Ado.SqlQuery<vDhmx>(sql1, sqlParams).First();
        vDhmx dhjymx;
        try
        {
            dhjymx = Db.Ado.SqlQuery<vDhmx>(sql1, sqlParams).First();
        }
        catch
        {
            throw new Exception("该条码找不到对应的检验明细!");
        }
        //判定检验能否入库
        if (dhjymx.CanStore!= 1)
        {
            throw new Exception($"该条码对应的收料单检验结果:【{dhjymx.InspectionResult}】,判定结果:【{dhjymx.JudgmentResult}】,处理意见:【{dhjymx.HandlingSuggestion}】,无法入库");
        }
        var depotCode = Db.Queryable<MesDepotSections>()
        string depotCode;
        try
        {
            depotCode = Db.Queryable<MesDepotSections>()
            .Where(it => it.DepotSectionCode == sectionCode)
            .Select(it => it.DepotGuid)
            .First();
        var depotCode2 = Db.Queryable<MesInvItemArn>()
            .Where(it => it.BillNo == itemBarcodeDetails.BillNo)
            .Select(it => it.DepotsId)
            .First();
        }
        catch
        {
            throw new Exception("库位编码 " + sectionCode + " 不存在,请确认!");
        }
        MesDepots mesDepost = null;
        var checkGuid = UtilityHelper.CheckGuid(depotCode);
        if (checkGuid && depotCode != null)
        {
            try
            {
            mesDepost = Db.Queryable<MesDepots>()
                .Where(s => s.DepotId.ToString() == depotCode).First();
                    .Where(s => s.Guid == depotCode).First();
            }
            catch
            {
                throw new Exception("库位编码 " + sectionCode + " 对应的仓库不存在,请确认!");
            }
            // if (depotCode != mesDepost.Guid)
            //     throw new Exception("扫描库位与采购入库库位不一致!");
@@ -130,6 +179,9 @@
            billNo: "", // 根据实际单据号传值
            transactionNo: "101" // 事务类型与存储过程匹配
        );
        if (checkResult == null)
            throw new Exception("入库校验失败:返回结果为空");
        if (Convert.ToInt32(checkResult.result) < 1)
            throw new Exception($"入库校验失败:{checkResult.strMsg}");
@@ -214,7 +266,8 @@
                    it.Guid,
                    it.BillNo
                })
                .First();
                .ToList()
                .FirstOrDefault();
            var cId = Guid.Empty;
            string cBillNo = null;
@@ -230,8 +283,16 @@
                cId = Guid.NewGuid();
                cBillNo = BillNo.GetBillNo("CGRK(采购入库)");
                var suppNo = db.Queryable<MesSupplier>()
                MesSupplier suppNo;
                try
                {
                    suppNo = db.Queryable<MesSupplier>()
                    .Where(s => s.Id.ToString() == inventory.SuppId).First();
                }
                catch
                {
                    throw new Exception("找不到对应的供应商信息!");
                }
                db.Insertable(new MesInvItemIns
                {
@@ -259,7 +320,10 @@
                }).IgnoreColumns(true).ExecuteCommand();
            }
            cSyQty = itemBarcodeDetails.Quantity.Value;
            cSyQty = itemBarcodeDetails.Quantity ?? 0;
            if (cSyQty <= 0)
                throw new Exception("条码数量无效,请检查条码信息!");
            entity.id = cId.ToString();
            entity.PageIndex = 1;
service/base/WmsBaseMangeer.cs
@@ -31,6 +31,20 @@
            string barcode, string sectionCode, string stockId, string stockOrgId,
            string billNo, string transactionNo)
        {
            // 参数验证
            if (string.IsNullOrEmpty(edtUserNo))
                throw new ArgumentException("操作人工号不能为空", nameof(edtUserNo));
            if (string.IsNullOrEmpty(barcode))
                throw new ArgumentException("物料条码不能为空", nameof(barcode));
            if (string.IsNullOrEmpty(sectionCode))
                throw new ArgumentException("库位编码不能为空", nameof(sectionCode));
            if (string.IsNullOrEmpty(stockId))
                throw new ArgumentException("仓库ID不能为空", nameof(stockId));
            if (string.IsNullOrEmpty(stockOrgId))
                throw new ArgumentException("库存组织ID不能为空", nameof(stockOrgId));
            if (string.IsNullOrEmpty(transactionNo))
                throw new ArgumentException("事务类型不能为空", nameof(transactionNo));
            var outputMsg = "";
            var outputStatus = -1;
@@ -46,7 +60,7 @@
                    new("@pi_sectionCode", SqlDbType.NVarChar, 100) { Value = sectionCode },
                    new("@pi_stockId", SqlDbType.NVarChar, 100) { Value = stockId },
                    new("@pi_stockOrgId", SqlDbType.NVarChar, 100) { Value = stockOrgId },
                    new("@pi_billno", SqlDbType.NVarChar, 100) { Value = billNo },
                    new("@pi_billno", SqlDbType.NVarChar, 100) { Value = string.IsNullOrEmpty(billNo) ? DBNull.Value : billNo },
                    new("@pi_transaction_no", SqlDbType.NVarChar, 10) { Value = transactionNo },
                    new("@pi_val1", SqlDbType.NVarChar, 100) { Value = DBNull.Value }, // 预留扩展字段
                    new("@pi_val2", SqlDbType.NVarChar, 100) { Value = DBNull.Value }, // 预留扩展字段
@@ -122,8 +136,9 @@
        /// <returns>货主类型(BD_OwnerOrg/BD_Customer/BD_Supplier)</returns>
        public string GetOwnerType(string ownerId)
        {
            // 如果 ownerId 为空,返回默认的货主类型
            if (string.IsNullOrEmpty(ownerId))
                throw new ArgumentNullException(nameof(ownerId));
                return "BD_OwnerOrg"; // 默认为组织类型
            if (Db.Queryable<SysOrganization>().Any(x => x.Fid == ownerId))
            {