bklLiudl
2024-08-28 260c6e54c4f100ca49376a6afd70f73843868171
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -892,7 +892,7 @@
                #endregion
                #region 地码信息(储位信息)
                var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == model.LocatNo && w.Status == "0" && w.WareHouseNo == "W02");
                var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == model.LocatNo && w.Status == "0");
                if (storageLocat == null)
                {
                    strMsg = "-1:储位信息不存在或非空闲状态,请核查!";
@@ -4582,6 +4582,18 @@
            var bindId = 0;
            if (bind == null)
            {
                DateTime? pTime = null;
                DateTime? eTime = null;
                if (!string.IsNullOrWhiteSpace(detail.Lot1))
                {
                    pTime = DateTime.Parse(detail.Lot1);
                }
                if (!string.IsNullOrWhiteSpace(detail.Lot2))
                {
                    eTime = DateTime.Parse(detail.Lot2);
                }
                bind = new BllPalletBind
                {
                    ASNNo = model.AsnNo,
@@ -4597,6 +4609,8 @@
                    SupplierLot = detail.SupplierLot,
                    //InspectMark = model.IsSample,      //是否取样托盘  后期业务开发时 接口传值需添加对应字段判断
                    //SamplingQty = 0,     //取样数量  后期业务开发时 接口传值需添加对应字段判断
                    ProductionTime = pTime,
                    ExpirationTime = eTime,
                    BitPalletMark = "1",
                    IsBale = "0",
                    IsBelt = "0",
@@ -4652,6 +4666,12 @@
            }
            else
            {
                string inspectStatusStr = "0";
                if (sku.IsInspect == "1")
                {
                    inspectStatusStr = "1";
                }
                // 库存不存在 插入数据
                sd1 = new DataStockDetail()
                {
@@ -4680,7 +4700,7 @@
                    ExpirationTime = bind.ExpirationTime,
                    Status = "0",
                    InspectMark = bind.InspectMark,
                    InspectStatus = sku.IsInspect,
                    InspectStatus = inspectStatusStr,
                    BitPalletMark = bind.BitPalletMark,
                    PackagNo = detail.PackagNo,                    //liudl 由sku的包装编号变为入库单明细的包装编码       
                    IsBale = bind.IsBale,
@@ -4870,9 +4890,6 @@
            sqlStr += $"insert into LogPalletTrack values('{model.PalletNo}','{model.AsnNo}','组盘','0',getDate(),{userId},NULL,NULL);";
            Db.Ado.ExecuteCommand(sqlStr);
            new OperationASNServer().AddLogOperationAsn("PDA模块", "托盘绑定", model.AsnNo, "添加", $"添加了托盘码为:{model.PalletNo}的组盘信息", userId);
        }
        #endregion
@@ -4922,7 +4939,7 @@
                #endregion
                #region 地码信息(储位信息)
                var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == model.LocatNo && w.Status == "0" && w.WareHouseNo == "W02");
                var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == model.LocatNo && w.Status == "0");
                if (storageLocat == null)
                {
                    throw new Exception("储位信息不存在或非空闲状态,请核查!");
@@ -5153,7 +5170,7 @@
                        SendDate = serverTime,  //发送时间
                        BackDate = serverTime,  //返回时间
                        StartLocat = "",//起始位置
                        EndLocat = "力诺平库",//目标位置
                        EndLocat = "平库",//目标位置
                        PalletNo = bindInfo.PalletNo,//托盘码
                        IsSend = 0,//是否可再次下发
                        IsCancel = 0,//是否可取消
@@ -5161,7 +5178,7 @@
                        Type = "0",//任务类型 0 入库任务 1 出库任务  2 移库任务
                        Status = "2",//任务状态0:等待执行1正在执行2执行完成
                        OrderType = "0",//0 入库单 1 出库单  2 盘点单  3 移库单
                        Msg = "力诺平库的入库任务",
                        Msg = "平库的入库任务",
                    };
                    Db.Insertable(exTask).ExecuteCommand();
@@ -5175,6 +5192,27 @@
                    bindInfo.TaskNo = taskNo; //任务号
                    Db.Updateable(bindInfo).ExecuteCommand();
                    #endregion
                   /* #region 添加托盘上架记录
                    var upShelf = new BllPalletUpShelf()
                    {
                        TaskNo = exTask.TaskNo,
                        TraceNo = bindInfo.ASNNo,
                        PalletNo = bindInfo.PalletNo,
                        SkuNo = stockModel.SkuNo,
                        SkuName = stockModel.SkuName,
                        LotNo = stockModel.LotNo,
                        Status = "1",
                        WareHouseNo = bindInfo.WareHouseNo,
                        RoadwayNo = bindInfo.RoadwayNo,
                        AreaNo = "",
                        LocatNo = "",
                        CreateUser = 0,
                    };
                    Db.Insertable(upShelf).ExecuteCommand();
                    #endregion*/
                    #region 库存箱支明细表
                    // 插入新组的箱支信息
@@ -5241,11 +5279,13 @@
                    //修改库存明细信息
                    foreach (var item in stockDetail)
                    {
                        item.Status = "0"; //状态更改为待分配
                        item.WareHouseNo = "W02"; //所属仓库
                        item.LocatNo = model.LocatNo;//储位地址
                        item.UpdateTime = serverTime; //修改时间
                        item.UpdateUser = model.CreateUser; //修改人
                        item.Status = "0";                                  // 状态更改为待分配
                        item.WareHouseNo = storageLocat.WareHouseNo;        // 所属仓库
                        item.RoadwayNo = storageLocat.RoadwayNo;            // 所属巷道
                        item.AreaNo = storageLocat.AreaNo;                  // 所属区域
                        item.LocatNo = model.LocatNo;                       // 储位地址
                        item.UpdateTime = serverTime;                       // 修改时间
                        item.UpdateUser = model.CreateUser;                 // 修改人
                        //修改库存明细信息                                           
                        Db.Updateable(item).ExecuteCommand();
                    }
@@ -5271,7 +5311,7 @@
                        SendDate = DateTime.Now,  //发送时间
                        BackDate = DateTime.Now,  //返回时间
                        StartLocat = "",//起始位置
                        EndLocat = "牧原平库",//目标位置
                        EndLocat = "平库",//目标位置
                        PalletNo = model.PalletNo,//托盘码
                        IsSend = 0,//是否可再次下发
                        IsCancel = 0,//是否可取消
@@ -5279,21 +5319,44 @@
                        Type = "0",//任务类型 0 入库任务 1 出库任务  2 移库任务
                        Status = "2",//任务状态0:等待执行1正在执行2执行完成
                        OrderType = "3",//0 入库单 1 出库单  2 盘点单  3 移库单
                        Msg = "牧原平库的入库任务",
                        Msg = "平库的入库任务",
                    };
                    Db.Insertable(exTask).ExecuteCommand();
                    //托盘绑定信息
                    var bindInfo = Db.Queryable<BllPalletBind>().First(w => w.IsDel == "0" && w.PalletNo == model.PalletNo && w.Status == "2" && string.IsNullOrEmpty(w.LocatNo));
                    var bindInfo = Db.Queryable<BllPalletBind>().First(w => w.IsDel == "0" && w.PalletNo == model.PalletNo
                    && w.Status == "2" && string.IsNullOrEmpty(w.LocatNo));
                    if (bindInfo != null)
                    {
                        bindInfo.WareHouseNo = "W02";//所属仓库
                        bindInfo.LocatNo = model.LocatNo;//储位地址
                        bindInfo.WareHouseNo = storageLocat.WareHouseNo;            // 所属仓库
                        bindInfo.RoadwayNo = storageLocat.RoadwayNo;                // 所属巷道
                        bindInfo.LocatNo = model.LocatNo;                           // 储位地址
                        bindInfo.UpdateTime = serverTime;
                        bindInfo.UpdateUser = model.CreateUser;
                        bindInfo.CompleteTime = serverTime; //完成时间
                        bindInfo.TaskNo = taskNo; //任务号
                        bindInfo.CompleteTime = serverTime;                         // 完成时间
                        bindInfo.TaskNo = taskNo;                                   // 任务号
                        Db.Updateable(bindInfo).ExecuteCommand();
                    }
                    #endregion
                    #region 添加托盘上架记录
                    var palletupinfo = stockDetail.First();
                    var upShelf = new BllPalletUpShelf()
                    {
                        TaskNo = exTask.TaskNo,
                        TraceNo = bindInfo.ASNNo,
                        PalletNo = bindInfo.PalletNo,
                        SkuNo = palletupinfo.SkuNo,
                        SkuName = palletupinfo.SkuName,
                        LotNo = palletupinfo.LotNo,
                        Status = "2",
                        LocatNo = model.LocatNo,
                        WareHouseNo = bindInfo.WareHouseNo,
                        RoadwayNo = bindInfo.RoadwayNo,
                        AreaNo = storageLocat.AreaNo,
                        CreateUser = 0,
                    };
                    Db.Insertable(upShelf).ExecuteCommand();
                    #endregion
                }
                storageLocat.Status = "1";//状态已使用
@@ -5302,7 +5365,8 @@
                //修改储位信息                                        
                Db.Updateable(storageLocat).ExecuteCommand();
                new OperationASNServer().AddLogOperationAsn("PDA模块", "平库入库", model.PalletNo, "完成", $"在PDA上完成单据号为:{model.ASNNo}的托盘码为:{model.PalletNo}的平库入库操作", (int)model.CreateUser);
                new OperationASNServer().AddLogOperationAsn("PDA模块", "平库入库", model.PalletNo, "完成",
                    $"在PDA上完成单据号为:{model.ASNNo}的托盘码为:{model.PalletNo}的平库入库操作", (int)model.CreateUser);
                Db.CommitTran();
            }
            catch (Exception ex)