mes-basic/src/main/java/com/chinaztt/mes/basic/controller/PartController.java
@@ -89,7 +89,15 @@ @Inner(value = false) public R triggerAdd(@RequestParam String params) { PartVo partVo = JSONObject.parseObject(params, PartVo.class); return R.ok(partService.triggerAdd(partVo)); R<Object> objectR = new R<>(); if(partService.triggerAdd(partVo).equals("1")){ objectR.setCode(1); objectR.setMsg("操作成功"); }else { objectR.setCode(0); objectR.setMsg("操作失败!联系人员查看日志!"); } return objectR; } mes-basic/src/main/java/com/chinaztt/mes/basic/service/impl/PartServiceImpl.java
@@ -509,11 +509,13 @@ //型号 part.setPartModel(partVo.getMaterial_spec()); if (partVo.getType().equals("add")){ baseMapper.insert(part); return "新增"+part.getPartNo()+"零件号成功" ; int insert = baseMapper.insert(part); log.info("新增"+part.getPartNo()+"零件号成功"); return insert>0?"1":"0" ; }else { baseMapper.update(part,Wrappers.<Part>lambdaUpdate().eq(Part::getPartNo,part.getPartNo())); return "修改"+part.getPartNo()+"零件号成功" ; int update = baseMapper.update(part, Wrappers.<Part>lambdaUpdate().eq(Part::getPartNo, part.getPartNo())); log.info("修改"+part.getPartNo()+"零件号成功"); return update>0?"1":"0" ; } } mes-plan/src/main/java/com/chinaztt/mes/plan/controller/CustomerOrderController.java
@@ -17,7 +17,6 @@ package com.chinaztt.mes.plan.controller; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.chinaztt.mes.basic.service.StaffService; @@ -52,7 +51,6 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLDecoder; import java.nio.charset.StandardCharsets; import java.util.List; @@ -530,6 +528,7 @@ */ @DeleteMapping("/processConfigFile/{id}") public R processConfigFile(@PathVariable Long id) { System.out.println("执行删除------>"+id); return customerOrderService.deleteProcessConfigFile(id); } mes-plan/src/main/java/com/chinaztt/mes/plan/controller/MasterProductionScheduleController.java
@@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.chinaztt.mes.common.wrapper.QueryWrapperUtil; import com.chinaztt.mes.plan.dto.*; import com.chinaztt.mes.plan.entity.CustomerOrder; import com.chinaztt.mes.plan.dto.CustomerOrderDTO; import com.chinaztt.mes.plan.dto.MasterProductionScheduleDTO; import com.chinaztt.mes.plan.dto.MpsStructureComponentDTO; import com.chinaztt.mes.plan.dto.MpsStructureComponentTreeNode; import com.chinaztt.mes.plan.entity.MasterProductionSchedule; import com.chinaztt.mes.plan.entity.OperationTaskProduce; import com.chinaztt.mes.plan.service.MasterProductionScheduleService; @@ -13,6 +15,7 @@ import com.chinaztt.mes.technology.service.StructureService; import com.chinaztt.ztt.common.core.util.R; import com.chinaztt.ztt.common.log.annotation.SysLog; import com.chinaztt.ztt.common.security.annotation.Inner; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; @@ -351,6 +354,11 @@ .eq(MasterProductionSchedule::getMpsNo, mpsNo))); } @ApiOperation(value = "通过主计划查询ifs库存生产采购计划", notes = "通过主计划查询ifs库存生产采购计划") @PostMapping("/addPlanPurchasing") @Inner(value = false) public R addPlanPurchasing(@RequestParam(required = false) List<MasterProductionSchedule>masterProductionSchedules){ return R.ok(masterProductionScheduleService.addPlanPurchasing(masterProductionSchedules)); } } mes-plan/src/main/java/com/chinaztt/mes/plan/service/MasterProductionScheduleService.java
@@ -190,4 +190,5 @@ */ MasterProductionScheduleDTO getById(Long id); boolean addPlanPurchasing(List<MasterProductionSchedule>masterProductionSchedules); } mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java
@@ -93,10 +93,10 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.util.Assert; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -194,7 +194,7 @@ private final static String AFFILIATED_CONTRACT = "中天注塑厂"; //private FileSaveUtil fileSaveUtil; @Override public void otcDownload(Long id, HttpServletResponse response) { @@ -1908,7 +1908,9 @@ public R deleteProcessConfigFile(Long id) { try { OrderProcessConfigFile configFile = orderProcessConfigFileMapper.selectById(id); minioTemplate.removeObject(configFile.getBucketName(), configFile.getFileName()); String filePath=FileSaveUtil.FILE_PATH+"//"+configFile.getBucketName(); boolean del = FileUtil.del(new File(filePath)); //minioTemplate.removeObject(configFile.getBucketName(), configFile.getFileName()); orderProcessConfigFileMapper.deleteById(id); processConfigFileOrderMappingMapper.delete(Wrappers.<ProcessConfigFileOrderMapping>lambdaQuery().eq(ProcessConfigFileOrderMapping::getConfigFileId, id)); return R.ok(); mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/MasterProductionScheduleServiceImpl.java
@@ -1,6 +1,7 @@ package com.chinaztt.mes.plan.service.impl; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -19,7 +20,10 @@ import com.chinaztt.mes.common.oa.OAResult; import com.chinaztt.mes.common.util.StateResult; import com.chinaztt.mes.plan.dto.*; import com.chinaztt.mes.plan.entity.*; import com.chinaztt.mes.plan.entity.MasterProductionSchedule; import com.chinaztt.mes.plan.entity.MasterProductionScheduleTheoryQuantity; import com.chinaztt.mes.plan.entity.MpsStructureComponent; import com.chinaztt.mes.plan.entity.OperationTaskProduce; import com.chinaztt.mes.plan.mapper.*; import com.chinaztt.mes.plan.service.CustomerOrderService; import com.chinaztt.mes.plan.service.MasterProductionScheduleService; @@ -28,7 +32,6 @@ import com.chinaztt.mes.plan.state.masterproductionschedule.constant.MasterProductionScheduleEvents; import com.chinaztt.mes.plan.state.masterproductionschedule.constant.MasterProductionScheduleStates; import com.chinaztt.mes.technology.entity.Document; import com.chinaztt.mes.technology.entity.Operation; import com.chinaztt.mes.technology.entity.Routing; import com.chinaztt.mes.technology.entity.Structure; import com.chinaztt.mes.technology.mapper.DocumentMapper; @@ -40,6 +43,7 @@ import com.chinaztt.ztt.common.core.util.R; import com.chinaztt.ztt.common.security.util.SecurityUtils; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.messaging.Message; import org.springframework.messaging.support.MessageBuilder; @@ -50,7 +54,6 @@ import org.springframework.util.CollectionUtils; import java.math.BigDecimal; import java.time.format.DateTimeFormatter; import java.util.Comparator; import java.util.HashMap; import java.util.List; @@ -63,6 +66,7 @@ * @author cxf * @date 2020-09-21 14:42:39 */ @Slf4j @Service @AllArgsConstructor @Transactional(rollbackFor = Exception.class) @@ -86,6 +90,7 @@ private StructureMapper structureMapper; private StateMachineFactory<MasterProductionScheduleStates, MasterProductionScheduleEvents> masterproductionscheduleStateMachineFactory; private StateMachinePersister<MasterProductionScheduleStates, MasterProductionScheduleEvents, MasterProductionSchedule> persister; @Override public IPage<List<MasterProductionScheduleDTO>> getMasterProductionSchedulePage(Page page, QueryWrapper<MasterProductionScheduleDTO> masterProductionScheduleDTO) { @@ -457,4 +462,28 @@ masterProductionScheduleDTO.setOutPutBatchList(operationTaskProduceList); return masterProductionScheduleDTO; } /** * 添加采购计划 * @param masterProductionSchedules * @return */ @Override public boolean addPlanPurchasing(List<MasterProductionSchedule>masterProductionSchedules) { masterProductionSchedules.forEach(p->{ Long technologyDocumentId = p.getTechnologyDocumentId(); Document document = documentMapper.selectById(technologyDocumentId); Long firstPart = document.getPartId(); String url="http://192.168.20.47:8008/PurchService.ashx?contract=ZTKJ&contractKey=4ttDeLKNsZuhstjtROMcRE1USNFXKdFYE7lQ2p1m5Bo=&procedureName=QUERY_INVENTORY_INFO_STD&userId=7632&inAttr={\"LOCATION_NO\": \"1019\",\"PART_NO\":"+p+"}"; String body = HttpRequest.get(url).execute().body(); JSONObject partInfo = JSONObject.parseObject(body); log.info("库存零件======>"+partInfo); }); return false; } } mes-plan/src/main/resources/mapper/MasterProductionScheduleMapper.xml
@@ -57,7 +57,9 @@ </resultMap> <select id="getDtoById" resultType="com.chinaztt.mes.plan.dto.MasterProductionScheduleDTO"> SELECT * FROM plan_master_production_schedule where ID = #{id} SELECT * FROM plan_master_production_schedule where ID = #{id} </select> <select id="getMasterProductionSchedulePage" resultMap="masterProductionScheduleMap"> @@ -109,7 +111,8 @@ from warehouse_join_stock_order wjso left join plan_customer_order pco on pco."id" = wjso.customer_order_id left join plan_join_model_customer pjmc on pjmc.customer_order_id = pco."id" AND pjmc.model = 'plan_master_production_schedule' left join plan_join_model_customer pjmc on pjmc.customer_order_id = pco."id" AND pjmc.model = 'plan_master_production_schedule' where wjso.type = '客户订单预留' and status = '02confirmed' and pjmc.model_id = pmps.id @@ -126,7 +129,8 @@ ) manufacturing_quantity from plan_master_production_schedule pmps left join basic_part bp on bp."id" = pmps.part_id left join plan_join_model_customer pjmc on pjmc.model_id = pmps.id and pjmc.model = 'plan_master_production_schedule' left join plan_join_model_customer pjmc on pjmc.model_id = pmps.id and pjmc.model = 'plan_master_production_schedule' left join plan_customer_order pco on pco.id = pjmc.customer_order_id left join plan_customer_order_param pcop on pcop.order_id = pco.id and pcop.field = 'LengthRequirement' left join plan_customer_order_param pcop2 on pcop2.order_id = pco.id and pcop2.field = 'Remark' @@ -153,8 +157,7 @@ </select> <select id="getByIdExt" resultMap="masterProductionScheduleMap"> select D.id, select D.id, D.factory_id, D.mps_no, D.required_date, @@ -180,18 +183,18 @@ D.manufacture_attr, D.promised_delivery_date FROM ( select pmps.*, select pmps.*, bp.part_no, bp.part_name, bp.description part_description, bp.unit, ( SELECT coalesce(sum(wjso.reserved_quantity), 0) from warehouse_join_stock_order wjso from warehouse_join_stock_order wjso left join plan_customer_order pco on pco."id" = wjso.customer_order_id left join plan_join_model_customer pjmc on pjmc.customer_order_id = pco."id" AND pjmc.model = 'plan_master_production_schedule' left join plan_join_model_customer pjmc on pjmc.customer_order_id = pco."id" AND pjmc.model = 'plan_master_production_schedule' where wjso.type = '客户订单预留' and status = '02confirmed' and pjmc.model_id = pmps.id mes-web/src/main/resources/bootstrap.yml
@@ -6,9 +6,9 @@ druid: username: postgres # password: postgres123 password: root2022 password: zsAdmin123! # 射频开发数据库 url: jdbc:postgresql://127.0.0.1:5432/postgres url: jdbc:postgresql://10.1.51.136:5432/zs_dev application: name: ztt-mes cloud: @@ -17,7 +17,7 @@ # password: nacos password: zttZTT123! discovery: server-addr: 106.13.194.57:8848 server-addr: 127.0.0.1:8848 metadata: # VERSION: 10.88.15.224 VERSION: 127.0.0.1