| | |
| | | "avatar": "", |
| | | "version": "4.9.2", |
| | | "createdTime": "2025-3-10 16:38:19", |
| | | "updatedTime": "2025-7-31 10:26:58", |
| | | "updatedTime": "2025-8-1 16:49:40", |
| | | "dbConns": [], |
| | | "profile": { |
| | | "default": { |
| | |
| | | "id": "4BF071F1-4F69-4044-8C17-25D7B66404F7" |
| | | }, |
| | | { |
| | | "defKey": "dispatcher_code", |
| | | "defName": "è°åº¦åç¼å·", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | | "scale": "", |
| | | "primaryKey": false, |
| | | "notNull": false, |
| | | "autoIncrement": false, |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "refDict": "", |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", |
| | | "extProps": {}, |
| | | "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6", |
| | | "id": "09E4DA62-D2E3-4D82-9259-DCACA5C40FFD" |
| | | }, |
| | | { |
| | | "defKey": "dispatcher_name", |
| | | "defName": "è°åº¦ååç§°", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | | "scale": "", |
| | | "primaryKey": false, |
| | | "notNull": false, |
| | | "autoIncrement": false, |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "refDict": "", |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", |
| | | "extProps": {}, |
| | | "domain": "9092C4E0-1A54-4859-ABBB-5B62DBC27573", |
| | | "id": "C700FB1A-B747-4E97-A7BE-0044C0B3B2EE" |
| | | }, |
| | | { |
| | | "defKey": "order_create_date", |
| | | "defName": "订ååå»ºæ¥æ", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | | "scale": "", |
| | | "primaryKey": false, |
| | | "notNull": false, |
| | | "autoIncrement": false, |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "refDict": "", |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", |
| | | "extProps": {}, |
| | | "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6", |
| | | "id": "BD647EC3-B32A-460E-A6D9-A4A1D808F849" |
| | | }, |
| | | { |
| | | "defKey": "order_update_date", |
| | | "defName": "è®¢åæ´æ°æ¥æ", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | | "scale": "", |
| | | "primaryKey": false, |
| | | "notNull": false, |
| | | "autoIncrement": false, |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "refDict": "", |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", |
| | | "extProps": {}, |
| | | "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6", |
| | | "id": "E2F64B2D-D193-410E-83F5-7CA29FC2F1C7" |
| | | }, |
| | | { |
| | | "defKey": "order_update_time", |
| | | "defName": "è®¢åæ´æ°æ¶é´", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | | "scale": "", |
| | | "primaryKey": false, |
| | | "notNull": false, |
| | | "autoIncrement": false, |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "refDict": "", |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", |
| | | "extProps": {}, |
| | | "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6", |
| | | "id": "99C90188-1886-45E3-8A66-062CF8672F15" |
| | | }, |
| | | { |
| | | "defKey": "order_update_user", |
| | | "defName": "订åä¿®æ¹äºº", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | | "scale": "", |
| | | "primaryKey": false, |
| | | "notNull": false, |
| | | "autoIncrement": false, |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "refDict": "", |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", |
| | | "extProps": {}, |
| | | "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6", |
| | | "id": "57BE810E-5423-4B64-B5C4-914D4FC48965" |
| | | }, |
| | | { |
| | | "defKey": "customer_order_model", |
| | | "defName": "客æ·åå·", |
| | | "comment": "", |
| | |
| | | "baseType": "89D69E81-EA34-42EE-9FA2-93B8BD27E098" |
| | | }, |
| | | { |
| | | "defKey": "del_flag", |
| | | "defName": "å 餿 è®°", |
| | | "defKey": "order_id", |
| | | "defName": "ç产订åID", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "refDict": "", |
| | | "baseType": "1D764C4A-6F9F-421E-B11A-6F3E23B51811", |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", |
| | | "extProps": {}, |
| | | "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E", |
| | | "id": "ABF02681-A2E7-4077-AEEF-7338AF47C4B8" |
| | | "domain": "16120F75-6AA7-4483-868D-F07F511BB081", |
| | | "id": "FE30BEF4-FD2C-477D-83B9-DAE0546C7D09" |
| | | }, |
| | | { |
| | | "defKey": "material_number", |
| | |
| | | "attr9": "", |
| | | "id": "CADE8A93-4759-4DA5-8210-942102A9F18B", |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64" |
| | | }, |
| | | { |
| | | "defKey": "factory_id", |
| | | "defName": "产线ID(SAPå·¥ä½ä¸å¿)", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | | "scale": "", |
| | | "primaryKey": false, |
| | | "notNull": false, |
| | | "autoIncrement": false, |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "refDict": "", |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", |
| | | "extProps": {}, |
| | | "domain": "9092C4E0-1A54-4859-ABBB-5B62DBC27573", |
| | | "id": "F5683C11-B21C-44C4-AF88-2D9A92F7444F" |
| | | }, |
| | | { |
| | | "defKey": "process_code", |
| | |
| | | "baseType": "89D69E81-EA34-42EE-9FA2-93B8BD27E098" |
| | | }, |
| | | { |
| | | "defKey": "del_flag", |
| | | "defName": "å 餿 è®°", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | | "scale": "", |
| | | "primaryKey": false, |
| | | "notNull": false, |
| | | "autoIncrement": false, |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "refDict": "", |
| | | "baseType": "1D764C4A-6F9F-421E-B11A-6F3E23B51811", |
| | | "extProps": {}, |
| | | "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E", |
| | | "id": "B43CBCB3-5BC6-4411-9999-C50D2C6A8A5D" |
| | | }, |
| | | { |
| | | "defKey": "order_id", |
| | | "defName": "çæè®¢åID", |
| | | "comment": "", |
| | |
| | | "attr9": "", |
| | | "id": "5428A165-EF43-40AF-B56F-9F75CBA47A0C", |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64" |
| | | }, |
| | | { |
| | | "defKey": "bill_materials_code", |
| | | "defName": "BOM代ç ", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | | "scale": "", |
| | | "primaryKey": false, |
| | | "notNull": false, |
| | | "autoIncrement": false, |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "refDict": "", |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", |
| | | "extProps": {}, |
| | | "domain": "BE09D493-E183-402D-ACC4-EEA21EB35B8E", |
| | | "id": "07D7B55E-B88D-4493-B916-987978EA20D1" |
| | | }, |
| | | { |
| | | "defKey": "production_unit", |
| | |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64" |
| | | }, |
| | | { |
| | | "defKey": "usage_unit", |
| | | "defKey": "production_unit", |
| | | "defName": "åºæ¬åä½", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | | "scale": "", |
| | | "primaryKey": false, |
| | | "notNull": false, |
| | | "autoIncrement": false, |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6", |
| | | "refDict": "", |
| | | "extProps": {}, |
| | | "notes": {}, |
| | | "attr1": "", |
| | | "attr2": "", |
| | | "attr3": "", |
| | | "attr4": "", |
| | | "attr5": "", |
| | | "attr6": "", |
| | | "attr7": "", |
| | | "attr8": "", |
| | | "attr9": "", |
| | | "id": "4F81E835-2971-44F0-872E-61BD47417674", |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64" |
| | | }, |
| | | { |
| | | "defKey": "usage_quantity", |
| | | "defName": "éæ±ç¨é", |
| | | "comment": "", |
| | | "type": "", |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.modules.sap.dto.ProductionOrderDTO; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "æ´æ°æ¥æ") |
| | | private Date updateTime; |
| | | /**å 餿 è®°*/ |
| | | @Excel(name = "å 餿 è®°", width = 15) |
| | | @ApiModelProperty(value = "å 餿 è®°") |
| | | @TableLogic |
| | | private Integer delFlag; |
| | | /**ç产订åå·*/ |
| | | @Excel(name = "ç产订åå·", width = 15) |
| | | @ApiModelProperty(value = "ç产订åå·") |
| | | private String orderCode; |
| | | /**订åç±»å*/ |
| | | @Excel(name = "订åç±»å", width = 15) |
| | | @ApiModelProperty(value = "订åç±»å") |
| | | private String orderCategory; |
| | | /**ç©æç¼å·*/ |
| | | @Excel(name = "ç©æç¼å·", width = 15) |
| | | @ApiModelProperty(value = "ç©æç¼å·") |
| | | private String materialNumber; |
| | | /**ç©æåç§°*/ |
| | | @Excel(name = "ç©æåç§°", width = 15) |
| | | @ApiModelProperty(value = "ç©æåç§°") |
| | | private String materialName; |
| | | /**计åå¼å§æ¥æ*/ |
| | | @Excel(name = "计åå¼å§æ¥æ", width = 20, format = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "计åå¼å§æ¥æ") |
| | | private Date planStart; |
| | | /**计åç»ææ¥æ*/ |
| | | @Excel(name = "计åç»ææ¥æ", width = 20, format = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "计åç»ææ¥æ") |
| | | private Date planEnd; |
| | | /**è®¢åæ°é*/ |
| | | @Excel(name = "è®¢åæ°é", width = 15) |
| | | @ApiModelProperty(value = "è®¢åæ°é") |
| | | private Double orderQuantity; |
| | | private BigDecimal orderQuantity; |
| | | /**产ååä½*/ |
| | | @Excel(name = "产ååä½", width = 15, dicCode = "production_unit") |
| | | @Dict(dicCode = "production_unit") |
| | | @ApiModelProperty(value = "产ååä½") |
| | | private String productionUnit; |
| | | /**订åç¶æ*/ |
| | | @Excel(name = "订åç¶æ", width = 15, dicCode = "order_status") |
| | | @Dict(dicCode = "order_status") |
| | | @ApiModelProperty(value = "订åç¶æ") |
| | | private String orderStatus; |
| | | /**ä¼å
级*/ |
| | | @Excel(name = "ä¼å
级", width = 15, dicCode = "priority") |
| | | @Dict(dicCode = "priority") |
| | | @ApiModelProperty(value = "ä¼å
级") |
| | | private String priority; |
| | | /**计åå·¥èºè·¯çº¿*/ |
| | | @Excel(name = "计åå·¥èºè·¯çº¿", width = 15) |
| | | @ApiModelProperty(value = "计åå·¥èºè·¯çº¿") |
| | | private String processRoute; |
| | | /**计åç©ææ¸
å*/ |
| | | @Excel(name = "计åç©ææ¸
å", width = 15) |
| | | @ApiModelProperty(value = "计åç©ææ¸
å") |
| | | private String materialListCode; |
| | | /**å·¥åç¼ç */ |
| | | @Excel(name = "å·¥åç¼ç ", width = 15) |
| | | @ApiModelProperty(value = "å·¥åç¼ç ") |
| | | private String factoryCode; |
| | | /**å·¥ååç§°*/ |
| | | @Excel(name = "å·¥ååç§°", width = 15) |
| | | @ApiModelProperty(value = "å·¥ååç§°") |
| | | private String factoryName; |
| | | /**è°åº¦åç¼å·*/ |
| | | @ApiModelProperty(value = "è°åº¦åç¼å·") |
| | | private String dispatcherCode; |
| | | /**è°åº¦ååç§°*/ |
| | | @ApiModelProperty(value = "è°åº¦ååç§°") |
| | | private String dispatcherName; |
| | | /**订ååå»ºæ¥æ yyyy-MM-dd*/ |
| | | @ApiModelProperty(value = "订ååå»ºæ¥æ") |
| | | private String orderCreateDate; |
| | | /**è®¢åæ´æ°æ¥æ yyyy-MM-dd*/ |
| | | @ApiModelProperty(value = "è®¢åæ´æ°æ¥æ") |
| | | private String orderUpdateDate; |
| | | /**è®¢åæ´æ°æ¶é´ HH:mm:ss*/ |
| | | @ApiModelProperty(value = "è®¢åæ´æ°æ¶é´") |
| | | private String orderUpdateTime; |
| | | /**订åä¿®æ¹äºº*/ |
| | | @ApiModelProperty(value = "订åä¿®æ¹äºº") |
| | | private String orderUpdateUser; |
| | | /**客æ·åå·*/ |
| | | @Excel(name = "客æ·åå·", width = 15) |
| | | @ApiModelProperty(value = "客æ·åå·") |
| | | private String customerOrderModel; |
| | | /**客æ·åç§°*/ |
| | | @Excel(name = "客æ·åç§°", width = 15) |
| | | @ApiModelProperty(value = "客æ·åç§°") |
| | | private String customer; |
| | | /**夿³¨*/ |
| | | @Excel(name = "夿³¨", width = 15) |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | public MesProductionOrder() { |
| | | } |
| | | |
| | | public MesProductionOrder(ProductionOrderDTO dto) { |
| | | this.orderCode = dto.getAUFNR(); |
| | | this.orderCategory = dto.getDAUAT(); |
| | | this.materialNumber = dto.getMATNR(); |
| | | this.materialName = dto.getMAKTX(); |
| | | this.planStart = DateUtils.str2Date(dto.getGSTRP(), DateUtils.date_sdf.get()); |
| | | this.planEnd = DateUtils.str2Date(dto.getGLTRP(), DateUtils.date_sdf.get()); |
| | | this.orderQuantity = new BigDecimal(dto.getGAMNG()); |
| | | this.productionUnit = dto.getGMEIN(); |
| | | this.orderStatus = dto.getTXT04(); |
| | | this.priority = dto.getAPRIO(); |
| | | this.processRoute = dto.getAUFPL(); |
| | | this.materialListCode = dto.getSTLNR(); |
| | | this.factoryCode = dto.getDWERK(); |
| | | this.factoryName = dto.getNAME1(); |
| | | this.dispatcherCode = dto.getFEVOR(); |
| | | this.dispatcherName = dto.getTXT(); |
| | | this.orderCreateDate = dto.getUDATE(); |
| | | this.orderUpdateDate = dto.getLAEDA(); |
| | | this.orderUpdateTime = dto.getTIMES(); |
| | | this.orderUpdateUser = dto.getUSNAM(); |
| | | this.delFlag = CommonConstant.DEL_FLAG_0; |
| | | } |
| | | |
| | | public void updateEntity(ProductionOrderDTO dto) { |
| | | this.orderCategory = dto.getDAUAT(); |
| | | this.planStart = DateUtils.str2Date(dto.getGSTRP(), DateUtils.date_sdf.get()); |
| | | this.planEnd = DateUtils.str2Date(dto.getGLTRP(), DateUtils.date_sdf.get()); |
| | | this.orderQuantity = new BigDecimal(dto.getGAMNG()); |
| | | this.orderStatus = dto.getTXT04(); |
| | | this.priority = dto.getAPRIO(); |
| | | this.orderCreateDate = dto.getUDATE(); |
| | | this.orderUpdateDate = dto.getLAEDA(); |
| | | this.orderUpdateTime = dto.getTIMES(); |
| | | this.orderUpdateUser = dto.getUSNAM(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mes.job; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.modules.mes.entity.MesProductionOrder; |
| | | import org.jeecg.modules.mes.service.IMesProductionOrderService; |
| | | import org.jeecg.modules.pms.service.IPmsMaterialProcessService; |
| | | import org.jeecg.modules.pms.service.IPmsProcessBillMaterialsService; |
| | | import org.jeecg.modules.sap.dto.OrderBomDTO; |
| | | import org.jeecg.modules.sap.dto.OrderProcessDTO; |
| | | import org.jeecg.modules.sap.dto.ProductionOrderDTO; |
| | | import org.jeecg.modules.sap.service.OrderBomSync; |
| | | import org.jeecg.modules.sap.service.OrderProcessSync; |
| | | import org.jeecg.modules.sap.service.ProductionOrderSync; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Component |
| | | @Slf4j |
| | | public class ProductionOrderSyncJob implements Job { |
| | | //å·¥åç¼ç (æ°ç«ç¬ 2301) |
| | | private static final String FACTORY_CODE = "2301"; |
| | | /** |
| | | * 订åç±»å |
| | | * æ åç产订å Z001 |
| | | * 客éè¿å·¥ç产订å Z002 |
| | | * åæ»å¤çè¿å·¥ç产订å Z003 |
| | | * è¯å¶ç产订å(æ°ç«ç¬) Z011 |
| | | * æé¶ç产订å(æ°ç«ç¬) 2012 |
| | | */ |
| | | private static final String ORDER_TYPE_CODE = "Z001"; |
| | | /** |
| | | * ç产è°åº¦å |
| | | * 001 ä¸ååè°åº¦å |
| | | * 002 äºååè°åº¦å |
| | | * 003 ä¸ååè°åº¦å |
| | | * 004 åååè°åº¦å |
| | | * 005 ABSè°åº¦å |
| | | * 006 è°è´¨è°åº¦å |
| | | * 007 äºååè°åº¦å |
| | | * 008 è¯å¶è½¦é´è°åº¦å |
| | | * 009 å¤éè°åº¦å |
| | | * 010 å
åè°åº¦å |
| | | * 012 å
«ååè°åº¦å |
| | | */ |
| | | private static final String PRODUCTION_MANAGER = "010"; |
| | | /** |
| | | * ç产订åç¶æï¼å®é
ä¸ï¼åªæRELç¶æçå·¥åæå¯ä»¥è¿è¡æä½ |
| | | * CRTD æ°å»º |
| | | * REL ä¸è¾¾ |
| | | * TECO å
³é |
| | | */ |
| | | private static final String ORDER_STATUS = "REL"; |
| | | |
| | | /** |
| | | * è¯·æ±æåç¼ç |
| | | */ |
| | | private static final String SUCCESS_CODE = "S"; |
| | | |
| | | @Autowired |
| | | private ProductionOrderSync productionOrderSync; |
| | | @Autowired |
| | | private OrderBomSync orderBomSync; |
| | | @Autowired |
| | | private OrderProcessSync orderProcessSync; |
| | | @Autowired |
| | | private IMesProductionOrderService productionOrderService; |
| | | @Autowired |
| | | private IPmsProcessBillMaterialsService processBillMaterialsService; |
| | | @Autowired |
| | | private IPmsMaterialProcessService materialProcessService; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { |
| | | //è·å䏿¬¡åæ¥æ¶é´ |
| | | try { |
| | | //è°ç¨SAPæ¥å£è·åç产订å |
| | | Map<String, Object> productionOrderMap = productionOrderSync.syncProductionOrder(FACTORY_CODE, ORDER_TYPE_CODE, PRODUCTION_MANAGER, ORDER_STATUS, null, null); |
| | | if (productionOrderMap == null || !SUCCESS_CODE.equals(productionOrderMap.get("ztype"))) { |
| | | log.error("æªåæ¥å°è®¢åä¿¡æ¯ï¼æ¥æï¼{}", LocalDateTime.now()); |
| | | return; |
| | | } |
| | | //è°ç¨æåï¼è·åè¿åæ°æ® |
| | | Object result = productionOrderMap.get("result"); |
| | | boolean b = result instanceof List; |
| | | if(!b) { |
| | | log.error("è¿åç±»åéè¯¯ï¼ class:{}", result == null ? null : result.getClass()); |
| | | return; |
| | | } |
| | | List<ProductionOrderDTO> productionOrderDTOList = (List<ProductionOrderDTO>) result; |
| | | Map<String, MesProductionOrder> orderMap = productionOrderService.saveOrUpdateProductionOrder(productionOrderDTOList); |
| | | String orderCodes = String.join(",", orderMap.keySet()); |
| | | //订åBOM忥 |
| | | Map<String, Object> orderBomMap = orderBomSync.syncOrderBom(FACTORY_CODE, orderCodes); |
| | | if (orderBomMap == null || !SUCCESS_CODE.equals(orderBomMap.get("ztype"))) { |
| | | log.error("æªåæ¥å°è®¢åBOMä¿¡æ¯ï¼æ¥æï¼{}", LocalDateTime.now()); |
| | | return; |
| | | } |
| | | //è°ç¨æåï¼è·åè¿åæ°æ® |
| | | result = orderBomMap.get("result"); |
| | | b = result instanceof List; |
| | | if(!b) { |
| | | log.error("è¿åç±»åéè¯¯ï¼ class:{}", result == null ? null : result.getClass()); |
| | | return; |
| | | } |
| | | List<OrderBomDTO> orderBomDTOList = (List<OrderBomDTO>) result; |
| | | b = processBillMaterialsService.saveOrUpdateOrderBom(orderMap, orderBomDTOList); |
| | | if(!b) { |
| | | log.error("ä¿å订åBOMå¤±è´¥ï¼æ¥æï¼{}", LocalDateTime.now()); |
| | | return; |
| | | } |
| | | //订åå·¥åºåæ¥ |
| | | Map<String, Object> orderProcessMap = orderProcessSync.syncOrderProcess(FACTORY_CODE, orderCodes); |
| | | if (orderBomMap == null || !SUCCESS_CODE.equals(orderProcessMap.get("ztype"))) { |
| | | log.error("æªåæ¥å°è®¢åå·¥åºä¿¡æ¯ï¼æ¥æï¼{}", LocalDateTime.now()); |
| | | return; |
| | | } |
| | | //è°ç¨æåï¼è·åè¿åæ°æ® |
| | | result = orderBomMap.get("result"); |
| | | b = result instanceof List; |
| | | if(!b) { |
| | | log.error("è¿åç±»åéè¯¯ï¼ class:{}", result == null ? null : result.getClass()); |
| | | return; |
| | | } |
| | | List<OrderProcessDTO> orderProcessDTOList = (List<OrderProcessDTO>) result; |
| | | b = materialProcessService.saveOrUpdateOrderProcess(orderMap, orderProcessDTOList); |
| | | if(!b) { |
| | | log.error("ä¿å订åå·¥åºå¤±è´¥ï¼æ¥æï¼{}", LocalDateTime.now()); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.mes.entity.MesProductionOrder; |
| | | import org.jeecg.modules.sap.dto.ProductionOrderDTO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description: SAPç产订å |
| | |
| | | */ |
| | | public interface IMesProductionOrderService extends IService<MesProductionOrder> { |
| | | |
| | | /** |
| | | * SAPåæ¥æ°æ®ä¿å |
| | | * @param productionOrderDTOList |
| | | * @return |
| | | */ |
| | | Map<String, MesProductionOrder> saveOrUpdateProductionOrder(List<ProductionOrderDTO> productionOrderDTOList); |
| | | |
| | | /** |
| | | * æ ¹æ®è®¢åå·æ¥è¯¢ |
| | | * @param orderCode |
| | | * @return |
| | | */ |
| | | MesProductionOrder getByOrderCode(String orderCode); |
| | | } |
| | |
| | | package org.jeecg.modules.mes.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.modules.mes.entity.MesProductionOrder; |
| | | import org.jeecg.modules.mes.mapper.MesProductionOrderMapper; |
| | | import org.jeecg.modules.mes.service.IMesProductionOrderService; |
| | | import org.jeecg.modules.sap.dto.ProductionOrderDTO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Description: SAPç产订å |
| | |
| | | @Service |
| | | public class MesProductionOrderServiceImpl extends ServiceImpl<MesProductionOrderMapper, MesProductionOrder> implements IMesProductionOrderService { |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Map<String, MesProductionOrder> saveOrUpdateProductionOrder(List<ProductionOrderDTO> productionOrderDTOList) { |
| | | List<MesProductionOrder> addList = new ArrayList<>(); |
| | | List<MesProductionOrder> updateList = new ArrayList<>(); |
| | | Map<String, MesProductionOrder> resultMap = new HashMap<>(); |
| | | for (ProductionOrderDTO productionOrderDTO : productionOrderDTOList) { |
| | | MesProductionOrder updated = getByOrderCode(productionOrderDTO.getAUFNR()); |
| | | if (updated == null) { |
| | | updated = new MesProductionOrder(productionOrderDTO); |
| | | addList.add(updated); |
| | | resultMap.put(updated.getOrderCode(), updated); |
| | | } else { |
| | | updated.updateEntity(productionOrderDTO); |
| | | updateList.add(updated); |
| | | resultMap.put(updated.getOrderCode(), updated); |
| | | } |
| | | } |
| | | if(CollectionUtil.isEmpty(addList)){ |
| | | super.saveBatch(addList); |
| | | } |
| | | if(CollectionUtil.isEmpty(updateList)){ |
| | | super.updateBatchById(updateList); |
| | | } |
| | | return resultMap; |
| | | } |
| | | |
| | | @Override |
| | | public MesProductionOrder getByOrderCode(String orderCode) { |
| | | LambdaQueryWrapper<MesProductionOrder> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(MesProductionOrder::getOrderCode, orderCode); |
| | | queryWrapper.eq(MesProductionOrder::getDelFlag, CommonConstant.DEL_FLAG_0); |
| | | List<MesProductionOrder> list = super.list(queryWrapper); |
| | | if (CollectionUtil.isNotEmpty(list)) { |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | import org.jeecg.modules.sap.dto.OrderProcessDTO; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "æ´æ°æ¥æ") |
| | | private Date updateTime; |
| | | /**å 餿 è®°*/ |
| | | @Excel(name = "å 餿 è®°", width = 15) |
| | | @ApiModelProperty(value = "å 餿 è®°") |
| | | @TableLogic |
| | | private Integer delFlag; |
| | | /**ç产订åID*/ |
| | | @ApiModelProperty(value = "ç产订åID") |
| | | private String orderId; |
| | | /**ç©æç¼ç */ |
| | | @Excel(name = "ç©æç¼ç ", width = 15) |
| | | @ApiModelProperty(value = "ç©æç¼ç ") |
| | | private String materialNumber; |
| | | /**ç©æåç§°*/ |
| | | @Excel(name = "ç©æåç§°", width = 15) |
| | | @ApiModelProperty(value = "ç©æåç§°") |
| | | private String materialName; |
| | | /**产线ID(SAPå·¥ä½ä¸å¿)*/ |
| | | @Excel(name = "产线ID(SAPå·¥ä½ä¸å¿)", width = 15) |
| | | @ApiModelProperty(value = "产线ID(SAPå·¥ä½ä¸å¿)") |
| | | @Dict(dictTable = "base_factory", dicCode = "id", dicText = "factory_name") |
| | | private String factoryId; |
| | | /**å·¥åºå·*/ |
| | | @Excel(name = "å·¥åºå·", width = 15) |
| | | @ApiModelProperty(value = "å·¥åºå·") |
| | | private String processCode; |
| | | /**å·¥åºåç§°*/ |
| | | @Excel(name = "å·¥åºåç§°", width = 15) |
| | | @ApiModelProperty(value = "å·¥åºåç§°") |
| | | private String processName; |
| | | /**æ§å¶ç */ |
| | | @Excel(name = "æ§å¶ç ", width = 15) |
| | | @ApiModelProperty(value = "æ§å¶ç ") |
| | | private String controlCode; |
| | | |
| | | public PmsMaterialProcess(){} |
| | | |
| | | public PmsMaterialProcess(String orderId, String materialName, OrderProcessDTO dto) { |
| | | this.orderId = orderId; |
| | | this.materialNumber = dto.getMATNR(); |
| | | this.materialName = materialName; |
| | | this.processCode = dto.getVORNR(); |
| | | this.processName = dto.getLTXA1(); |
| | | this.controlCode = dto.getSTEUS(); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "æ´æ°æ¥æ") |
| | | private Date updateTime; |
| | | /**å 餿 è®°*/ |
| | | @Excel(name = "å 餿 è®°", width = 15) |
| | | @ApiModelProperty(value = "å 餿 è®°") |
| | | @TableLogic |
| | | private Integer delFlag; |
| | | /**çæè®¢åID*/ |
| | | @Excel(name = "çæè®¢åID", width = 15) |
| | | @ApiModelProperty(value = "çæè®¢åID") |
| | | private String orderId; |
| | | /**ç©æç¼ç */ |
| | | @Excel(name = "ç©æç¼ç ", width = 15) |
| | | @ApiModelProperty(value = "ç©æç¼ç ") |
| | | private String materialNumber; |
| | | /**ç©æåç§°*/ |
| | | @Excel(name = "ç©æåç§°", width = 15) |
| | | @ApiModelProperty(value = "ç©æåç§°") |
| | | private String materialName; |
| | | /**BOM代ç */ |
| | | @Excel(name = "BOM代ç ", width = 15) |
| | | @ApiModelProperty(value = "BOM代ç ") |
| | | private String billMaterialsCode; |
| | | /**åºæ¬åä½*/ |
| | | @Excel(name = "åºæ¬åä½", width = 15) |
| | | @ApiModelProperty(value = "åºæ¬åä½") |
| | | private String productionUnit; |
| | | /**è®¢åæ°é*/ |
| | | @Excel(name = "è®¢åæ°é", width = 15) |
| | | @ApiModelProperty(value = "è®¢åæ°é") |
| | | private Double productionQuantity; |
| | | private BigDecimal productionQuantity; |
| | | } |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | import org.jeecg.modules.sap.dto.OrderBomDTO; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "æ´æ°æ¥æ") |
| | | private Date updateTime; |
| | | /**çäº§ç©æID*/ |
| | | @Excel(name = "çäº§ç©æID", width = 15) |
| | | @ApiModelProperty(value = "çäº§ç©æID") |
| | | @Dict(dictTable = "pms_process_bill_materials", dicCode = "id", dicText = "material_number") |
| | | private String materialId; |
| | | /**ç©æç¼ç */ |
| | | @Excel(name = "ç©æç¼ç ", width = 15) |
| | | @ApiModelProperty(value = "ç©æç¼ç ") |
| | | private String materialNumber; |
| | | /**ç©æåç§°*/ |
| | | @Excel(name = "ç©æåç§°", width = 15) |
| | | @ApiModelProperty(value = "ç©æåç§°") |
| | | private String materialName; |
| | | /**åºæ¬åä½*/ |
| | | @ApiModelProperty(value = "åºæ¬åä½") |
| | | private String productionUnit; |
| | | /**éæ±ç¨é*/ |
| | | @Excel(name = "éæ±ç¨é", width = 15) |
| | | @ApiModelProperty(value = "éæ±ç¨é") |
| | | private Double usageUnit; |
| | | private BigDecimal usageQuantity; |
| | | |
| | | public PmsProcessBillMaterialsDetail(){} |
| | | |
| | | public PmsProcessBillMaterialsDetail(String materialId, OrderBomDTO dto) { |
| | | this.materialId = materialId; |
| | | this.materialNumber = dto.getMATNR(); |
| | | this.materialName = dto.getMAKTX(); |
| | | this.productionUnit = dto.getMEINS(); |
| | | this.usageQuantity = new BigDecimal(dto.getBDMNG()); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.mes.entity.MesProductionOrder; |
| | | import org.jeecg.modules.pms.entity.PmsMaterialProcess; |
| | | import org.jeecg.modules.sap.dto.OrderProcessDTO; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public interface IPmsMaterialProcessService extends IService<PmsMaterialProcess> { |
| | | IPage<Map<String, Object>> getpmsMaterialProcessListData(Integer pageNo, Integer pageSize, HttpServletRequest req); |
| | | |
| | | /** |
| | | * |
| | | * @param orderMap |
| | | * @param orderProcessDTOList |
| | | * @return |
| | | */ |
| | | boolean saveOrUpdateOrderProcess(Map<String, MesProductionOrder> orderMap, List<OrderProcessDTO> orderProcessDTOList); |
| | | /** |
| | | * å é¤åæçæ°æ® |
| | | * @param orderId |
| | | */ |
| | | void removeByOrderId(String orderId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.pms.entity.PmsProcessBillMaterialsDetail; |
| | | import org.jeecg.modules.sap.dto.OrderBomDTO; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | public interface IPmsProcessBillMaterialsDetailService extends IService<PmsProcessBillMaterialsDetail> { |
| | | PmsProcessBillMaterialsDetail queryByMaterialId(String materialId); |
| | | IPage<Map<String, Object>> getpmsProcessBillMaterialsDetailListData(Integer pageNo, Integer pageSize, HttpServletRequest req); |
| | | |
| | | /** |
| | | * å é¤åæçæ°æ® |
| | | * @param materialsId |
| | | */ |
| | | void removeByMaterialsId(String materialsId); |
| | | |
| | | /** |
| | | * æ¹éä¿¡æ¯ç©ææ¸
åæç» |
| | | * @param materialsId |
| | | * @param collect |
| | | */ |
| | | void saveBatchDetail(String materialsId, List<OrderBomDTO> collect); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.mes.entity.MesProductionOrder; |
| | | import org.jeecg.modules.pms.entity.PmsProcessBillMaterials; |
| | | import org.jeecg.modules.sap.dto.OrderBomDTO; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public interface IPmsProcessBillMaterialsService extends IService<PmsProcessBillMaterials> { |
| | | IPage<Map<String, Object>> getpmsProcessBillMaterialsListData(Integer pageNo, Integer pageSize, HttpServletRequest req); |
| | | |
| | | /** |
| | | * æ¹éä¿åææ´æ°è®¢åBOMæ°æ® |
| | | * @param orderMap |
| | | * @param orderBomDTOList |
| | | * @return |
| | | */ |
| | | boolean saveOrUpdateOrderBom(Map<String, MesProductionOrder> orderMap, List<OrderBomDTO> orderBomDTOList); |
| | | |
| | | /** |
| | | * 订åç©ææ¥è¯¢ |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | PmsProcessBillMaterials getByOrderId(String orderId); |
| | | } |
| | |
| | | package org.jeecg.modules.pms.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.jeecg.modules.mes.entity.MesProductionOrder; |
| | | import org.jeecg.modules.pms.entity.PmsMaterialProcess; |
| | | import org.jeecg.modules.pms.mapper.PmsMaterialProcessMapper; |
| | | import org.jeecg.modules.pms.service.IPmsMaterialProcessService; |
| | | import org.jeecg.modules.sap.dto.OrderProcessDTO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Description: ç©æå·¥åº |
| | |
| | | } |
| | | return super.getBaseMapper().getpmsMaterialProcessListData(pageData, paramMap); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean saveOrUpdateOrderProcess(Map<String, MesProductionOrder> orderMap, List<OrderProcessDTO> orderProcessDTOList) { |
| | | for (Map.Entry<String, MesProductionOrder> entry : orderMap.entrySet()) { |
| | | MesProductionOrder order = entry.getValue(); |
| | | //å é¤åæçæ°æ® |
| | | this.removeByOrderId(order.getId()); |
| | | //éæ°æ°å¢å·¥åºä¿¡æ¯ |
| | | List<OrderProcessDTO> collect = orderProcessDTOList.stream().filter(orderProcessDTO -> entry.getKey().equals(orderProcessDTO.getAUFNR())).collect(Collectors.toList()); |
| | | if (CollectionUtil.isNotEmpty(collect)) { |
| | | List<PmsMaterialProcess> list = collect.stream().map(orderBomDTO -> new PmsMaterialProcess(entry.getKey(), order.getMaterialName(), orderBomDTO)).collect(Collectors.toList()); |
| | | super.saveBatch(list); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void removeByOrderId(String orderId) { |
| | | LambdaQueryWrapper<PmsMaterialProcess> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(PmsMaterialProcess::getOrderId, orderId); |
| | | super.remove(queryWrapper); |
| | | } |
| | | } |
| | |
| | | package org.jeecg.modules.pms.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import org.jeecg.modules.pms.entity.PmsProcessBillMaterialsDetail; |
| | | import org.jeecg.modules.pms.mapper.PmsProcessBillMaterialsDetailMapper; |
| | | import org.jeecg.modules.pms.service.IPmsProcessBillMaterialsDetailService; |
| | | import org.jeecg.modules.sap.dto.OrderBomDTO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Description: ç©ææ¸
å |
| | |
| | | } |
| | | return super.getBaseMapper().getpmsProcessBillMaterialsDetailListData(pageData, paramMap); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void removeByMaterialsId(String materialsId) { |
| | | LambdaQueryWrapper<PmsProcessBillMaterialsDetail> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(PmsProcessBillMaterialsDetail::getMaterialId, materialsId); |
| | | this.getBaseMapper().delete(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveBatchDetail(String materialsId, List<OrderBomDTO> collect) { |
| | | if (CollectionUtil.isEmpty(collect)) { |
| | | return; |
| | | } |
| | | List<PmsProcessBillMaterialsDetail> list = collect.stream().map(orderBomDTO -> new PmsProcessBillMaterialsDetail(materialsId, orderBomDTO)).collect(Collectors.toList()); |
| | | super.saveBatch(list); |
| | | } |
| | | } |
| | |
| | | package org.jeecg.modules.pms.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.jeecg.modules.mes.entity.MesProductionOrder; |
| | | import org.jeecg.modules.pms.entity.PmsProcessBillMaterials; |
| | | import org.jeecg.modules.pms.mapper.PmsProcessBillMaterialsMapper; |
| | | import org.jeecg.modules.pms.service.IPmsProcessBillMaterialsDetailService; |
| | | import org.jeecg.modules.pms.service.IPmsProcessBillMaterialsService; |
| | | import org.jeecg.modules.sap.dto.OrderBomDTO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Description: 订åBOM |
| | |
| | | */ |
| | | @Service |
| | | public class PmsProcessBillMaterialsServiceImpl extends ServiceImpl<PmsProcessBillMaterialsMapper, PmsProcessBillMaterials> implements IPmsProcessBillMaterialsService { |
| | | @Autowired |
| | | private IPmsProcessBillMaterialsDetailService processBillMaterialsDetailService; |
| | | |
| | | @Override |
| | | public IPage<Map<String, Object>> getpmsProcessBillMaterialsListData(Integer pageNo, Integer pageSize, HttpServletRequest req) { |
| | |
| | | } |
| | | return super.getBaseMapper().getpmsProcessBillMaterialsListData(pageData, paramMap); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean saveOrUpdateOrderBom(Map<String, MesProductionOrder> orderMap, List<OrderBomDTO> orderBomDTOList) { |
| | | for (Map.Entry<String, MesProductionOrder> entry : orderMap.entrySet()) { |
| | | MesProductionOrder order = entry.getValue(); |
| | | PmsProcessBillMaterials materials = getByOrderId(order.getId()); |
| | | if(materials != null) { |
| | | //æ´æ°ç©ææ°æ® |
| | | materials.setOrderId(order.getId()); |
| | | materials.setMaterialNumber(order.getMaterialNumber()); |
| | | materials.setMaterialName(order.getMaterialName()); |
| | | materials.setProductionUnit(order.getProductionUnit()); |
| | | materials.setProductionQuantity(order.getOrderQuantity()); |
| | | this.getBaseMapper().updateById(materials); |
| | | //æ´æ°ç©ææç»æ°æ® |
| | | processBillMaterialsDetailService.removeByMaterialsId(materials.getId()); |
| | | //è¿æ»¤åºæ¤è®¢åçç©æä¿¡æ¯ |
| | | List<OrderBomDTO> collect = orderBomDTOList.stream().filter(orderBomDTO -> entry.getKey().equals(orderBomDTO.getAUFNR())).collect(Collectors.toList()); |
| | | processBillMaterialsDetailService.saveBatchDetail(materials.getId(), collect); |
| | | }else { |
| | | materials = new PmsProcessBillMaterials(); |
| | | materials.setOrderId(order.getId()); |
| | | materials.setMaterialNumber(order.getMaterialNumber()); |
| | | materials.setMaterialName(order.getMaterialName()); |
| | | materials.setProductionUnit(order.getProductionUnit()); |
| | | materials.setProductionQuantity(order.getOrderQuantity()); |
| | | this.getBaseMapper().insert(materials); |
| | | //è¿æ»¤åºæ¤è®¢åçç©æä¿¡æ¯ |
| | | List<OrderBomDTO> collect = orderBomDTOList.stream().filter(orderBomDTO -> entry.getKey().equals(orderBomDTO.getAUFNR())).collect(Collectors.toList()); |
| | | processBillMaterialsDetailService.saveBatchDetail(materials.getId(), collect); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public PmsProcessBillMaterials getByOrderId(String orderId) { |
| | | LambdaQueryWrapper<PmsProcessBillMaterials> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(PmsProcessBillMaterials::getOrderId, orderId); |
| | | List<PmsProcessBillMaterials> list = super.list(queryWrapper); |
| | | if (CollectionUtil.isNotEmpty(list)) { |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | |
| | | public class FunctionConst { |
| | | //1.ç产订å忥æ¥å£ |
| | | public static String ZPPF_033_1 = "ZPPF_033_1"; |
| | | public static final String ZPPF_033_1 = "ZPPF_033_1"; |
| | | //2.订åBOM忥æ¥å£ |
| | | public static String ZPPF_033_3 = "ZPPF_033_3"; |
| | | public static final String ZPPF_033_3 = "ZPPF_033_3"; |
| | | //3.产åå·¥åºåæ¥æ¥å£ |
| | | public static String ZPPF_033_2 = "ZPPF_033_2"; |
| | | public static final String ZPPF_033_2 = "ZPPF_033_2"; |
| | | //4.ç产订åå·¥åºæ¥å·¥æ¥å£ãç产订åå
¥åºãä¸åæ ¼åå¤ç |
| | | public static String ZMES_PRODORDCONF_CREATE_TT2301 = "ZMES_PRODORDCONF_CREATE_TT2301"; |
| | | public static final String ZMES_PRODORDCONF_CREATE_TT2301 = "ZMES_PRODORDCONF_CREATE_TT2301"; |
| | | //5.çäº§è®¢åæææ¥å£ |
| | | public static String ZMES_GOODSMVT_CREATE_2301 = "ZMES_GOODSMVT_CREATE_2301"; |
| | | public static final String ZMES_GOODSMVT_CREATE_2301 = "ZMES_GOODSMVT_CREATE_2301"; |
| | | //6.ç产订åå
³éæ¥å£ |
| | | public static String ZPPF_019 = "ZPPF_019"; |
| | | public static final String ZPPF_019 = "ZPPF_019"; |
| | | } |
| | |
| | | private String MAKTX; |
| | | /** éæ±é */ |
| | | private String BDMNG; |
| | | /** MEINS */ |
| | | /** åºæ¬è®¡éåä½ */ |
| | | private String MEINS; |
| | | } |