| | |
| | | public bool Save(ErpWYOrder wyOrder) |
| | | { |
| | | var erpProductionOrderDto = wyOrder.OrderDto; |
| | | var mesRohIn = ConvertErpToProductionOrder(erpProductionOrderDto, wyOrder.Items[0].FBILLNO); |
| | | var mesRohIn = ConvertErpToProductionOrder(erpProductionOrderDto, |
| | | wyOrder.Items[0].FBILLNO); |
| | | var mesRohInDatas = |
| | | ConvertErpToProductionOrderSub(wyOrder.Items); |
| | | |
| | |
| | | |
| | | if (mesRohInDatas.Count > 0) |
| | | db.Deleteable<ProductionOrderSub>() |
| | | .Where(s => s.ErpProductionEntryCode == mesRohIn.ErpProductionEntryCode).ExecuteCommand(); |
| | | .Where(s => |
| | | s.ErpProductionEntryCode == mesRohIn.ErpProductionEntryCode) |
| | | .ExecuteCommand(); |
| | | |
| | | var orUpdate = db.Insertable(mesRohIn) |
| | | .IgnoreColumns(true).ExecuteCommand() > 0; |
| | |
| | | var baOrUpdate = db.Insertable(mesRohInDatas).PageSize(1) |
| | | .IgnoreColumnsNull() |
| | | .ExecuteCommand() > 0; |
| | | |
| | | |
| | | if (orUpdate && baOrUpdate) return true; |
| | | |
| | | throw new NotImplementedException("插入或更新失败"); |
| | |
| | | } |
| | | |
| | | private ProductionOrder ConvertErpToProductionOrder( |
| | | ErpProductionOrderDto erpDto,string SUBBOM) |
| | | ErpProductionOrderDto erpDto, string SUBBOM) |
| | | { |
| | | DateTime parsedDate; |
| | | |
| | |
| | | ErpProductionOrderId = erpDto.FSUBID, |
| | | ErpProductionOrderLineNo = erpDto.FSUBBILLNOSEQ, |
| | | ErpProductionOrderNo = erpDto.FSUBBILLNO, |
| | | SourceOrderType = erpDto.FSrcBillType, |
| | | |
| | | SourceOrderNo = erpDto.FSrcBillNo, |
| | | SourceOrderEntryNo = erpDto.FSrcBillEntrySeq, |
| | | DemandOrderNo = erpDto.FSALEORDERNO, |
| | |
| | | Typea = erpDto.TypeA, |
| | | }; |
| | | |
| | | var single = base.GetSingle(it => it.ErpProductionEntryCode == erpDto.FSUBENTRYID); |
| | | productionOrder.SourceOrderType = erpDto.FSrcBillType switch |
| | | { |
| | | //SourceOrderType = erpDto.FSrcBillType, |
| | | "0" => "无来源", |
| | | "1" => "销售订单行号", |
| | | "2" => "预测", |
| | | "3" => "出口订单行号", |
| | | "4" => "需求分类代号", |
| | | "5" => "销售订单号", |
| | | "6" => "出口订单号", |
| | | "7" or "8" => "生产订单", |
| | | _ => "委外订单" |
| | | }; |
| | | |
| | | var single = base.GetSingle(it => |
| | | it.ErpProductionEntryCode == erpDto.FSUBENTRYID); |
| | | if (single != null) productionOrder.Guid = single.Guid; |
| | | |
| | | return productionOrder; |