IPC-610
2024-12-03 2f0120d0c10ac24603936911ee5812d4e71d2740
叠托机组空托盘跺
8个文件已修改
235 ■■■■ 已修改文件
Pda/View/AsnSetting/palletEnter.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Model/InterFaceModel/SoModel.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Model/ModelVm/BllAsnVm/PalletBindVm.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllCheckServer/StockCheckServer.cs 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Wms/Controllers/DownApiController.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Pda/View/AsnSetting/palletEnter.html
@@ -222,6 +222,7 @@
                function bind(){
                    var param = {
                        'PalletNo':$("#PalletNo").val(),
                        'BindType':'0',
                        Qty:Number($("#palletNum").val()),
                        actionType:'add'
                    }
Wms/Model/InterFaceModel/SoModel.cs
@@ -54,6 +54,10 @@
        /// 有效期至【yyyy-MM-dd
        /// </summary>
        public DateTime? expiry { get; set; }
        /// <summary>
        /// 外箱吗【string(100)/非空】
        /// </summary>
        public string no { get; set; }
    }
Wms/Model/ModelVm/BllAsnVm/PalletBindVm.cs
@@ -165,6 +165,7 @@
        public string Standard { get; set; }
        public string PackagNo { get; set; }
        public string BindType { get; set; }
    }
    public class GetOkLocateVm:IndexPage
@@ -193,5 +194,22 @@
        public int LocateId { get; set; }
        
    }
    /// <summary>
    /// 叠托机托盘绑定
    /// </summary>
    public class PalletsBind
    {
        /// <summary>
        /// 托盘号
        /// </summary>
        public string PalletNo { get; set; }
        /// <summary>
        /// 托盘数量
        /// </summary>
        public int Qty { get; set; }
        public string BindType { get; set; }
    }
}
Wms/WMS.BLL/BllCheckServer/StockCheckServer.cs
@@ -1383,19 +1383,26 @@
                            throw new Exception("当前托盘不是拼托出库托盘");
                        }
                        //记录托盘上信息给MES
                        data.Add(new RequertBeiliaoInfoModel()
                        {
                            materiel_no = item.SkuNo,
                            materiel_name = item.SkuName,
                            qty = item.Qty,
                            batch = item.LotNo,
                            producttime = item.ProductionTime,
                            expiry = item.ExpirationTime
                        });
                        //库存箱码明细删除
                        var boxInfo = Db.Queryable<DataBoxInfo>().Where(m => m.IsDel == "0" && m.StockDetailId == item.Id).ToList();
                        if (boxInfo.Count == 0)
                        {
                            throw new Exception("托盘上物料箱码信息不存在,请检查!");
                        }
                        foreach (var item2 in boxInfo)
                        {
                            data.Add(new RequertBeiliaoInfoModel()
                            {
                                no = item2.BoxNo,
                                materiel_no = item.SkuNo,
                                materiel_name = item.SkuName,
                                qty = item.Qty,
                                batch = item.LotNo,
                                producttime = item.ProductionTime,
                                expiry = item.ExpirationTime
                            });
                        }
                        //库存箱码明细删除
                        Db.Deleteable(boxInfo).ExecuteCommand();
                        //删除库存托盘信息
                        Db.Deleteable(item).ExecuteCommand();
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -334,6 +334,7 @@
        public string BindNullPallet(PalletBindVm model)
        {
            string strMsg = "";
            string type = model.BindType == "0" ? "PDA" : "叠托机";
            try
            {
                var datetime = Db.GetDate();
@@ -441,7 +442,7 @@
                    LotText = "",
                    SupplierLot = "",
                    InspectStatus = "1",
                    Origin = "PDA",
                    Origin = type,
                    BoxNo = "",
                    BoxNo2 = "",
                    BoxNo3 = "",
@@ -472,6 +473,120 @@
            }
        }
        // 叠托机绑定空托盘
        public string BindNullPallets(PalletsBind model)
        {
            string strMsg = "";
            string type = model.BindType == "0" ? "PDA" : "叠托机";
            try
            {
                var datetime = Db.GetDate();
                //获取托盘绑定信息
                string str = "select * from BllPalletBind where IsDel = '0' and PalletNo = @palletno and Status = '0' ";
                List<PalletBindVm> list = Db.Ado.SqlQuery<PalletBindVm>(str, new
                {
                    palletno = model.PalletNo //托盘号
                });
                //判断是否已绑定该托盘
                if (list.Count > 0)
                {
                    strMsg = "-1:该托盘已被绑定!";
                    return strMsg;
                }
                if (string.IsNullOrEmpty(model.PalletNo))
                {
                    strMsg = "-1:托盘号不可为空!";
                    return strMsg;
                }
                if (model.Qty == null || model.Qty == 0)
                {
                    strMsg = "-1:空托盘数量不可为空!";
                    return strMsg;
                }
                //获取托盘信息
                var pallet = Db.Queryable<SysPallets>().First(a => a.IsDel == "0" && a.PalletNo == model.PalletNo);
                if (pallet == null)
                {
                    strMsg = "-1:托盘信息为空!";
                    return strMsg;
                }
                if (pallet.Status != "0")
                {
                    strMsg = "-1:该托盘正在使用!";
                    return strMsg;
                }
                Db.BeginTran();
                // 插入托盘绑定表
                var modelpb = new BllPalletBind
                {
                    ASNNo = "",
                    ASNDetailNo = 0,
                    TaskNo = "", //任务号
                    PalletNo = model.PalletNo,
                    Qty = (int)model.Qty,
                    Status = "0", //等待执行
                    Type = "1", //0 物料托 1 空托
                    LotNo = "",
                    LotText = "",
                    SupplierLot = "",
                    InspectMark = "0", //0 否 1 是
                    BitPalletMark = "0",
                    IsBale = "0",
                    IsBelt = "0",
                    CreateTime = Db.GetDate()
                };
                var id = Db.Insertable(modelpb).ExecuteReturnIdentity();
                var modelbb = new BllBoxInfo
                {
                    ASNNo = "",
                    ASNDetailNo = null,
                    BindNo = id,
                    PalletNo = model.PalletNo,
                    Status = "1",
                    CompleteTime = DateTime.Now,
                    Qty = (int)model.Qty,
                    FullQty = null,
                    SkuNo = "100099",
                    SkuName = "托盘",
                    LotNo = "",
                    LotText = "",
                    SupplierLot = "",
                    InspectStatus = "1",
                    Origin = type,
                    BoxNo = "",
                    BoxNo2 = "",
                    BoxNo3 = "",
                    InspectMark = "",
                    BitBoxMark = "0",
                    CreateTime = datetime
                };
                Db.Insertable(modelbb).ExecuteCommand();
                // 更改托盘使用状态
                string sqlStr = string.Empty;
                sqlStr = $"update SysPallets set Status = '1' where PalletNo = '{model.PalletNo}';";
                Db.Ado.ExecuteCommand(sqlStr);
                Db.CommitTran();
                // 插入操作日志
                new OperationASNServer().AddLogOperationAsn("PDA模块", "空托入库", model.PalletNo, "添加", $"在PDA上添加了空托盘跺", 1);
                return strMsg;
            }
            catch (Exception ex)
            {
                Db.Ado.RollbackTran();
                throw ex;
            }
        }
        /// <summary>
        /// 解绑空托盘
        /// </summary>
Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
@@ -1373,6 +1373,7 @@
                {
                    throw new Exception("该托盘未在平库内,请检查!");
                }
                //起始储位信息
                var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == locatNo);
                if (storageLocat == null)
