| | |
| | | using System.Security.AccessControl; |
| | | |
| | | namespace MES.Service.service.BasicData; |
| | | |
| | | /// <summary> |
| | | /// 采购订单 |
| | | /// </summary> |
| | | public class MesRohInManager : Repository<MesRohIn> |
| | | { |
| | | private readonly MesRohInDataManager rohInDataManager = new(); |
| | |
| | | // 插入或更新数据的方法 |
| | | private bool SaveOrUpdateData(SqlSugarScope db, MesRohIn mesRohIn,List<MesRohInData> mesRohInDatas, string type) |
| | | { |
| | | ////传什么,c就改成什么 |
| | | //if (type == "3" || (mesRohIn.DocumentStatus != null && mesRohIn.DocumentStatus != "C"))//C表示已审核状态 |
| | | //{ |
| | | // mesRohIn.BillNo = mesRohIn.BillNo + "F" + mesRohIn.EbelnK3id.ToString(); |
| | | //} |
| | | |
| | | if (type == "3" || (mesRohIn.DocumentStatus != null && mesRohIn.DocumentStatus != "C")) |
| | | //传什么,c就改成什么 |
| | | if (type == "3" || (mesRohIn.DocumentStatus != null && mesRohIn.DocumentStatus != "F"))//C表示已审核状态 |
| | | { |
| | | mesRohIn.BillNo = mesRohIn.BillNo + "F" + mesRohIn.EbelnK3id.ToString(); |
| | | } |
| | |
| | | mesRohIn.PurchaseDate = DateTime.ParseExact(rohIn.FDate, |
| | | "yyyy-MM-dd HH:mm:ss", null); |
| | | |
| | | mesRohIn.Supplier = rohIn.FSupplierId; |
| | | //供应商转编码 |
| | | var mesRohInSupplier = Db.Queryable<MesSupplier>() |
| | | .Where(x => x.SuppNo == rohIn.FSupplierId) |
| | | .Select(x => x.Id.ToString()) |
| | | .First(); |
| | | if (!string.IsNullOrWhiteSpace(mesRohInSupplier)) |
| | | { |
| | | mesRohIn.Supplier = mesRohInSupplier; |
| | | } |
| | | else if (!string.IsNullOrWhiteSpace(rohIn.FSupplierId)) |
| | | { |
| | | mesRohIn.Supplier = rohIn.FSupplierId; |
| | | } |
| | | else |
| | | { |
| | | mesRohIn.Supplier = "0"; |
| | | } |
| | | //mesRohIn.Supplier = rohIn.FSupplierId; |
| | | |
| | | mesRohIn.CloseStatus = rohIn.FCloseStatus; |
| | | mesRohIn.PurchaseOrg = rohIn.FPurchaseOrgId; |
| | | mesRohIn.PurchaseDept = rohIn.FPurchaseDeptId; |
| | | //mesRohIn.PurchaseOrg = rohIn.FPurchaseOrgId; |
| | | mesRohIn.PurchaseOrg = string.IsNullOrEmpty(rohIn.FPurchaseOrgId) ? "1" : rohIn.FPurchaseOrgId;//采购组织 |
| | | |
| | | //采购部门转编码 |
| | | var mesRohInPurchaseDept = Db.Queryable<SysDepartment>() |
| | | .Where(x => x.Departmentcode == rohIn.FPurchaseDeptId) |
| | | .Select(x => x.Departmentid.ToString()) |
| | | .First(); |
| | | if (!string.IsNullOrWhiteSpace(mesRohInPurchaseDept)) |
| | | { |
| | | mesRohIn.PurchaseDept = mesRohInPurchaseDept; |
| | | } |
| | | else if (!string.IsNullOrWhiteSpace(rohIn.FPurchaseDeptId)) |
| | | { |
| | | mesRohIn.PurchaseDept = rohIn.FPurchaseDeptId; |
| | | } |
| | | else |
| | | { |
| | | mesRohIn.PurchaseDept = "0"; |
| | | } |
| | | //mesRohIn.PurchaseDept = rohIn.FPurchaseDeptId; |
| | | |
| | | mesRohIn.PurchaseGroup = rohIn.FPurchaserGroupId; |
| | | mesRohIn.Purchaser = rohIn.FPurchaserId; |
| | | mesRohIn.SettlementParty = rohIn.FSettleId; |
| | |
| | | ChangeFlag = s.FChangeFlag, |
| | | DemandSource = s.FDEMANDTYPE, |
| | | DemandDocumentId = s.FDEMANDBILLNO, |
| | | DemandDocumentLineId = s.FDEMANDBILLENTRYSEQ, |
| | | OrderLineId = s.FDEMANDBILLENTRYSEQ, |
| | | DemandOrg = s.FRequireOrgId, |
| | | ReceivingOrg = s.FReceiveOrgId, |
| | | SettlementOrg = s.FEntrySettleOrgId, |
| | |
| | | SalesOrderId = s.F_UNW_Text_xsddh |
| | | }; |
| | | |
| | | //采购单位转编码 |
| | | var entityPurchaseUnit = Db.Queryable<MesUnit>() |
| | | .Where(x => x.Fnumber == s.FUnitId) |
| | | .Select(x => x.Id.ToString()) |
| | | .First(); |
| | | if (!string.IsNullOrWhiteSpace(entityPurchaseUnit)) |
| | | { |
| | | entity.PurchaseUnit = entityPurchaseUnit; |
| | | } |
| | | else if (!string.IsNullOrWhiteSpace(s.FUnitId)) |
| | | { |
| | | entity.PurchaseUnit = s.FUnitId; |
| | | } |
| | | else |
| | | { |
| | | entity.PurchaseUnit = "0"; |
| | | } |
| | | |
| | | //计价单位转编码 |
| | | var entityPricingUnit = Db.Queryable<MesUnit>() |
| | | .Where(x => x.Fnumber == s.FPriceUnitId) |
| | | .Select(x => x.Id.ToString()) |
| | | .First(); |
| | | if (!string.IsNullOrWhiteSpace(entityPricingUnit)) |
| | | { |
| | | entity.PricingUnit = entityPricingUnit; |
| | | } |
| | | else if (!string.IsNullOrWhiteSpace(s.FPriceUnitId)) |
| | | { |
| | | entity.PricingUnit = s.FPriceUnitId; |
| | | } |
| | | else |
| | | { |
| | | entity.PricingUnit = "0"; |
| | | } |
| | | |
| | | if (s.FFreezeDate != null) |
| | | if (!s.FFreezerId.IsNullOrEmpty()) |
| | | entity.FreezeTime = |