| | |
| | | private bool UpdateData(SqlSugarScope db, CgthSq mesWomCgth, |
| | | List<CgthSqDetail> mesWomcabs) |
| | | { |
| | | var decimals = mesWomcabs.Select(s => s.Id).ToArray(); |
| | | //var decimals = mesWomcabs.Select(s => s.Id).ToArray(); |
| | | |
| | | //扫码不允许删除 |
| | | |
| | | throw new NotImplementedException("扫码不允许删除"); |
| | | var hasMaterialOut = db.Queryable<MesInvItemOuts>() |
| | | .Any(x => x.WorkNo == mesWomCgth.BillNo); |
| | | |
| | | if (hasMaterialOut) |
| | | { |
| | | throw new Exception($"MES有领料记录,单号:{mesWomCgth.BillNo},不能删除!"); |
| | | } |
| | | /* |
| | | var update = base.DeleteById(mesWomCgth.Id); |
| | | var insertOrUpdate = db |
| | | .Deleteable<CgthSqDetail>().In(decimals) |
| | | .ExecuteCommand() > 0; |
| | | |
| | | |
| | | if (update && insertOrUpdate) return true; |
| | | if (update && insertOrUpdate) return true;*/ |
| | | // throw new NotImplementedException("更新失败"); |
| | | |
| | | var decimals = mesWomcabs |
| | | ?.Where(x => x.Id.HasValue) |
| | | .Select(x => x.Id.Value) |
| | | .ToArray() ?? new decimal[0]; |
| | | var update = true; |
| | | if (mesWomCgth != null) |
| | | { |
| | | if (mesWomCgth.Id != null) |
| | | { |
| | | update = base.DeleteById(mesWomCgth.Id); |
| | | } |
| | | } |
| | | var insertOrUpdate = true; |
| | | if (decimals != null && decimals.Length > 0) |
| | | { |
| | | insertOrUpdate = db.Deleteable<CgthSqDetail>().In(decimals).ExecuteCommand() > 0; |
| | | } |
| | | |
| | | if (update && insertOrUpdate) |
| | | { |
| | | return true; |
| | | } |
| | | throw new NotImplementedException("更新失败"); |
| | | } |
| | | private bool SaveOrUpdateData(SqlSugarScope db, CgthSq mesWomcaa, |