@@ -1416,20 +1417,26 @@
                        {
                            throw new Exception("当前托盘不是拼托出库托盘");
                        }
                        //记录托盘上信息给MES
                        data.Add(new RequertBeiliaoInfoModel()
                        {
                            materiel_no = item.SkuNo,
                            materiel_name = item.SkuName,
                            qty = item.Qty,
                            batch = item.LotNo,
                            producttime = item.ProductionTime,
                            expiry = item.ExpirationTime
                        });
                        //库存箱码明细删除
                        var boxInfo = Db.Queryable<DataBoxInfo>().Where(m => m.IsDel == "0" && m.StockDetailId == item.Id).ToList();
                        if (boxInfo.Count == 0)
                        {
                            throw new Exception("托盘上物料箱码信息不存在,请检查!");
                        }
                        //记录托盘上信息给MES
                        foreach (var item2 in boxInfo) {
                            data.Add(new RequertBeiliaoInfoModel()
                            {
                                no = item2.BoxNo,
                                materiel_no = item.SkuNo,
                                materiel_name = item.SkuName,
                                qty = item.Qty,
                                batch = item.LotNo,
                                producttime = item.ProductionTime,
                                expiry = item.ExpirationTime
                            });
                        }
                        //库存箱码明细删除
                        Db.Deleteable(boxInfo).ExecuteCommand();
                        //删除库存托盘信息
                        Db.Deleteable(item).ExecuteCommand();
Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
@@ -41,6 +41,9 @@
        // 绑定空托盘
        string BindNullPallet(PalletBindVm model);
        // 叠托机绑定空托盘跺
        string BindNullPallets(PalletsBind model);
        /// <summary>
        /// 解绑空托盘
        /// </summary>
Wms/Wms/Controllers/DownApiController.cs
@@ -16,6 +16,7 @@
using System.Collections.Generic;
using Model.ModelVm.PdaVm;
using WMS.IBLL.IPdaServer;
using Model.ModelVm;
namespace Wms.Controllers
{
@@ -32,6 +33,7 @@
        private readonly IStockCheckServer _crCheckSvc;//托盘绑定Svc 
        private readonly ITaskServer _taskSvc;//任务Svc 
        private readonly IPdaSoServer _pdaSoSvc;//空托出库Svc
        private readonly IPdaAsnServer _paAsnSvc;//空托跺绑定
        public DownApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IPalletBindServer asnPalletBindSvc, IStockCheckServer crCheckSvc, ITaskServer taskSvc, IPdaSoServer pdaSoSvc)
        {
@@ -538,6 +540,30 @@
        }
        /// <summary>
        /// WCS申请空托跺绑定
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpPost]
        public IActionResult BindPlnInHouseWcs(PalletsBind model)
        {
            var logStr = $@".\log\WCS\WCS申请空托跺绑定" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
            try
            {
                var strMsg = _paAsnSvc.BindNullPallets(model);
                return Ok(new { Success = 0, Message = "空托跺绑定成功", TaskList = strMsg });
            }
            catch (Exception e)
            {
                LogFile.SaveLogToFile($"WCS申请空托跺绑定异常返回:( {e.Message} ),", logStr);
                return Ok(new ErpModel { Success = -1, Message = e.Message });
            }
        }
        /// <summary>
        /// WCS申请空托出库
        /// </summary>
        /// <param name="model"></param>