啊鑫
8 天以前 0aa54059b26e6641196e9953490dd18616e916e3
service/Warehouse/MesXsckManager.cs
@@ -1,14 +1,11 @@
using Masuit.Tools;
using MES.Service.Modes;
using System.Data;
using System.Data.SqlClient;
using Masuit.Tools;
using NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.entity.Base;
using NewPdaSqlServer.util;
using SqlSugar;
using SqlSugar.Extensions;
using System.Data;
using System.Data.SqlClient;
namespace NewPdaSqlServer.service.Warehouse;
@@ -30,17 +27,18 @@
        // 获取未完成的退料单号列表
        var parameters = new[]
        {
        new SugarParameter("@pi_orgId", orgId),
        new SugarParameter("@inP1", null),
        new SugarParameter("@inP2", null),
        new SugarParameter("@inP3", null),
        new SugarParameter("@inP4", null)
            new SugarParameter("@pi_orgId", orgId),
            new SugarParameter("@inP1", null),
            new SugarParameter("@inP2", null),
            new SugarParameter("@inP3", null),
            new SugarParameter("@inP4", null)
        };
        try
        {
            // 返回单号字符串列表Get_Qt_ck_List
            var blDetails = Db.Ado.SqlQuery<string>(
                "EXEC prc_pda_xsck_list @pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
                "EXEC prc_pda_xsck_list @pi_orgId,@inP1,@inP2,@inP3,@inP4",
                parameters);
            return blDetails;
        }
        catch (Exception ex)
@@ -53,7 +51,8 @@
    ///     根据发货通知单获取对应代发货明细  prc_rf_pda_scan_zout_showbl
    /// </summary>
    /// <returns>发货通知单明细列表</returns>
    public dynamic GetMesItemFHTZetailByBillNo(dynamic query, dynamic RequestInfo)
    public dynamic GetMesItemFHTZetailByBillNo(dynamic query,
        dynamic RequestInfo)
    {
        if (string.IsNullOrEmpty(query.billNo))
            throw new Exception("请选单据号!");
@@ -71,24 +70,24 @@
        // 获取未完成的发货通知单明细
        var parameters = new[]
{
        new SugarParameter("@billNo", query.billNo),
        new SugarParameter("@pi_orgId",orgId),
        new SugarParameter("@inP1", null),
        new SugarParameter("@inP2", null),
        new SugarParameter("@inP3", null),
        new SugarParameter("@inP4", null)
    };
        {
            new SugarParameter("@billNo", query.billNo),
            new SugarParameter("@pi_orgId", orgId),
            new SugarParameter("@inP1", null),
            new SugarParameter("@inP2", null),
            new SugarParameter("@inP3", null),
            new SugarParameter("@inP4", null)
        };
        try
        {
            List<dynamic>? blDetails = Db.Ado.SqlQuery<dynamic>(
                "EXEC prc_pda_xsck_detailList @billNo,@pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
            var items = blDetails.Where(x => x.DSQty > 0).ToList();    // 待扫物料
            var ysitems = blDetails.Where(x => x.SQty > 0).ToList();   // 已扫物料
            var blDetails = Db.Ado.SqlQuery<dynamic>(
                "EXEC prc_pda_xsck_detailList @billNo,@pi_orgId,@inP1,@inP2,@inP3,@inP4",
                parameters);
            var items = blDetails.Where(x => x.DSQty > 0).ToList(); // 待扫物料
            var ysitems = blDetails.Where(x => x.SQty > 0).ToList(); // 已扫物料
            return new
            {
                items = items,
                ysitems = ysitems
                items, ysitems
            };
        }
        catch (Exception ex)
@@ -99,7 +98,7 @@
    }
    /// <summary>
    /// 生产工单补料扫码
    ///     生产工单补料扫码
    ///     扫描条码  prc_rf_pda_scan_zout_barcode3
    /// </summary>
    /// <param name="query">查询参数</param>
@@ -111,14 +110,15 @@
    ///     - userName: 用户名
    ///     - blNo: 发货通知单号(必填)
    /// </remarks>
    public ProductionPickDto XSCKScanBarcode( WarehouseQuery query)
    public ProductionPickDto XSCKScanBarcode(WarehouseQuery query)
    {
        var _strMsg = "";
        var _intSum = "";
        using (var conn = new SqlConnection(DbHelperSQL.strConn))
        {
            if (query.userName.IsNullOrEmpty()) throw new Exception("用户名不允许为空");
            if (query.daa001.IsNullOrEmpty()) throw new Exception("发货通知单号不允许为空");
            if (query.daa001.IsNullOrEmpty())
                throw new Exception("发货通知单号不允许为空");
            if (query.barcode.IsNullOrEmpty()) throw new Exception("条码不允许为空");
            using (var cmd = new SqlCommand("[prc_pda_XSCK]", conn))
@@ -230,13 +230,9 @@
        var outNoType = "";
        if (query.Type == "生产补料")
        {
            outNoType = "SCBL(生产补料)";
        }
        else
        {
            outNoType = "SCCL(生产超领)";
        }
        // 开启事务处理
        var success = UseTransaction(db =>
@@ -488,7 +484,7 @@
                    Status = 0,
                    DepotId = stockBarcode.DepotId,
                    THORGID = stockBarcode.StockOrgId,
                    OutType = query.Type,
                    OutType = query.Type
                    //BbillNo = query.blNo
                }).IgnoreColumns(true).ExecuteCommand();
            }
@@ -531,7 +527,7 @@
                    PbillNo = query.billNo,
                    ItemId = blDetail.Bld012,
                    DepotId = stockBarcode.DepotId.ToString(),
                    ItemDabid = womdab.Guid,
                    ItemDabid = womdab.Guid
                    // Unit = blDetail.Bld009,
                    // DepotId = (int)stockBarcode.DepotsId
                }).IgnoreColumns(true).ExecuteCommand();
@@ -540,9 +536,9 @@
                executeCommand += db.Updateable<MesInvItemOutItems>()
                    .SetColumns(it => it.TlQty == (it.TlQty ?? 0) + query.Num)
                    .Where(it =>
                    it.ItemOutId == outId &&
                    it.ItemId == stockBarcode.ItemId &&
                    it.DepotId == stockBarcode.DepotId.ToString())
                        it.ItemOutId == outId &&
                        it.ItemId == stockBarcode.ItemId &&
                        it.DepotId == stockBarcode.DepotId.ToString())
                    .ExecuteCommand();
            // 插入出库条码明细
@@ -574,7 +570,7 @@
                ItemId = blDetail.Bld012,
                Unit = blDetail.Bld009,
                DepotId = (int)stockBarcode.DepotsId,
                Dabid = womdab.Guid,
                Dabid = womdab.Guid
            }).IgnoreColumns(true).ExecuteCommand();
            // 插入业务流水
@@ -616,7 +612,8 @@
                    Dab020 = (it.Dab020 ?? 0) + query.Num, // 已发料数量
                    Dab021 = (it.Dab021 ?? 0) + query.Num // 已发料数量
                })
                .Where(it => it.Guid == womdab.Guid && it.Dab003 == womdab.Dab003)
                .Where(it =>
                    it.Guid == womdab.Guid && it.Dab003 == womdab.Dab003)
                .ExecuteCommand();
            // 更新发货通知单明细已补数量
@@ -684,5 +681,4 @@
    }
    #endregion
}