| | |
| | | } |
| | | else |
| | | { |
| | | var labelCount = label.Where(m => m.ASNDetailNo == imId).ToList(); |
| | | if (labelCount.Count <= 0) |
| | | { |
| | | throw new Exception("当前单据明细还未生成标签,请选择重置批次选项为‘是’;"); |
| | | } |
| | | //var labelCount = label.Where(m => m.ASNDetailNo == imId).ToList(); |
| | | //if (labelCount.Count <= 0) |
| | | //{ |
| | | // throw new Exception("当前单据明细还未生成标签,请选择重置批次选项为‘是’;"); |
| | | //} |
| | | //maxLotNoStr = labelCount.Max(a => a.LotNo); |
| | | maxLotNoStr = asnList.LotNo; |
| | | //if (string.IsNullOrWhiteSpace(maxLotNoStr)) |
| | |
| | | } |
| | | else |
| | | { |
| | | var labelCount = label.Where(m => m.ASNDetailNo == imId).ToList(); |
| | | if (labelCount.Count <= 0) |
| | | { |
| | | throw new Exception("当前单据明细还未生成标签,请选择重置批次选项为‘是’;"); |
| | | } |
| | | //var labelCount = label.Where(m => m.ASNDetailNo == imId).ToList(); |
| | | //if (labelCount.Count <= 0) |
| | | //{ |
| | | // throw new Exception("当前单据明细还未生成标签,请选择重置批次选项为‘是’;"); |
| | | //} |
| | | //maxCodestr2 = labelCount.Max(a => a.LotNo); ; |
| | | maxCodestr2 = asnList.LotNo; |
| | | |
| | |
| | | throw new Exception("当前单据批次的标签已有已使用,不能删除"); |
| | | } |
| | | |
| | | foreach (var item in asnList) |
| | | { |
| | | if (string.IsNullOrWhiteSpace(item.LotNo)) |
| | | { |
| | | continue; |
| | | } |
| | | //foreach (var item in asnList) |
| | | //{ |
| | | // if (string.IsNullOrWhiteSpace(item.LotNo)) |
| | | // { |
| | | // continue; |
| | | // } |
| | | |
| | | item.LotNo = ""; |
| | | Db.Updateable(item).ExecuteCommand(); |
| | | // item.LotNo = ""; |
| | | // Db.Updateable(item).ExecuteCommand(); |
| | | |
| | | } |
| | | //} |
| | | Db.Deleteable(labelList).ExecuteCommand(); |
| | | } |
| | | else //删除固定批次标签 |
| | |
| | | throw new Exception("当前单据批次的标签已有已使用,不能删除"); |
| | | } |
| | | |
| | | foreach (var item in asnList) |
| | | { |
| | | if (string.IsNullOrWhiteSpace(item.LotNo) || item.LotNo!=lotNo) |
| | | { |
| | | continue; |
| | | } |
| | | //foreach (var item in asnList) |
| | | //{ |
| | | // if (string.IsNullOrWhiteSpace(item.LotNo) || item.LotNo!=lotNo) |
| | | // { |
| | | // continue; |
| | | // } |
| | | |
| | | var strList = item.LotNo.Split(";"); |
| | | var updateLotNo = ""; |
| | | foreach (var str in strList) |
| | | { |
| | | if (string.IsNullOrWhiteSpace(str) || str == lotNo) |
| | | { |
| | | continue; |
| | | } |
| | | // var strList = item.LotNo.Split(";"); |
| | | // var updateLotNo = ""; |
| | | // foreach (var str in strList) |
| | | // { |
| | | // if (string.IsNullOrWhiteSpace(str) || str == lotNo) |
| | | // { |
| | | // continue; |
| | | // } |
| | | |
| | | if (string.IsNullOrWhiteSpace(updateLotNo)) |
| | | { |
| | | updateLotNo = str; |
| | | } |
| | | else |
| | | { |
| | | updateLotNo += ";" + str; |
| | | } |
| | | // if (string.IsNullOrWhiteSpace(updateLotNo)) |
| | | // { |
| | | // updateLotNo = str; |
| | | // } |
| | | // else |
| | | // { |
| | | // updateLotNo += ";" + str; |
| | | // } |
| | | |
| | | } |
| | | // } |
| | | |
| | | item.LotNo = updateLotNo; |
| | | Db.Updateable(item).ExecuteCommand(); |
| | | // item.LotNo = updateLotNo; |
| | | // Db.Updateable(item).ExecuteCommand(); |
| | | |
| | | } |
| | | //} |
| | | Db.Deleteable(labelList).ExecuteCommand(); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | //编辑标签数量 |
| | | public void EditLabelQty(int id, string qty, int userId) |
| | | { |
| | | try |
| | | { |
| | | if (string.IsNullOrWhiteSpace(qty)) |
| | | { |
| | | throw new Exception("编辑数量不可为空"); |
| | | } |
| | | var qtyData = 0m; |
| | | var isOk = decimal.TryParse(qty, out qtyData); |
| | | var boxInfo = Db.Queryable<BllBoxInfo>().First(m => m.IsDel == "0" && m.Id == id); |
| | | if (boxInfo == null) |
| | | { |
| | | throw new Exception("未查询到该标签信息"); |
| | | } |
| | | |
| | | if (isOk) |
| | | { |
| | | if (qtyData <= 0) |
| | | { |
| | | throw new Exception("数量不能小于等于0"); |
| | | } |
| | | boxInfo.Qty = qtyData; |
| | | |
| | | Db.Updateable(boxInfo).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("数量转换失败"); |
| | | } |
| | | |
| | | var msg = $"编辑了箱号:{boxInfo.BoxNo}"; |
| | | if (!string.IsNullOrWhiteSpace(boxInfo.BoxNo3)) |
| | | { |
| | | msg += $"、支号:{boxInfo.BoxNo3}"; |
| | | } |
| | | msg += "的标签数量信息"; |
| | | |
| | | new OperationASNServer().AddLogOperationAsn("入库作业", "物料标签", boxInfo.BoxNo, "编辑", msg, userId); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |