| | |
| | | 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("采购入库或余料退回不可输入批次,不可编辑!"); |
| | | } |
| | | } |
| | | |
| | | sqlString += "Insert into BllArrivalNotice (ASNNo,Type,Origin,CustomerNo,"; |
| | | sqlString += "CustomerName,LotNo,LotText,SupplierLot,CreateUser) values ( "; |
| | |
| | | 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:上游系统下发的单据,不可编辑;"; |
| | |
| | | strMessage = "-1:数量必须大于0;"; |
| | | continue; |
| | | } |
| | | if (string.IsNullOrEmpty(detailModel.LotNo)) |
| | | if (string.IsNullOrEmpty(detailModel.LotNo) && isType != 1) |
| | | { |
| | | strMessage = "-1:批次号不可为空;"; |
| | | continue; |
| | |
| | | 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); |
| | |
| | | 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:删除失败!"; |