11
啊鑫
5 天以前 caabe3ba39cedbe0daf18c231a22df1e693b49be
MES.Service/service/BasicData/ProductionOrderManager.cs
@@ -21,7 +21,8 @@
    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);
@@ -77,7 +78,9 @@
        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;
@@ -86,7 +89,7 @@
        var baOrUpdate = db.Insertable(mesRohInDatas).PageSize(1)
            .IgnoreColumnsNull()
            .ExecuteCommand() > 0;
        if (orUpdate && baOrUpdate) return true;
        throw new NotImplementedException("插入或更新失败");
@@ -100,7 +103,7 @@
    }
    private ProductionOrder ConvertErpToProductionOrder(
        ErpProductionOrderDto erpDto,string SUBBOM)
        ErpProductionOrderDto erpDto, string SUBBOM)
    {
        DateTime parsedDate;
@@ -142,7 +145,7 @@
            ErpProductionOrderId = erpDto.FSUBID,
            ErpProductionOrderLineNo = erpDto.FSUBBILLNOSEQ,
            ErpProductionOrderNo = erpDto.FSUBBILLNO,
            SourceOrderType = erpDto.FSrcBillType,
            SourceOrderNo = erpDto.FSrcBillNo,
            SourceOrderEntryNo = erpDto.FSrcBillEntrySeq,
            DemandOrderNo = erpDto.FSALEORDERNO,
@@ -166,7 +169,22 @@
            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;