zjh
8 天以前 1cb5959adf96911101864488a67e8b31b8de658f
StandardPda/MES.Service/service/BasicData/SalesDeliveryNoticeManager.cs
@@ -45,7 +45,7 @@
                }
            }) > 0;
        }
        private bool UpdateData(SqlSugarScope db, SalesDeliveryNotice mesSalesDelivery,
            List<SalesDeliveryNoticeDetail> mesSalesDeliveryDatas)
        {
@@ -89,7 +89,7 @@
            var result = salesOrder.Select(Save).ToList();
            return result.All(b => b);
        }
        private SalesDeliveryNotice ConvertErpToSalesDelivery(
            ErpSalesDeliveryDto erpDto)
        {
@@ -135,11 +135,11 @@
                //PayerParty = erpDto.FPayerID,//付款方
                //CreatedBy = erpDto.FCreatorId, // 创建人
                CreatedDate = ParseDateTime(erpDto.FCreateDate) ?? null, // 创建时间
                //ModifiedBy = erpDto.FModifierId, // 修改人
                //ModifiedDate = ParseDateTime(erpDto.FModifyDate) ?? null, // 修改时间
                //ClosedBy = erpDto.FCloserId, // 关闭人
                //CloseReason = erpDto.FCloseReason, // 关闭原因
               // CloseDate = ParseDateTime(erpDto.FCloseDate) ?? null, // 关闭日期
                                                                         //ModifiedBy = erpDto.FModifierId, // 修改人
                                                                         //ModifiedDate = ParseDateTime(erpDto.FModifyDate) ?? null, // 修改时间
                                                                         //ClosedBy = erpDto.FCloserId, // 关闭人
                                                                         //CloseReason = erpDto.FCloseReason, // 关闭原因
                                                                         // CloseDate = ParseDateTime(erpDto.FCloseDate) ?? null, // 关闭日期
                ApprovedBy = erpDto.FApproverId, // 审核人
                ApprovedDate = ParseDateTime(erpDto.FApproveDate) ?? null, // 审核日期
                //CancelStatus = erpDto.FCancelStatus, // 作废状态
@@ -149,8 +149,8 @@
                BillStatus = erpDto.FDocumentStatus, //单据状态
                DeliveryOrg = erpDto.FDeliveryOrgID, //发货组织
                //SalesOrg    = erpDto.FSaleOrgId //销售组织
                FSourceCategory= erpDto.FSourceCategory,
                FSourceDocument= erpDto.FSourceDocument,
                FSourceCategory = erpDto.FSourceCategory,
                FSourceDocument = erpDto.FSourceDocument,
                FDeliveryDate = erpDto.FDeliveryDate,
                FProject = erpDto.FProject,
                FCustomerPo = erpDto.FCustomerPo,
@@ -159,9 +159,9 @@
                FDestinationPort = erpDto.FDestinationPort,
                FReceiverContactID = erpDto.FReceiverContactID,
                FEntryNote = erpDto.FEntryNote,
                FVersionNo= erpDto.FVersionNo,
                FBusinessType= erpDto.FBusinessType,
                FHEADLOCID= erpDto.FHEADLOCID,
                FVersionNo = erpDto.FVersionNo,
                FBusinessType = erpDto.FBusinessType,
                FHEADLOCID = erpDto.FHEADLOCID,
                FCustId = erpDto.FCustId,
                FNote = erpDto.FNote
            };
@@ -169,6 +169,11 @@
            var single = base.GetSingle(it => it.ErpId == erpDto.ErpID);
            if (single != null) salesOrder.Id = single.Id;
            if (salesOrder.ErpId is null || salesOrder.ErpId=="")
            {
                throw new NotImplementedException(
    $"表头ErpID不能为空");
            }
            return salesOrder;
        }
