| | |
| | | var productionOrder = new ProductionOrder |
| | | { |
| | | OrderNo = SUBBOM, |
| | | Warehouse = erpDto.FStockID, |
| | | |
| | | OrderDate = ParseDateTime(erpDto.FDate) ?? null, |
| | | OrderType = erpDto.FBillType, |
| | | BusinessStatus = erpDto.FStatus, |
| | | ProductCode = erpDto.FMaterialId, |
| | | Unit = erpDto.FUnitID, |
| | | |
| | | WorkOrderQty = Convert.ToDecimal(erpDto.FQty), |
| | | PlanningGroup = erpDto.FWorkGroupId, |
| | | Planner = erpDto.FPlannerID, |
| | |
| | | _ => "委外订单" |
| | | }; |
| | | |
| | | //Unit = , |
| | | // CAA009 单位 -> MES_UNIT.id |
| | | if (!string.IsNullOrEmpty(erpDto.FUnitID)) |
| | | { |
| | | var unit = Db.Queryable<MesUnit>() |
| | | .Where(u => u.Fnumber == erpDto.FUnitID) |
| | | .Select(u => u.Id) |
| | | .First(); |
| | | productionOrder.Unit = unit.ToString(); |
| | | } |
| | | |
| | | // CAA006 产品编码 -> MES_ITEMS.id |
| | | if (!string.IsNullOrEmpty(erpDto.FMaterialId)) |
| | | { |
| | | var item = Db.Queryable<MesItems>() |
| | | .Where(i => i.ItemNo == erpDto.FMaterialId) |
| | | .Select(i => i.Id) |
| | | .First(); |
| | | productionOrder.ProductCode = item.ToString(); |
| | | } |
| | | |
| | | // Warehouse = erpDto.FStockID, |
| | | if (!string.IsNullOrEmpty(erpDto.FStockID)) |
| | | { |
| | | var depot = Db.Queryable<MesDepots>() |
| | | .Where(d => d.DepotCode == erpDto.FStockID) |
| | | .Select(d => d.DepotId) |
| | | .First(); |
| | | productionOrder.Warehouse = depot.ToString(); |
| | | } |
| | | |
| | | var single = base.GetSingle(it => |
| | | it.ErpProductionEntryCode == erpDto.FSUBENTRYID); |
| | | if (single != null) productionOrder.Guid = single.Guid; |