| | |
| | | var entity = new ZZCX |
| | | { |
| | | BillNo = dto.bill_no, // 单据编码 |
| | | Erpid = dto.erpid , // ERP 主表 ID |
| | | DjLx = dto.dj_lx, |
| | | Erpid = string.IsNullOrEmpty(dto.erpid) ? (decimal?)null : Convert.ToDecimal(dto.erpid), |
| | | // ERP 主表 ID |
| | | DjLx = dto.dj_lx, |
| | | KcZz = dto.kc_zz, |
| | | SwLx = dto.sw_lx, |
| | | // Time = string.IsNullOrEmpty(dto.time) ? (DateTime?)null : DateTime.Parse(dto.time), |
| | |
| | | { |
| | | var item = new ZZCXA |
| | | { |
| | | Erpid = dto.erpid, |
| | | /* BillNo = dto.bill_no, |
| | | DjLx = dto.dj_lx, |
| | | KcZz = dto.kc_zz, |
| | | SwLx = dto.sw_lx, |
| | | // Time = string.IsNullOrEmpty(dto.time) ? (DateTime?)null : DateTime.Parse(dto.time), |
| | | Time = dto.time, |
| | | Bm = dto.bm, |
| | | Cgy = dto.cgy, |
| | | Kcz = dto.kcz, |
| | | DjZt = dto.dj_zt, |
| | | Memo = dto.memo, |
| | | Cphzlx = dto.cphzlx, |
| | | Cphz = dto.cphz, |
| | | Zjhzlx = dto.zjhzlx, |
| | | Zjhz = dto.zjhz,*/ |
| | | ItemId = dto.item_id, |
| | | /* BillNo = dto.bill_no, |
| | | DjLx = dto.dj_lx, |
| | | KcZz = dto.kc_zz, |
| | | SwLx = dto.sw_lx, |
| | | // Time = string.IsNullOrEmpty(dto.time) ? (DateTime?)null : DateTime.Parse(dto.time), |
| | | Time = dto.time, |
| | | Bm = dto.bm, |
| | | Cgy = dto.cgy, |
| | | Kcz = dto.kcz, |
| | | DjZt = dto.dj_zt, |
| | | Memo = dto.memo, |
| | | Cphzlx = dto.cphzlx, |
| | | Cphz = dto.cphz, |
| | | Zjhzlx = dto.zjhzlx, |
| | | Zjhz = dto.zjhz,*/ |
| | | Erpid = string.IsNullOrEmpty(dto.erpid) ? (decimal?)null : Convert.ToDecimal(dto.erpid), |
| | | YdId = string.IsNullOrEmpty(dto.yd_id) ? (decimal?)null : Convert.ToDecimal(dto.yd_id), |
| | | ItemId = string.IsNullOrEmpty(dto.item_id) ? (decimal?)null : Convert.ToDecimal(dto.item_id), |
| | | Qty = string.IsNullOrEmpty(dto.qty) ? (decimal?)null : Convert.ToDecimal(dto.qty), |
| | | Unit = dto.unit, |
| | | DepotId = dto.depot_id, |
| | | YdId = mainErpId |
| | | DepotId = string.IsNullOrEmpty(dto.depot_id) ? (decimal?)null : Convert.ToDecimal(dto.depot_id) |
| | | |
| | | }; |
| | | |
| | | var existing = Db.Queryable<ZZCXA>().Where(s => s.Erpid == item.Erpid).Single(); |
| | |
| | | { |
| | | var subEntity = new ZZCXB |
| | | { |
| | | Eid = subDto.eid, |
| | | ItemId = subDto.item_id, |
| | | Eid = string.IsNullOrEmpty(subDto.eid) ? (decimal?)null : Convert.ToDecimal(subDto.eid), |
| | | Erpid = string.IsNullOrEmpty(subDto.erpid) ? (decimal?)null : Convert.ToDecimal(subDto.erpid), |
| | | YdId = string.IsNullOrEmpty(subDto.yd_id) ? (decimal?)null : Convert.ToDecimal(subDto.yd_id), |
| | | ItemId = string.IsNullOrEmpty(subDto.item_id) ? (decimal?)null : Convert.ToDecimal(subDto.item_id), |
| | | Qty = string.IsNullOrEmpty(subDto.qty) ? (decimal?)null : Convert.ToDecimal(subDto.qty), |
| | | Unit = subDto.unit, |
| | | DepotId = subDto.depot_id, |
| | | DepotId = string.IsNullOrEmpty(subDto.depot_id) ? (decimal?)null : Convert.ToDecimal(subDto.depot_id), |
| | | LotNo = subDto.lot_no, |
| | | Memo = subDto.memo, |
| | | Erpid = mainErpId |
| | | Memo = subDto.memo |
| | | }; |
| | | |
| | | var existingSub = Db.Queryable<ZZCXB>().Where(s => s.Eid == subEntity.Eid).Single(); |
| | |
| | | |
| | | private bool SaveOrUpdateData(SqlSugarScope db, ZZCX head, List<ZZCXA> children) |
| | | { |
| | | // 1. 校验是否存在领料记录(MES_INV_ITEM_OUTS) |
| | | var hasMaterialOut = db.Queryable<MesInvItemOuts>() |
| | | .Any(x => x.WorkNo == head.BillNo); |
| | | |
| | | if (hasMaterialOut) |
| | | { |
| | | throw new Exception($"MES已有领料记录,单号:{head.BillNo},不能更新!"); |
| | | } |
| | | |
| | | if (head.Id != null) |
| | | base.DeleteById(head.Id); |
| | | |
| | |
| | | |
| | | private bool UpdateData(SqlSugarScope db, ZZCX head, List<ZZCXA> children) |
| | | { |
| | | |
| | | // 1. 校验是否存在领料记录(MES_INV_ITEM_OUTS) |
| | | var hasMaterialOut = db.Queryable<MesInvItemOuts>() |
| | | .Any(x => x.WorkNo == head.BillNo); |
| | | |
| | | if (hasMaterialOut) |
| | | { |
| | | throw new Exception($"MES已有领料记录,单号:{head.BillNo},不能删除!"); |
| | | } |
| | | |
| | | // 删除主表 |
| | | var deletedHead = db.Deleteable<ZZCX>() |
| | | .Where(d => d.Erpid == head.Erpid) |