111
啊鑫
2 天以前 24a228b7f12e2c840f084ee3b483889e99c780db
MES.Service/service/BasicData/ProductionOrderManager.cs
@@ -122,12 +122,11 @@
        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,
@@ -183,6 +182,37 @@
            _ => "委外订单"
        };
        //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;