南骏 池
2025-05-16 a04ee7ab3b4cb4e4bb73cda632233f043e7422f9
service/Warehouse/MesBarCFManager.cs
@@ -1,6 +1,7 @@
using System.Data;
using System.Data.SqlClient;
using Masuit.Tools;
using Masuit.Tools.Hardware;
using NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
@@ -13,22 +14,29 @@
{
    public MesInvItemStocks GetBarInfo(WarehouseQuery unity)
    {
        return Db.Queryable<MesInvItemStocks>()
        var barInfo =  Db.Queryable<MesInvItemStocks>()
            .Where(s => s.ItemBarcode == unity.barcode)
            .First(); // 返回第一行数据,如果没有则返回 null
            .First();
        if (barInfo is null) throw new Exception("该条码库存不存在!");
        return barInfo; // 返回第一行数据,如果没有则返回 null
    }
    public MesItems GetItemNo(decimal strItemId)
    {
        return Db.Queryable<MesItems>()
            .Where(s => s.Id == strItemId)
        var itemInfo = Db.Queryable<MesItems>()
            .Where(s => s.Id == strItemId && s.Fforbidstatus == "A")
            .First();
        if (itemInfo is null) throw new Exception("该条码对应物料信息不存在或已禁用!");
        return itemInfo;
    }
    public string BarCF(WarehouseQuery unity)
    public ProductionPickDto BarCF(WarehouseQuery unity)
    {
        var _strMsg = "";
        var _intSum = "";
        var _cfBar = "";//拆分后条码
        using (var conn = new SqlConnection(DbHelperSQL.strConn))
        {
            if (unity.userName.IsNullOrEmpty()) throw new Exception("用户名不允许为空");
@@ -60,11 +68,23 @@
                    cmd.ExecuteNonQuery();
                    _strMsg = parameters[0].Value.ToString();
                    _intSum = parameters[1].Value.ToString();
                    _cfBar = parameters[2].Value.ToString();
                    var result = Convert.ToInt32(_intSum);
                    if (result <= 0) throw new Exception(_strMsg);
                    return _strMsg;
                    var dto = new ProductionPickDto
                    {
                        barcode = unity.barcode,//原条码
                        cfBarcode = _cfBar//拆分后条码
                    };
                    return dto;
                    //var result = Convert.ToInt32(_intSum);
                    //if (result <= 0) throw new Exception(_strMsg);
                    //return _strMsg;
                    //return 0;