wxw
2025-03-27 ee4806a4b2ec94ec63b4cb9b58447d9863baebe5
Wms/WMS.BLL/SysServer/PalletsServer.cs
@@ -120,7 +120,7 @@
        /// <param name="locatNo"></param>
        /// <param name="userId"></param>
        /// <exception cref="Exception"></exception>
        public void AddPallets(string palletNo,string locatNo,int userId)
        public void AddPallets(string palletNo,string locatNo, string deviceCode, int userId)
        {
            var db = DataContext.Db;
            try
@@ -155,6 +155,26 @@
                if (!areaModel.AreaName.Contains("净桶"))
                {
                    throw new Exception("新添加的桶只能绑定净桶区");
                }
                if (!string.IsNullOrEmpty(deviceCode))
                {
                    var areaInfo = db.Queryable<SysStorageArea>().First(w => w.IsDel == "0" && w.DeviceCode.Contains(deviceCode));
                    if (areaInfo == null)
                    {
                        throw new Exception("未查到设备所属区域信息");
                    }
                    //125设备是接料和混料一体机
                    if (deviceCode != "125")
                    {
                        if (!areaInfo.AreaName.Contains("接料设备"))
                        {
                            throw new Exception("只能绑定接料设备");
                        }
                        if (areaInfo.WareHouseNo != "M03")
                        {
                            throw new Exception("只有大单体车间才能绑定设备");
                        }
                    }
                }
                //开启事务
                db.BeginTran();
@@ -200,9 +220,12 @@
                    PalletStatus = "0",//净桶
                    UDF1 = deviceCode,
                    IsDel = "0",
                    CreateUser = userId,
                    CreateTime = comTime
                    CreateTime = comTime,
                    UpdateTime=comTime,
                };
                //插入库存明细
                db.Insertable(model).ExecuteCommand();