@@ -229,46 +234,68 @@
                    //SumOutQty = erpDto.FSumOutQty,//累计出库数量
                    //RemainOutQty = erpDto.FRemainOutQty,//未出库数量
                    //NOTE = erpDto.FEntrynote//备注
                    FDeliveryDate= erpDto.FDeliveryDate,
                    FMapId= erpDto.FMapId,
                    FDeliveryDate = erpDto.FDeliveryDate,
                    FMapId = erpDto.FMapId,
                    FMapName = erpDto.FMapName,
                    FMapId2 = erpDto.FMapId2,
                    FProject= erpDto.FProject,
                    FProject = erpDto.FProject,
                    FStorageLocation = erpDto.FStorageLocation,
                    FFreeItemType = erpDto.FFreeItemType,
                    FBodyNote = erpDto.FBodyNote,
                    FAvailableStock = erpDto.FAvailableStock,
                    FInventoryQueryTime = erpDto.FInventoryQueryTime,
                    FLineStatus= erpDto.FLineStatus,
                    FReceiveAddressFull= erpDto.FReceiveAddressFull,
                    FReceiverContact= erpDto.FReceiverContact,
                    FLineStatus = erpDto.FLineStatus,
                    FReceiveAddressFull = erpDto.FReceiveAddressFull,
                    FReceiverContact = erpDto.FReceiverContact,
                    FReturnExchangeAllowed = erpDto.FReturnExchangeAllowed,
                    FOutsourcedProcessQty = erpDto.FOutsourcedProcessQty,
                    FAvailableDate = erpDto.FAvailableDate,
                    FCommitmentDate= erpDto.FCommitmentDate,
                    FCustomerConfirmShipDate= erpDto.FCustomerConfirmShipDate,
                    FPlannedOrg= erpDto.FPlannedOrg,
                    FCommitmentDate = erpDto.FCommitmentDate,
                    FCustomerConfirmShipDate = erpDto.FCustomerConfirmShipDate,
                    FPlannedOrg = erpDto.FPlannedOrg,
                    FVendorDirectShip = erpDto.FVendorDirectShip,
                    FSupplySource = erpDto.FSupplySource,
                    FSupplyType = erpDto.FSupplyType,
                    FSupplyOrg= erpDto.FSupplyOrg,
                    FSupplier= erpDto.FSupplier,
                    FShippingMethod= erpDto.FShippingMethod,
                    FSupplyOrg = erpDto.FSupplyOrg,
                    FSupplier = erpDto.FSupplier,
                    FShippingMethod = erpDto.FShippingMethod,
                    FMRPDR = erpDto.FMRPDR,
                    FDemandCategory = erpDto.FDemandCategory,
                    FInventoryPlanning = erpDto.FInventoryPlanning,
                    FLineRemark= erpDto.FLineRemark,
                    FLineRemark = erpDto.FLineRemark,
                    FSourceDocCategory = erpDto.FSourceDocCategory,
                    FSourceDocNo= erpDto.FSourceDocNo,
                    FSourceDocNo = erpDto.FSourceDocNo,
                    FSourceDocLineNo = erpDto.FSourceDocLineNo,
                    FLINE_NO = erpDto.FLINE_NO
                };
                if (salesOrderSub.ErpLineId is null || salesOrderSub.ErpLineId=="")
                {
                    throw new NotImplementedException(
    $"明细行ErpID(ERP行ID)不能为空");
                }
                if (salesOrderSub.ErpHeadId is null || salesOrderSub.ErpHeadId == "")
                {
                    throw new NotImplementedException(
    $"明细行EHID(ERP头ID)不能为空");
                }
                var single = _SalesDeliveryDetailManager.GetSingle(it =>
                    it.ErpLineId == salesOrderSub.ErpLineId);
                if (single != null) salesOrderSub.Id = single.Id;
                var mesLinkU9 = Db.Queryable<MesLinkU9>()
.Where(x => x.U9Id == erpDto.FMaterialId
    && x.OrgId == erpDto.FSupplyOrg
    && x.TableType == "MES_ITEMS").First();
                if (mesLinkU9 != null) salesOrderSub.MaterialId = mesLinkU9.MesId;
                var mesLinkU92 = Db.Queryable<MesLinkU9>()
                    .Where(x => x.U9Id == erpDto.FProject
                                && x.OrgId == erpDto.FSupplyOrg
                                && x.TableType == "MES_PROJECT").First();
                if (mesLinkU92 != null) salesOrderSub.FProject = mesLinkU92.MesId;
                salesOrderSubList.Add(salesOrderSub);
            }