Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
@@ -130,28 +130,26 @@
            try
            {
                string skuType = string.Empty;
                switch(model.Type)//0:原料 1:包材 2:成品 3:耗材 4:半成品
                switch (model.Type)//0:原料 1:包材 2:成品 3:耗材 4:半成品
                {
                    case "0"://成品入库
                    case "3"://退货入库
                    case "5"://其它入库
                    case "6"://代储入库
                        skuType = "(2)";
                        break;
                    case "1"://采购入库
                    case "4"://车间余料退回入库
                        skuType = "(0,1,3)";
                        break;
                    case "2"://中间品入库
                        skuType = "(4)";
                        break;
                    case "3"://退货入库
                        skuType = "(2)";
                    case "7"://寄存入库
                        skuType = "(0,1,2,3,4)";
                        break;
                    case "4"://车间余料退回入库
                        skuType = "(0,1,3)";
                        break;
                    case "5"://其它入库
                        skuType = "(2)";
                        break;
                    case "6"://代储入库
                        skuType = "(2)";
                    default: //其它
                        skuType = "(0,1,2,3,4)";
                        break;
                }
@@ -208,6 +206,9 @@
            string strMessage = "";
            string sqlString = string.Empty;
            string sqlDetailStr = string.Empty;
            //0:成品入库 1:采购入库 2:中间品入库 3:退货入库 4:车间余料入库 5:其它入库 6:代储入库 7:寄存入库
            var TypeLot = "1, 2, 5, 6, 7";
            try
            {
                if (model.Origin == "录入")
@@ -251,8 +252,12 @@
                    }
                    if (string.IsNullOrEmpty(detailModel.LotNo))
                    {
                        strMessage = "-1:批次号不可为空;";
                        continue;
                        //判断是否为不限制批次单据
                        if (!TypeLot.Contains(model.Type))
                        {
                            strMessage = "-1:批次号不可为空;";
                            continue;
                        }
                    }
                    // 判断是否已存在当前明细
                    string sqlCount = $"SELECT COUNT(ID) FROM BllArrivalNoticeDetail where ASNNo = '{model.ASNNo}' ";
@@ -330,7 +335,7 @@
                sqlString = "UPDATE BllArrivalNotice SET ";
                sqlString += $"CustomerNo = '{model.CustomerNo}',CustomerName = '{model.CustomerName}',";
                sqlString += $"LotNo = '{model.LotNo}',LotText = '{model.LotText}',";
                sqlString += $"LotNo = '{model.LotNo}',LotText = '{model.LotText}',";
                sqlString += $"UpdateTime = GETDATE(),UpdateUser = '{model.CreateUser}' ";
                sqlString += $"WHERE ASNNo = '{model.ASNNo}'";
@@ -603,7 +608,7 @@
            }
        }
        //入库单撤销申请
        public void CancelOrder(int id,string reason,int userId)
        public void CancelOrder(int id, string reason, int userId)
        {
            try
            {
@@ -612,29 +617,29 @@
                {
                    throw new Exception("未查询到入库单据信息");
                }
                if (notice.Status!="1" && notice.Status != "2")
                if (notice.Status != "1" && notice.Status != "2")
                {
                    throw new Exception("入库单据状态不是正在执行或执行完成,不能撤销");
                }
                var bind = Db.Queryable<BllPalletBind>().Where(m => m.IsDel == "0" && m.ASNNo == notice.ASNNo).ToList();
                if (bind.Count==0)
                if (bind.Count == 0)
                {
                    throw new Exception("未查询到入库单据的托盘绑定信息");
                }
                if (bind.Count(m=>m.Status== "1")>0)
                if (bind.Count(m => m.Status == "1") > 0)
                {
                    throw new Exception("当前入库单据的托盘绑定信息有正在执行的,请稍后完成后再撤销");
                }
                var auditLog = Db.Queryable<BllAuditLog>().Where(m => m.IsDel == "0" && m.Status == "0");
                var boxInfo = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.ASNNo == notice.ASNNo);
                if (auditLog.Count(m=>m.OrderNo == notice.ASNNo)>0)
                if (auditLog.Count(m => m.OrderNo == notice.ASNNo) > 0)
                {
                    throw new Exception("当前入库单据已有撤销审核,请等待审核完成");
                }
                var startStatusName = "";
                var endStatusName = "";
@@ -649,7 +654,7 @@
                        endStatusName = "正在执行";
                        break;
                    default:
                        throw new Exception("单据状态错误");
                        throw new Exception("单据状态错误");
                }
                var palletStr = "";
@@ -657,16 +662,16 @@
                var msgL = "";
                foreach (var item in bind)
                {
                    if (auditLog.Count(m=>m.OrderNo ==item.ASNNo && m.PalletNo.Contains(item.PalletNo)) >0)
                    if (auditLog.Count(m => m.OrderNo == item.ASNNo && m.PalletNo.Contains(item.PalletNo)) > 0)
                    {
                        continue;
                    }
                    if (!palletStr.Contains(item.PalletNo))
                    {
                        palletStr += item.PalletNo+";";
                        palletStr += item.PalletNo + ";";
                    }
                    var info = boxInfo.First(m => m.BindNo == item.Id);
                    if (!msgS.Contains(info.SkuNo))
                    {
@@ -695,7 +700,7 @@
                    IsDel = "0",
                    CreateUser = userId,
                    CreateTime = time
                };
                };
                Db.Insertable(log).ExecuteCommand();
                new OperationASNServer().AddLogOperationAsn("入库作业", "入库单据", notice.ASNNo, "添加", $"添加了单据号为{notice.ASNNo}的单据撤销申请", userId);
            }
@@ -729,7 +734,7 @@
                {
                    //添加操作日志
                    new OperationASNServer().AddLogOperationAsn("入库作业", "入库单据", notice.ASNNo, "编辑", $"编辑了单据号为{notice.ASNNo}的备注信息", userId);
                }
                }
            }
            catch (Exception ex)
            {
@@ -926,5 +931,5 @@
        #endregion
    }
}