| | |
| | | private readonly ProductionOrderSubManager _productionOrderSubManager = |
| | | new(); |
| | | |
| | | private string ORDERNO = ""; |
| | | |
| | | |
| | | //ErpWYOrder |
| | | public bool Save(ErpWYOrder wyOrder) |
| | | { |
| | | var erpProductionOrderDto = wyOrder.OrderDto; |
| | | var mesRohIn = ConvertErpToProductionOrder(erpProductionOrderDto); |
| | | var mesRohIn = ConvertErpToProductionOrder(erpProductionOrderDto, wyOrder.Items[0].FBILLNO); |
| | | var mesRohInDatas = |
| | | ConvertErpToProductionOrderSub(wyOrder.Items); |
| | | |
| | |
| | | // ? 1 |
| | | // : 0; |
| | | case "3": |
| | | return UpdateData(db, mesRohIn, mesRohInDatas) ? 1 : 0; |
| | | //return UpdateData(db, mesRohIn, mesRohInDatas) ? 1 : 0;//改为不删除 |
| | | return SaveOrUpdateData(db, mesRohIn, mesRohInDatas, |
| | | erpProductionOrderDto.Type) |
| | | ? 1 |
| | | : 0; |
| | | case "2": |
| | | case "4": |
| | | return SaveOrUpdateData(db, mesRohIn, mesRohInDatas, |
| | |
| | | private bool SaveOrUpdateData(SqlSugarScope db, ProductionOrder mesRohIn, |
| | | List<ProductionOrderSub> mesRohInDatas, string type) |
| | | { |
| | | if(type == "3" || (mesRohIn.DocumentStatus != null && mesRohIn.DocumentStatus != "C")) |
| | | { |
| | | mesRohIn.Typea = "3"; // 新增字段赋值 |
| | | mesRohIn.OrderNo = mesRohIn.OrderNo + "F" + mesRohIn.ErpProductionEntryCode; |
| | | } |
| | | |
| | | if (StringUtil.CheckGuid(mesRohIn.Guid)) |
| | | db.Deleteable<ProductionOrder>() |
| | | .Where(s => s.Guid == mesRohIn.Guid) |
| | |
| | | } |
| | | |
| | | private ProductionOrder ConvertErpToProductionOrder( |
| | | ErpProductionOrderDto erpDto) |
| | | ErpProductionOrderDto erpDto,string SUBBOM) |
| | | { |
| | | DateTime parsedDate; |
| | | |
| | |
| | | |
| | | var productionOrder = new ProductionOrder |
| | | { |
| | | OrderNo = erpDto.FBillNo, |
| | | OrderNo = SUBBOM, |
| | | Warehouse = erpDto.FStockID, |
| | | OrderDate = ParseDateTime(erpDto.FDate) ?? null, |
| | | OrderType = erpDto.FBillType, |
| | |
| | | ReqSrc = erpDto.FReqSrc, |
| | | SrcSplitSeq = erpDto.SrcSplitSeq, |
| | | Typea = erpDto.TypeA, |
| | | DocumentStatus = erpDto.FDocumentStatus |
| | | |
| | | }; |
| | | |
| | | var single = base.GetSingle(it => it.ErpId == erpDto.FID); |
| | | if (single != null) productionOrder.Guid = single.Guid; |
| | | var single = base.GetSingle(it => it.ErpProductionEntryCode == erpDto.FSUBENTRYID); |
| | | if (single != null) |
| | | { |
| | | productionOrder.Guid = single.Guid; |
| | | productionOrder.AuditDate = single.AuditDate; |
| | | productionOrder.AuditStatus = single.AuditStatus; |
| | | productionOrder.Auditor = single.Auditor; |
| | | } |
| | | |
| | | return productionOrder; |
| | | } |