| | |
| | | { |
| | | switch (rohInErpRohIn.Type) |
| | | { |
| | | case "2": |
| | | return InsertData(db, mesRohIn, mesRohInDatas, |
| | | rohInErpRohIn.FBILLTYPE) |
| | | ? 1 |
| | | : 0; |
| | | // case "2": |
| | | // return InsertData(db, mesRohIn, mesRohInDatas, |
| | | // rohInErpRohIn.FBILLTYPE) |
| | | // ? 1 |
| | | // : 0; |
| | | case "3": |
| | | return UpdateData(db, mesRohIn, mesRohInDatas) ? 1 : 0; |
| | | case "2": |
| | | case "4": |
| | | return SaveOrUpdateData(db, mesRohIn, mesRohInDatas) |
| | | ? 1 |
| | |
| | | { |
| | | case "A": |
| | | { |
| | | var decimals = mesRohInDatas.Select(s => s.Id).ToArray(); |
| | | |
| | | if (mesRohIn.Id != null) |
| | | { |
| | | base.DeleteById(mesRohIn.Id); |
| | | } |
| | | |
| | | if (decimals.Length > 0) |
| | | { |
| | | db.Deleteable<MesRohInData>().In(decimals).ExecuteCommand(); |
| | | } |
| | | |
| | | var insert = base.Insert(mesRohIn); |
| | | var insertRange = |
| | | rohInDataManager.InsertRange(mesRohInDatas); |
| | |
| | | private bool UpdateData(SqlSugarScope db, MesRohIn mesRohIn, |
| | | List<MesRohInData> mesRohInDatas) |
| | | { |
| | | var update = base.Insert(mesRohIn); |
| | | var insertOrUpdate = rohInDataManager.InsertRange(mesRohInDatas); |
| | | var decimals = mesRohInDatas.Select(s => s.Id).ToArray(); |
| | | var update = base.DeleteById(mesRohIn.Id); |
| | | var insertOrUpdate = db |
| | | .Deleteable<MesRohInData>().In(decimals) |
| | | .ExecuteCommand() > 0; |
| | | |
| | | if (update && insertOrUpdate) return true; |
| | | throw new NotImplementedException("更新失败"); |
| | |
| | | private bool SaveOrUpdateData(SqlSugarScope db, MesRohIn mesRohIn, |
| | | List<MesRohInData> mesRohInDatas) |
| | | { |
| | | |
| | | if (mesRohIn.Id != null) |
| | | { |
| | | base.DeleteById(mesRohIn.Id); |
| | | } |
| | | |
| | | if (mesRohInDatas.Count > 0) |
| | | { |
| | | db.Deleteable<MesRohInData>().Where(s=>s.ErpId == mesRohIn.EbelnK3id).ExecuteCommand(); |
| | | } |
| | | |
| | | var orUpdate = base.Insert(mesRohIn); |
| | | var baOrUpdate = rohInDataManager.InsertRange(mesRohInDatas); |
| | | if (orUpdate && baOrUpdate) return true; |