yuyou_x
2024-02-21 a339e5234e6299d32672aaae648e5315900c2633
Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
@@ -156,12 +156,20 @@
                switch (model.Type)//0:原料 1:包材 2:成品 3:耗材 4:半成品
                {
                    case "0"://成品入库
                        skuType = "(2)";
                        break;
                    case "3"://退货入库
                        skuType = "(2)";
                        break;
                    case "5"://其它入库
                        skuType = "(0,1,3)";
                        break;
                    case "6"://代储入库
                        skuType = "(2)";
                        break;
                    case "1"://采购入库
                        skuType = "(0,1,3)";
                        break;
                    case "4"://车间余料退回入库
                        skuType = "(0,1,3)";
                        break;
@@ -247,6 +255,15 @@
                    if (string.IsNullOrEmpty(model.Type))
                    {
                        throw new Exception("单据类型不可为空!");
                    }
                }
                //判断是否为采购入库单据或车间余料退回入库
                // 0:成品入库 1:采购入库 2:中间品入库 3:退货入库 4:车间余料退回入库 5:其它入库 6:代储入库 7:寄存入库
                if (model.Type == "1" || model.Type == "4")
                {
                    if (!string.IsNullOrWhiteSpace(model.LotNo))
                    {
                        throw new Exception("采购入库或余料退回不可输入批次,不可编辑!");
                    }
                }
@@ -342,6 +359,18 @@
            string sqlDetailStr = string.Empty;
            try
            {
                //判断是否为采购入库单据或车间余料退回入库
                // 0:成品入库 1:采购入库 2:中间品入库 3:退货入库 4:车间余料退回入库 5:其它入库 6:代储入库 7:寄存入库
                int isType = 0;
                if (model.Type == "1" || model.Type == "4")
                {
                    isType = 1;
                    if (!string.IsNullOrWhiteSpace(model.LotNo))
                    {
                        strMessage = "-1:采购入库或余料退回不可输入批次,不可编辑;";
                        return strMessage;
                    }
                }
                if (model.Origin != "录入")
                {
                    strMessage = "-1:上游系统下发的单据,不可编辑;";
@@ -396,7 +425,7 @@
                        strMessage = "-1:数量必须大于0;";
                        continue;
                    }
                    if (string.IsNullOrEmpty(detailModel.LotNo))
                    if (string.IsNullOrEmpty(detailModel.LotNo) && isType != 1)
                    {
                        strMessage = "-1:批次号不可为空;";
                        continue;
@@ -512,9 +541,10 @@
                sqlString += $"UpdateTime = GETDATE(),UpdateUser = '{model.CreateUser}' ";
                sqlString += $"WHERE ASNNo = '{model.ASNNo}';";
                //判断是否为采购入库单据
                //判断是否为采购入库单据或车间余料退回入库
                // 0:成品入库 1:采购入库 2:中间品入库 3:退货入库 4:车间余料退回入库 5:其它入库 6:代储入库 7:寄存入库
                if (model.Type == "1")
                int notdel = 0;
                if (model.Type == "1" || model.Type == "4")
                {
                    //获取单据生成对应标签
                    var list = Db.Queryable<BllBoxInfo>().Where(a => a.IsDel == "0" && a.Status == "0" && a.BindNo == null);
@@ -529,10 +559,11 @@
                    sqlString += $"UPDATE BllBoxInfo SET IsDel = '1',";
                    sqlString += $"UpdateTime = GETDATE(),UpdateUser = '{model.CreateUser}' ";
                    sqlString += $"WHERE ASNNo = '{model.ASNNo}';";
                    notdel = 1;
                }
                Db.Ado.BeginTran();
                int rowCount = Db.Ado.ExecuteCommand(sqlString);
                if (rowCount < 3)
                if (rowCount < 2 + notdel)
                {
                    Db.RollbackTran();
                    return "-1:删除失败!";
@@ -620,6 +651,11 @@
                //{
                //    throw new Exception("参数异常,请检查状态是否为执行完成");
                //}
                var palletBind = Db.Queryable<BllPalletBind>().Where(m => m.IsDel == "0" && m.Status != "2").ToList();
                if (palletBind != null && palletBind.Count > 0)
                {
                    throw new Exception("存在未入库完成托盘信息,不允许关单");
                }
                var sqlString = "";