From 19047b80730d085e2e7cdde6478f35c9e7214eaa Mon Sep 17 00:00:00 2001 From: philip <244793088@qq.com> Date: Thu, 15 Jul 2021 09:47:46 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=87=AA=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataimport/handler/HandlerFactory.java | 2 + .../handler/InspectionItemHandler.java | 94 ++++ .../service/MasterObjectDefine.java | 15 + .../controller/CutterLogController.java | 137 +++++ .../production/controller/ToolController.java | 3 +- .../production/mapper/CutterLogMapper.java | 18 + .../mesnac/production/model/CutterLog.java | 264 ++++++++++ .../production/service/CutterLogService.java | 31 ++ .../service/impl/CutterLogServiceImpl.java | 121 +++++ .../service/impl/PodTemplateServiceImpl.java | 54 ++ .../main/resources/mapper/CutterLogMapper.xml | 466 ++++++++++++++++++ .../src/main/resources/mapper/ToolMapper.xml | 2 +- .../service/impl/SelfReportServiceImpl.java | 6 +- 13 files changed, 1209 insertions(+), 4 deletions(-) create mode 100644 dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/InspectionItemHandler.java create mode 100644 production/src/main/java/com/foreverwin/mesnac/production/controller/CutterLogController.java create mode 100644 production/src/main/java/com/foreverwin/mesnac/production/mapper/CutterLogMapper.java create mode 100644 production/src/main/java/com/foreverwin/mesnac/production/model/CutterLog.java create mode 100644 production/src/main/java/com/foreverwin/mesnac/production/service/CutterLogService.java create mode 100644 production/src/main/java/com/foreverwin/mesnac/production/service/impl/CutterLogServiceImpl.java create mode 100644 production/src/main/resources/mapper/CutterLogMapper.xml diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/HandlerFactory.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/HandlerFactory.java index 67568908..244cd285 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/HandlerFactory.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/HandlerFactory.java @@ -24,6 +24,8 @@ public class HandlerFactory { return new NCGroupHandler(); case "ncCode" : return new NCCodeHandler(); + case "inspectionItem" : + return new InspectionItemHandler(); case "messageType" : //return new MessageTypeHandler(); } diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/InspectionItemHandler.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/InspectionItemHandler.java new file mode 100644 index 00000000..7f253f17 --- /dev/null +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/InspectionItemHandler.java @@ -0,0 +1,94 @@ +package com.foreverwin.mesnac.dataimport.handler; + +import com.alibaba.fastjson.JSONObject; +import com.foreverwin.mesnac.dataimport.client.ResourceTypeWSClient; +import com.foreverwin.mesnac.dataimport.handler.base.BaseHandler; +import com.foreverwin.mesnac.dataimport.reader.FileReader; +import com.foreverwin.mesnac.dataimport.reader.FileReaderBuilder; +import com.foreverwin.mesnac.dataimport.reader.RowVisitor; +import com.foreverwin.mesnac.dataimport.service.MasterObjectDefine; +import com.foreverwin.modular.core.exception.BusinessException; +import com.foreverwin.modular.core.util.I18nUtil; +import com.sap.me.plant.ResourceTypeBasicConfiguration; + +import java.io.InputStream; +import java.util.Collection; +import java.util.Map; + +public class InspectionItemHandler extends BaseHandler { + + @Override + public String importFile(String site, InputStream inputStream, String fileType, String mode) throws Exception { + int row = 0; + StringBuffer buffer = new StringBuffer(); + Integer[] failedNumber = new Integer[]{0}; + + try { + FileReader fileReader = new FileReaderBuilder().build(fileType); + RowVisitor visitor = getRowVisitor(site, mode, buffer, failedNumber); + row = fileReader.visitor(visitor).read(inputStream, getHeaders()); + } catch (Exception e) { + buffer.append(e.getMessage() + "\n"); + } + + if (buffer.length() > 0) { + buffer.insert(0, I18nUtil.getI18nText("MaterData.import.Summary", new Object[]{row + failedNumber[0], row, failedNumber[0]}) + "\n"); + throw BusinessException.build(buffer.toString()); + } + buffer.insert(0, I18nUtil.getI18nText("MaterData.import.Summary", new Object[]{row + failedNumber[0], row, failedNumber[0]}) + "\n"); + + return buffer.toString(); + } + + @Override + public Map getHeaders() { + return MasterObjectDefine.getHeadsMapping("RESOURCE_TYPE"); + } + + public RowVisitor getRowVisitor(String site, String mode, StringBuffer buffer, Integer[] failedNumber) { + + return new RowVisitor() { + @Override + public int visit(long index, JSONObject jsonObject) { + Object[] params = new Object[10]; + params[0] = index; + params[1] = jsonObject.getString("resourceType"); + + String resultMessage = null; + try { + if (jsonObject.containsKey("resourceType") && jsonObject.getString("resourceType").trim().length() > 0) { + jsonObject.put("site", site); + Collection collection = ResourceTypeWSClient.find(jsonObject); + if (collection.size() > 0) { + resultMessage = "资源类型主数据已经存在"; + } else { + resultMessage = ResourceTypeWSClient.insert(jsonObject); + if (resultMessage == null) { + return 1; + } + } + + if (resultMessage != null) { + params[2] = resultMessage; + failedNumber[0]++; + buffer.append("第" + index + "行:" + I18nUtil.getI18nText("MaterData.import.insert.fail", params) + "\n"); + return 0; + } + } + return 0; + } catch (Exception e) { + params[2] = e.getMessage(); + failedNumber[0]++; + buffer.append("第" + index + "行:" + I18nUtil.getI18nText("MaterData.import.insert.fail", params) + "\n"); + } + + return 0; + } + + @Override + public String[] getHeader() { + return null; + } + }; + } +} diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/service/MasterObjectDefine.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/service/MasterObjectDefine.java index b50c9678..960d9e2c 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/service/MasterObjectDefine.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/service/MasterObjectDefine.java @@ -139,6 +139,21 @@ public class MasterObjectDefine { cvsHeadsMapping.put("seqNum","纠正预防措施时间"); break; + case "INSPECTION_ITEM": + cvsHeadsMapping = new HashMap<>(); + + cvsHeadsMapping.put("seqNum","序号"); + cvsHeadsMapping.put("seqNum","消息类型"); + cvsHeadsMapping.put("seqNum","消息正文"); + cvsHeadsMapping.put("seqNum","响应用户组"); + cvsHeadsMapping.put("seqNum","响应用户组"); + cvsHeadsMapping.put("seqNum","响应时间(H)"); + cvsHeadsMapping.put("seqNum","响应超期上报用户组"); + cvsHeadsMapping.put("seqNum","出具方案时间(H)"); + cvsHeadsMapping.put("seqNum","方案关闭时通知用户组"); + cvsHeadsMapping.put("seqNum","纠正预防措施用户组"); + cvsHeadsMapping.put("seqNum","纠正预防措施时间"); + break; default: break; } diff --git a/production/src/main/java/com/foreverwin/mesnac/production/controller/CutterLogController.java b/production/src/main/java/com/foreverwin/mesnac/production/controller/CutterLogController.java new file mode 100644 index 00000000..4cbc63a5 --- /dev/null +++ b/production/src/main/java/com/foreverwin/mesnac/production/controller/CutterLogController.java @@ -0,0 +1,137 @@ +package com.foreverwin.mesnac.production.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.foreverwin.mesnac.production.model.CutterLog; +import com.foreverwin.mesnac.production.service.CutterLogService; +import com.foreverwin.modular.core.util.FrontPage; +import com.foreverwin.modular.core.util.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +/** + * + * @author Philip + * @since 2021-07-14 + */ +@RestController +@RequestMapping("/Z-CUTTER-LOG") +public class CutterLogController { + + @Autowired + public CutterLogService cutterLogService; + /** + * 添加 + * @return + */ + @ResponseBody + @PostMapping("/doAdd") + public R doAdd(@RequestBody Map map){ + cutterLogService.doAdd(map); + return R.ok(); + } + /** + * 根据id查询 + * + * @param id 主键 + * @return + */ + @ResponseBody + @GetMapping("/{id:.+}") + public R getCutterLogById(@PathVariable String id) { + return R.ok( cutterLogService.getById(id)); + } + + /** + * 查询所有数据 + * + * @return + */ + @ResponseBody + @GetMapping("") + public R getCutterLogList(CutterLog cutterLog){ + List result; + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(cutterLog); + result = cutterLogService.list(queryWrapper); + return R.ok(result); + } + + /** + * 分页查询数据 + * + * @param frontPage 分页信息 + * @return + */ + @ResponseBody + @GetMapping("/page") + public R page(FrontPage frontPage, CutterLog cutterLog){ + IPage result; + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(cutterLog); + if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) { + //TODO modify global query + queryWrapper.lambda().and(wrapper -> wrapper + .like(CutterLog::getHandle, frontPage.getGlobalQuery()) + .or().like(CutterLog::getSite, frontPage.getGlobalQuery()) + .or().like(CutterLog::getCutter, frontPage.getGlobalQuery()) + .or().like(CutterLog::getShopOrder, frontPage.getGlobalQuery()) + .or().like(CutterLog::getWorkCenter, frontPage.getGlobalQuery()) + .or().like(CutterLog::getSfc, frontPage.getGlobalQuery()) + .or().like(CutterLog::getType, frontPage.getGlobalQuery()) + .or().like(CutterLog::getOperation, frontPage.getGlobalQuery()) + .or().like(CutterLog::getStepId, frontPage.getGlobalQuery()) + .or().like(CutterLog::getItem, frontPage.getGlobalQuery()) + .or().like(CutterLog::getResrce, frontPage.getGlobalQuery()) + .or().like(CutterLog::getCreateUser, frontPage.getGlobalQuery()) + ); + } + result = cutterLogService.page(frontPage.getPagePlus(), queryWrapper); + return R.ok(result); + } + + /** + * 新增 + * @param cutterLog 传递的实体 + * @return null 失败 实体成功 + */ + @PostMapping + public R save(@RequestBody CutterLog cutterLog) { + return R.ok(cutterLogService.save(cutterLog)); + } + + /** + * 修改 + * @param cutterLog 传递的实体 + * @return null 失败 实体成功 + */ + @PutMapping + public R updateById(@RequestBody CutterLog cutterLog) { + return R.ok(cutterLogService.updateById(cutterLog)); + } + + /** + * 根据id删除对象 + * @param id 实体ID + * @return 0 失败 1 成功 + */ + @ResponseBody + @RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}") + public R removeById(@PathVariable("id") String id){ + return R.ok(cutterLogService.removeById(id)); + } + + /** + * 批量删除对象 + * @param ids 实体集合ID + * @return 0 失败 1 成功 + */ + @ResponseBody + @RequestMapping(method = RequestMethod.POST, value = "/delete-batch") + public R removeByIds(List ids){ + return R.ok(cutterLogService.removeByIds(ids)); + } +} \ No newline at end of file diff --git a/production/src/main/java/com/foreverwin/mesnac/production/controller/ToolController.java b/production/src/main/java/com/foreverwin/mesnac/production/controller/ToolController.java index 976358d8..6581ac02 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/controller/ToolController.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/controller/ToolController.java @@ -65,6 +65,7 @@ public class ToolController { public R page(FrontPage frontPage, Tool tool){ IPage result; QueryWrapper queryWrapper = new QueryWrapper<>(); + tool.setSite(CommonMethods.getSite()); queryWrapper.setEntity(tool); if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) { //TODO modify global query @@ -73,7 +74,7 @@ public class ToolController { .or().like(Tool::getSite, frontPage.getGlobalQuery()) .or().like(Tool::getTool, frontPage.getGlobalQuery()) .or().like(Tool::getDescription, frontPage.getGlobalQuery()) - .or().like(Tool::getStatus, frontPage.getGlobalQuery()) + .or().like(Tool::getStatus, frontPage.getGlobalQuery()) .or().like(Tool::getToolType, frontPage.getGlobalQuery()) .or().like(Tool::getSpecification, frontPage.getGlobalQuery()) .or().like(Tool::getBrand, frontPage.getGlobalQuery()) diff --git a/production/src/main/java/com/foreverwin/mesnac/production/mapper/CutterLogMapper.java b/production/src/main/java/com/foreverwin/mesnac/production/mapper/CutterLogMapper.java new file mode 100644 index 00000000..2b2f290c --- /dev/null +++ b/production/src/main/java/com/foreverwin/mesnac/production/mapper/CutterLogMapper.java @@ -0,0 +1,18 @@ +package com.foreverwin.mesnac.production.mapper; + +import com.foreverwin.mesnac.production.model.CutterLog; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 刀具记录表 Mapper 接口 + *

+ * + * @author Philip + * @since 2021-07-14 + */ +@Repository +public interface CutterLogMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/production/src/main/java/com/foreverwin/mesnac/production/model/CutterLog.java b/production/src/main/java/com/foreverwin/mesnac/production/model/CutterLog.java new file mode 100644 index 00000000..627e7c9c --- /dev/null +++ b/production/src/main/java/com/foreverwin/mesnac/production/model/CutterLog.java @@ -0,0 +1,264 @@ +package com.foreverwin.mesnac.production.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 刀具记录表 + *

+ * + * @author Philip + * @since 2021-07-14 + */ + +@TableName("Z_CUTTER_LOG") + +public class CutterLog extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "HANDLE", type = IdType.INPUT) + private String handle; + /** + * 站点 + */ + @TableField("SITE") + private String site; + /** + * 刀具 + */ + @TableField("CUTTER") + private String cutter; + /** + * 工单 + */ + @TableField("SHOP_ORDER") + private String shopOrder; + /** + * 车间 + */ + @TableField("WORK_CENTER") + private String workCenter; + /** + * 产品条码 + */ + @TableField("SFC") + private String sfc; + /** + * 类别 + */ + @TableField("TYPE") + private String type; + /** + * 工序 + */ + @TableField("OPERATION") + private String operation; + /** + * 步骤 + */ + @TableField("STEP_ID") + private String stepId; + /** + * 物料 + */ + @TableField("ITEM") + private String item; + /** + * 资源 + */ + @TableField("RESRCE") + private String resrce; + /** + * 使用数量 + */ + @TableField("QTY") + private Long qty; + /** + * 创建人 + */ + @TableField("CREATE_USER") + private String createUser; + /** + * 创建时间 + */ + @TableField("CREATED_DATE_TIME") + private LocalDateTime createdDateTime; + + + public String getHandle() { + return handle; + } + + public void setHandle(String handle) { + this.handle = handle; + } + + public String getSite() { + return site; + } + + public void setSite(String site) { + this.site = site; + } + + public String getCutter() { + return cutter; + } + + public void setCutter(String cutter) { + this.cutter = cutter; + } + + public String getShopOrder() { + return shopOrder; + } + + public void setShopOrder(String shopOrder) { + this.shopOrder = shopOrder; + } + + public String getWorkCenter() { + return workCenter; + } + + public void setWorkCenter(String workCenter) { + this.workCenter = workCenter; + } + + public String getSfc() { + return sfc; + } + + public void setSfc(String sfc) { + this.sfc = sfc; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getOperation() { + return operation; + } + + public void setOperation(String operation) { + this.operation = operation; + } + + public String getStepId() { + return stepId; + } + + public void setStepId(String stepId) { + this.stepId = stepId; + } + + public String getItem() { + return item; + } + + public void setItem(String item) { + this.item = item; + } + + public String getResrce() { + return resrce; + } + + public void setResrce(String resrce) { + this.resrce = resrce; + } + + public Long getQty() { + return qty; + } + + public void setQty(Long qty) { + this.qty = qty; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public LocalDateTime getCreatedDateTime() { + return createdDateTime; + } + + public void setCreatedDateTime(LocalDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + } + +public static final String HANDLE = "HANDLE"; + +public static final String SITE = "SITE"; + +public static final String CUTTER = "CUTTER"; + +public static final String SHOP_ORDER = "SHOP_ORDER"; + +public static final String WORK_CENTER = "WORK_CENTER"; + +public static final String SFC = "SFC"; + +public static final String TYPE = "TYPE"; + +public static final String OPERATION = "OPERATION"; + +public static final String STEP_ID = "STEP_ID"; + +public static final String ITEM = "ITEM"; + +public static final String RESRCE = "RESRCE"; + +public static final String QTY = "QTY"; + +public static final String CREATE_USER = "CREATE_USER"; + +public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME"; + + + @Override + protected Serializable pkVal() { + return this.handle; + } + + @Override + public String toString() { + return "CutterLog{" + + "handle = " + handle + + ", site = " + site + + ", cutter = " + cutter + + ", shopOrder = " + shopOrder + + ", workCenter = " + workCenter + + ", sfc = " + sfc + + ", type = " + type + + ", operation = " + operation + + ", stepId = " + stepId + + ", item = " + item + + ", resrce = " + resrce + + ", qty = " + qty + + ", createUser = " + createUser + + ", createdDateTime = " + createdDateTime + + "}"; + } +} \ No newline at end of file diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/CutterLogService.java b/production/src/main/java/com/foreverwin/mesnac/production/service/CutterLogService.java new file mode 100644 index 00000000..c837bf87 --- /dev/null +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/CutterLogService.java @@ -0,0 +1,31 @@ +package com.foreverwin.mesnac.production.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.foreverwin.mesnac.production.model.CutterLog; +import com.baomidou.mybatisplus.extension.service.IService; +import com.foreverwin.modular.core.util.FrontPage; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 刀具记录表 服务类 + *

+ * + * @author Philip + * @since 2021-07-14 + */ +public interface CutterLogService extends IService { + + /** + * 分页查询 + * @param frontPage + * @return + */ + IPage selectPage(FrontPage frontPage, CutterLog cutterLog); + + List selectList(CutterLog cutterLog); + + void doAdd(Map map); +} \ No newline at end of file diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/CutterLogServiceImpl.java b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/CutterLogServiceImpl.java new file mode 100644 index 00000000..00a018f2 --- /dev/null +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/CutterLogServiceImpl.java @@ -0,0 +1,121 @@ +package com.foreverwin.mesnac.production.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.foreverwin.mesnac.common.constant.Constants; +import com.foreverwin.mesnac.common.enums.HandleEnum; +import com.foreverwin.mesnac.common.service.CommonService; +import com.foreverwin.mesnac.common.util.StringUtil; +import com.foreverwin.mesnac.meapi.dto.SfcDto; +import com.foreverwin.mesnac.production.mapper.CutterLogMapper; +import com.foreverwin.mesnac.production.mapper.SfcCrossMapper; +import com.foreverwin.mesnac.production.model.CutterLog; +import com.foreverwin.mesnac.production.model.Tool; +import com.foreverwin.mesnac.production.service.CutterLogService; +import com.foreverwin.mesnac.production.service.ToolService; +import com.foreverwin.modular.core.exception.BaseException; +import com.foreverwin.modular.core.util.CommonMethods; +import com.foreverwin.modular.core.util.FrontPage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + *

+ * 刀具记录表 服务实现类 + *

+ * + * @author Philip + * @since 2021-07-14 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class CutterLogServiceImpl extends ServiceImpl implements CutterLogService { + + + @Autowired + private CutterLogMapper cutterLogMapper; + @Autowired + private SfcCrossMapper sfcCorssMapper; + @Autowired + private CommonService commonService; + @Autowired + private ToolService toolService; + @Override + public IPage selectPage(FrontPage frontPage, CutterLog cutterLog) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(cutterLog); + return super.page(frontPage.getPagePlus(), queryWrapper); + } + + @Override + public List selectList(CutterLog cutterLog) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(cutterLog); + return super.list(queryWrapper); + } + + @Override + public void doAdd(Map map) { + String site = CommonMethods.getSite(); + String user = CommonMethods.getUser(); + String sfc = (String)map.get("sfc"); + String resrce = (String)map.get("resrce"); + List list = (List)map.get("cutterList"); + ObjectMapper mapper = new ObjectMapper(); + list = mapper.convertValue(list, new TypeReference>() {}); + SfcDto sfcDto = new SfcDto(); + sfcDto.setSfc(sfc); + sfcDto.setResrce(resrce); + Map sfcData = sfcCorssMapper.querySfcData(site, LocaleContextHolder.getLocale().getLanguage(), sfcDto); + if (sfcData == null) { + throw new BaseException("根据当前资源未找到条码[" + sfc + "]的基本信息!"); + } + String operation = (String)sfcData.get("OPERATION"); + String stepId = (String)sfcData.get("STEP_ID"); + String shopOrder = (String)sfcData.get("SHOP_ORDER"); + String item = (String)sfcData.get("ITEM"); + String workShopBo = commonService.getWorkShopBo(HandleEnum.RESOURCE.getHandle(site, resrce)); + String workShop = StringUtil.trimHandle(workShopBo); + if(list==null||list.size()<1){ + throw new BaseException("刀具列表不能为空"); + } + list.forEach(cutterLog->{ + String handle = UUID.randomUUID().toString(); + cutterLog.setHandle(handle); + //校验刀具是否存在 + String cutter = cutterLog.getCutter(); + QueryWrapper query=new QueryWrapper<>(); + query.eq(Tool.SITE,site); + query.eq(Tool.TOOL,cutter); + query.eq(Tool.STATUS, Constants.STATUS_Y); + List toolList = toolService.list(query); + if (toolList.size()<1){ + throw new BaseException("不存在的刀具"); + } + cutterLog.setSite(site); + cutterLog.setShopOrder(shopOrder); + cutterLog.setWorkCenter(workShop); + cutterLog.setSfc(sfc); + cutterLog.setOperation(operation); + cutterLog.setStepId(stepId); + cutterLog.setItem(item); + cutterLog.setResrce(resrce); + cutterLog.setCreateUser(user); + cutterLog.setCreatedDateTime(LocalDateTime.now()); + save(cutterLog); + }); + + } + + +} \ No newline at end of file diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java index 92abfd5d..4f23b055 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java @@ -5,12 +5,17 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.foreverwin.mesnac.common.constant.Constants; import com.foreverwin.mesnac.common.enums.DispatchStatusEnum; import com.foreverwin.mesnac.common.enums.HandleEnum; +import com.foreverwin.mesnac.common.erp.ZprodordconfStruIn; +import com.foreverwin.mesnac.common.erp.ZprodordconfStruOut; +import com.foreverwin.mesnac.common.erp.holders.TableOfZprodordconfStruInHolder; +import com.foreverwin.mesnac.common.erp.holders.TableOfZprodordconfStruOutHolder; import com.foreverwin.mesnac.common.model.InspectionItemDetail; import com.foreverwin.mesnac.common.model.InspectionTask; import com.foreverwin.mesnac.common.service.CommonService; import com.foreverwin.mesnac.common.service.InspectionItemService; import com.foreverwin.mesnac.common.service.InspectionTaskService; import com.foreverwin.mesnac.common.service.SfcDispatchCommonService; +import com.foreverwin.mesnac.common.util.ERPAPI; import com.foreverwin.mesnac.common.util.ExceptionUtil; import com.foreverwin.mesnac.common.util.StringUtil; import com.foreverwin.mesnac.meapi.dto.SfcDto; @@ -32,6 +37,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; +import java.rmi.RemoteException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -242,4 +248,52 @@ public class PodTemplateServiceImpl implements PodTemplateService { sfcDispatchCommonService.updateSfcDispatchStatus(site,CommonMethods.getUser(),dispatchNo, DispatchStatusEnum.COMPLETE.getCode()); }); } + void senErp() throws RemoteException { + String shopOrder = "SO20210714"; + String stepId = "OP001"; + + + //请求参数 + ZprodordconfStruIn[] ins = new ZprodordconfStruIn[1]; + + ZprodordconfStruIn struIn = new ZprodordconfStruIn(); + //生产订单 + struIn.setAufnr(shopOrder); + //步骤标示 + struIn.setVornr(stepId); + struIn.setAueru("1"); + //良品数量 + struIn.setLmnga(new BigDecimal(10)); + //报废数量 + struIn.setXmnga(new BigDecimal(1)); + //机器工时 + struIn.setIsm01(new BigDecimal(1)); + //人工工时 + struIn.setIsm02(new BigDecimal(1)); + struIn.setIsm03(new BigDecimal(1)); + struIn.setIsm04(new BigDecimal(1)); + struIn.setIsm05(new BigDecimal(1)); + struIn.setIsm06(new BigDecimal(1)); + ins[0] = struIn; + TableOfZprodordconfStruInHolder inHolder = new TableOfZprodordconfStruInHolder(ins); + + //返回对象 + ZprodordconfStruOut[] outs = new ZprodordconfStruOut[1]; + + ZprodordconfStruOut struOut = new ZprodordconfStruOut(); + struOut.setAufnr(shopOrder); + struOut.setVornr(stepId); + struOut.setAueru("1"); + struOut.setLmnga(new BigDecimal(1)); + struOut.setRet(""); + struOut.setMsg(""); + outs[0] = struOut; + TableOfZprodordconfStruOutHolder outHolder = new TableOfZprodordconfStruOutHolder(outs); + + //调用WS + ERPAPI.erpWebService().zmesProdordconf(inHolder, outHolder); + String status = outHolder.value[1].getRet(); + String message = outHolder.value[1].getMsg(); + System.out.println("ERP接口返回:状态:" + status + ",消息:" + message); + } } diff --git a/production/src/main/resources/mapper/CutterLogMapper.xml b/production/src/main/resources/mapper/CutterLogMapper.xml new file mode 100644 index 00000000..4d665b5c --- /dev/null +++ b/production/src/main/resources/mapper/CutterLogMapper.xml @@ -0,0 +1,466 @@ + + + + + + + + + + + + + + + + + + + + + + + + + HANDLE, SITE, CUTTER, SHOP_ORDER, WORK_CENTER, SFC, TYPE, OPERATION, STEP_ID, ITEM, RESRCE, QTY, CREATE_USER, CREATED_DATE_TIME + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO Z_CUTTER_LOG + + HANDLE, + SITE, + CUTTER, + SHOP_ORDER, + WORK_CENTER, + SFC, + TYPE, + OPERATION, + STEP_ID, + ITEM, + RESRCE, + QTY, + CREATE_USER, + CREATED_DATE_TIME, + VALUES + + #{handle}, + #{site}, + #{cutter}, + #{shopOrder}, + #{workCenter}, + #{sfc}, + #{type}, + #{operation}, + #{stepId}, + #{item}, + #{resrce}, + #{qty}, + #{createUser}, + #{createdDateTime}, + + + + + INSERT INTO Z_CUTTER_LOG + + + VALUES + + #{handle}, + #{site}, + #{cutter}, + #{shopOrder}, + #{workCenter}, + #{sfc}, + #{type}, + #{operation}, + #{stepId}, + #{item}, + #{resrce}, + #{qty}, + #{createUser}, + #{createdDateTime}, + + + + + + UPDATE Z_CUTTER_LOG + SITE=#{et.site}, + CUTTER=#{et.cutter}, + SHOP_ORDER=#{et.shopOrder}, + WORK_CENTER=#{et.workCenter}, + SFC=#{et.sfc}, + TYPE=#{et.type}, + OPERATION=#{et.operation}, + STEP_ID=#{et.stepId}, + ITEM=#{et.item}, + RESRCE=#{et.resrce}, + QTY=#{et.qty}, + CREATE_USER=#{et.createUser}, + CREATED_DATE_TIME=#{et.createdDateTime}, + WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL} + + + + + UPDATE Z_CUTTER_LOG + SITE=#{et.site}, + CUTTER=#{et.cutter}, + SHOP_ORDER=#{et.shopOrder}, + WORK_CENTER=#{et.workCenter}, + SFC=#{et.sfc}, + TYPE=#{et.type}, + OPERATION=#{et.operation}, + STEP_ID=#{et.stepId}, + ITEM=#{et.item}, + RESRCE=#{et.resrce}, + QTY=#{et.qty}, + CREATE_USER=#{et.createUser}, + CREATED_DATE_TIME=#{et.createdDateTime}, + WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL} + + + + + UPDATE Z_CUTTER_LOG + SITE=#{et.site}, + CUTTER=#{et.cutter}, + SHOP_ORDER=#{et.shopOrder}, + WORK_CENTER=#{et.workCenter}, + SFC=#{et.sfc}, + TYPE=#{et.type}, + OPERATION=#{et.operation}, + STEP_ID=#{et.stepId}, + ITEM=#{et.item}, + RESRCE=#{et.resrce}, + QTY=#{et.qty}, + CREATE_USER=#{et.createUser}, + CREATED_DATE_TIME=#{et.createdDateTime}, + + + + + HANDLE=#{ew.entity.handle} + AND SITE=#{ew.entity.site} + AND CUTTER=#{ew.entity.cutter} + AND SHOP_ORDER=#{ew.entity.shopOrder} + AND WORK_CENTER=#{ew.entity.workCenter} + AND SFC=#{ew.entity.sfc} + AND TYPE=#{ew.entity.type} + AND OPERATION=#{ew.entity.operation} + AND STEP_ID=#{ew.entity.stepId} + AND ITEM=#{ew.entity.item} + AND RESRCE=#{ew.entity.resrce} + AND QTY=#{ew.entity.qty} + AND CREATE_USER=#{ew.entity.createUser} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + DELETE FROM Z_CUTTER_LOG WHERE HANDLE=#{handle} + + + + DELETE FROM Z_CUTTER_LOG + + + + + ${k} = #{cm[${k}]} + + + + + + + + DELETE FROM Z_CUTTER_LOG + + + + + HANDLE=#{ew.entity.handle} + + AND SITE=#{ew.entity.site} + AND CUTTER=#{ew.entity.cutter} + AND SHOP_ORDER=#{ew.entity.shopOrder} + AND WORK_CENTER=#{ew.entity.workCenter} + AND SFC=#{ew.entity.sfc} + AND TYPE=#{ew.entity.type} + AND OPERATION=#{ew.entity.operation} + AND STEP_ID=#{ew.entity.stepId} + AND ITEM=#{ew.entity.item} + AND RESRCE=#{ew.entity.resrce} + AND QTY=#{ew.entity.qty} + AND CREATE_USER=#{ew.entity.createUser} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + DELETE FROM Z_CUTTER_LOG WHERE HANDLE IN ( + #{item} + ) + + + + diff --git a/production/src/main/resources/mapper/ToolMapper.xml b/production/src/main/resources/mapper/ToolMapper.xml index 741c6f85..67462821 100644 --- a/production/src/main/resources/mapper/ToolMapper.xml +++ b/production/src/main/resources/mapper/ToolMapper.xml @@ -217,7 +217,7 @@ AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime} - ${ew.sqlSegment} + and ${ew.sqlSegment} diff --git a/quality/src/main/java/com/foreverwin/mesnac/quality/service/impl/SelfReportServiceImpl.java b/quality/src/main/java/com/foreverwin/mesnac/quality/service/impl/SelfReportServiceImpl.java index 0f049064..95e373d0 100644 --- a/quality/src/main/java/com/foreverwin/mesnac/quality/service/impl/SelfReportServiceImpl.java +++ b/quality/src/main/java/com/foreverwin/mesnac/quality/service/impl/SelfReportServiceImpl.java @@ -16,9 +16,9 @@ import com.foreverwin.mesnac.quality.dto.SelfReportRequest; import com.foreverwin.mesnac.quality.mapper.SelfReportMapper; import com.foreverwin.mesnac.quality.model.SelfReport; import com.foreverwin.mesnac.quality.service.SelfReportService; +import com.foreverwin.modular.core.exception.BaseException; import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.FrontPage; -import com.visiprise.common.exception.BaseException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Service; @@ -94,7 +94,9 @@ public class SelfReportServiceImpl extends ServiceImpl sfcData = sfcCorssMapper.querySfcData(site, LocaleContextHolder.getLocale().getLanguage(), sfcDto); - + if (sfcData == null) { + throw new BaseException("根据当前资源未找到条码[" + sfc + "]的基本信息!"); + } String operationStep = (String)sfcData.get("OPERATION_STEP"); String shopOrder = (String)sfcData.get("SHOP_ORDER"); String item = (String)sfcData.get("ITEM"); From 52099503c66eafb779ac26d8f30aadd225906d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=98=89=E4=BC=9F?= <1724121454@qq.com> Date: Thu, 15 Jul 2021 10:22:39 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=B4=A8=E9=87=8F=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AbnormalBillController.java | 27 +++------ .../anomaly/dto/AbnormalBillDisposeDto.java | 27 +++++++++ .../mapper/AbnormalBillDisposeMapper.java | 1 - .../anomaly/mapper/AbnormalBillMapper.java | 9 ++- .../mesnac/anomaly/model/AbnormalBill.java | 25 +++++++- .../anomaly/service/AbnormalBillService.java | 10 ++-- .../service/impl/AbnormalBillServiceImpl.java | 45 +++++--------- .../service/impl/FileUploadedServiceImpl.java | 26 ++++----- .../mapper/AbnormalBillDisposeMapper.xml | 13 +++-- .../resources/mapper/AbnormalBillMapper.xml | 58 ++++++++++++------- dataimport/pom.xml | 4 ++ .../controller/DataImportController.java | 26 ++++++--- .../minth/generator/GeneratorApplication.java | 4 +- .../meapi/controller/NcCodeController.java | 7 ++- .../meapi/controller/NcGroupController.java | 6 ++ .../meapi/controller/OperationController.java | 2 + .../meapi/controller/SfcController.java | 5 ++ .../mesnac/meapi/mapper/NcCodeMapper.java | 2 + .../mesnac/meapi/mapper/NcGroupMapper.java | 7 ++- .../mesnac/meapi/mapper/OperationMapper.java | 2 + .../mesnac/meapi/mapper/SfcMapper.java | 2 + .../mesnac/meapi/service/NcCodeService.java | 2 + .../mesnac/meapi/service/NcGroupService.java | 5 +- .../meapi/service/OperationService.java | 1 + .../mesnac/meapi/service/SfcService.java | 4 +- .../meapi/service/impl/NcCodeServiceImpl.java | 7 +++ .../service/impl/NcGroupServiceImpl.java | 7 +++ .../service/impl/OperationServiceImpl.java | 2 + .../meapi/service/impl/SfcServiceImpl.java | 7 +++ .../main/resources/mapper/NcCodeMapper.xml | 19 ++++++ .../main/resources/mapper/NcGroupMapper.xml | 21 +++++++ .../main/resources/mapper/OperationMapper.xml | 2 + meapi/src/main/resources/mapper/SfcMapper.xml | 11 ++++ 33 files changed, 285 insertions(+), 111 deletions(-) diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java index 489eb985..3f8512c6 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java @@ -21,15 +21,15 @@ import java.util.List; /** * - * @author robert - * @since 2021-07-05 + * @author 赵嘉伟 + * @since 2021-07-14 */ @RestController @RequestMapping("/Z-ABNORMAL-BILL") public class AbnormalBillController { @Autowired - private AbnormalBillService abnormalBillService; + public AbnormalBillService abnormalBillService; @Autowired private SfcDispatchCommonService sfcDispatchCommonService; @@ -41,10 +41,6 @@ public class AbnormalBillController { public AnomalyService anomalyService; - - - - /** * 根据id查询 * @@ -94,6 +90,7 @@ public class AbnormalBillController { .or().like(AbnormalBill::getType, frontPage.getGlobalQuery()) .or().like(AbnormalBill::getItemBo, frontPage.getGlobalQuery()) .or().like(AbnormalBill::getSfc, frontPage.getGlobalQuery()) + .or().like(AbnormalBill::getOperation, frontPage.getGlobalQuery()) .or().like(AbnormalBill::getWorkCenter, frontPage.getGlobalQuery()) .or().like(AbnormalBill::getShopOrder, frontPage.getGlobalQuery()) .or().like(AbnormalBill::getMessageType, frontPage.getGlobalQuery()) @@ -176,10 +173,6 @@ public class AbnormalBillController { return R.ok(abnormalBillService.init(messageType,type)); } -// @GetMapping("/findAllUserByUserGroup") -// public R findAllUserByUserGroup(String site, String userGroups){ -// return R.ok(); -// } /** * 其他异常提报 @@ -313,7 +306,9 @@ public class AbnormalBillController { @PostMapping("/delete") public R delete(String ftpPath,String fileName){ - return R.ok(fileUploadedService.deleteFile(ftpPath,fileName)); + fileUploadedService.deleteFile(ftpPath,fileName); +// abnormalBillService.deleteFileInDatabase(ftpPath,fileName); + return R.ok(); } @GetMapping("/findUploadPictureByAbnormalBo") @@ -326,14 +321,10 @@ public class AbnormalBillController { return R.ok(abnormalBillService.getNextNumber(type)); } -// @GetMapping("/test") -// public R test(String category, String resource, String shopOrder, String sfc, String ncCodes ){ -// anomalyService.createAnomalyTask(category,resource,shopOrder,sfc,ncCodes); -// return R.ok(); -// } @GetMapping("/anomalyReveseRepair") - public R anomalyReveseRepair(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose){ + public R anomalyReveseRepair(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose){ return R.ok(abnormalBillService.anomalyReveseRepair(abnormalBill,abnormalBillDispose)); } + } \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/dto/AbnormalBillDisposeDto.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/dto/AbnormalBillDisposeDto.java index 7cf0fc25..e436e261 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/dto/AbnormalBillDisposeDto.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/dto/AbnormalBillDisposeDto.java @@ -154,6 +154,17 @@ public class AbnormalBillDisposeDto extends AbnormalBillDispose { */ private String fullName; + /** + * 工序编码 + */ + private String operation; + + /** + * + * @return + */ + private String ncCodeDescription; + public String getAbnormalNo() { return abnormalNo; } @@ -385,4 +396,20 @@ public class AbnormalBillDisposeDto extends AbnormalBillDispose { public void setFullName(String fullName) { this.fullName = fullName; } + + public String getNcCodeDescription() { + return ncCodeDescription; + } + + public void setNcCodeDescription(String ncCodeDescription) { + this.ncCodeDescription = ncCodeDescription; + } + + public String getOperation() { + return operation; + } + + public void setOperation(String operation) { + this.operation = operation; + } } diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillDisposeMapper.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillDisposeMapper.java index 9ba80afa..426d30ab 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillDisposeMapper.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillDisposeMapper.java @@ -2,7 +2,6 @@ package com.foreverwin.mesnac.anomaly.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDisposeDto; -import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDto; import com.foreverwin.mesnac.anomaly.model.AbnormalBill; import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose; import org.apache.ibatis.annotations.Param; diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillMapper.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillMapper.java index 5db8d7bb..6d48d989 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillMapper.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillMapper.java @@ -10,14 +10,16 @@ import java.util.List; /** *

- * 异常单 Mapper 接口 + * Mapper 接口 *

* - * @author robert - * @since 2021-07-05 + * @author 赵嘉伟 + * @since 2021-07-14 */ @Repository public interface AbnormalBillMapper extends BaseMapper { + + List backLog(@Param("abnormalBill")AbnormalBillDto abnormalBillDto, @Param("language")String language); /** @@ -30,4 +32,5 @@ public interface AbnormalBillMapper extends BaseMapper { List findCountBySfc(@Param("site")String site,@Param("type")String type,@Param("sfc")String sfc,@Param("status")List status); + } \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalBill.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalBill.java index 148aaa4b..b6ed9688 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalBill.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalBill.java @@ -11,11 +11,11 @@ import java.time.LocalDateTime; /** *

- * 异常单 + * *

* - * @author robert - * @since 2021-07-05 + * @author 赵嘉伟 + * @since 2021-07-14 */ @TableName("Z_ABNORMAL_BILL") @@ -59,6 +59,11 @@ public class AbnormalBill extends Model { */ @TableField("SFC") private String sfc; + /** + * 操作 + */ + @TableField("OPERATION") + private String operation; /** * 异常车间 */ @@ -146,6 +151,7 @@ public class AbnormalBill extends Model { private String entityLocation; /** * 上报来源 B|自保。 J|质检 R|设备人员 Z|设备自动 +维修自查 | C Y | 工艺 */ @TableField("REPORT_FROM") private String reportFrom; @@ -209,6 +215,8 @@ public class AbnormalBill extends Model { @TableField(exist = false) private String fileNum; + + public String getHandle() { return handle; } @@ -265,6 +273,14 @@ public class AbnormalBill extends Model { this.sfc = sfc; } + public String getOperation() { + return operation; + } + + public void setOperation(String operation) { + this.operation = operation; + } + public String getWorkCenter() { return workCenter; } @@ -527,6 +543,8 @@ public static final String ITEM_BO = "ITEM_BO"; public static final String SFC = "SFC"; +public static final String OPERATION = "OPERATION"; + public static final String WORK_CENTER = "WORK_CENTER"; public static final String SHOP_ORDER = "SHOP_ORDER"; @@ -599,6 +617,7 @@ public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME"; ", type = " + type + ", itemBo = " + itemBo + ", sfc = " + sfc + + ", operation = " + operation + ", workCenter = " + workCenter + ", shopOrder = " + shopOrder + ", messageType = " + messageType + diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java index 4cc182df..b45f972f 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java @@ -14,11 +14,11 @@ import java.util.List; /** *

- * 异常单 服务类 + * 服务类 *

* - * @author robert - * @since 2021-07-05 + * @author 赵嘉伟 + * @since 2021-07-14 */ public interface AbnormalBillService extends IService { @@ -56,7 +56,7 @@ public interface AbnormalBillService extends IService { /** * 初始化 */ - HashMap init(String messageType,String type); + HashMap init(String messageType, String type); /** * 待办事项 * @param abnormalBillDto @@ -121,4 +121,6 @@ public interface AbnormalBillService extends IService { HashMap anomalyReveseRepair(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose); +// void deleteFileInDatabase(String ftpPath,String fileName); + } \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java index 624e7312..16d911d7 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java @@ -17,10 +17,10 @@ import com.foreverwin.mesnac.common.util.StringUtil; import com.foreverwin.mesnac.meapi.mapper.*; import com.foreverwin.mesnac.meapi.model.*; import com.foreverwin.mesnac.meapi.service.*; +import com.foreverwin.modular.core.exception.BaseException; import com.foreverwin.modular.core.exception.BusinessException; import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.FrontPage; -import com.visiprise.common.exception.BaseException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Service; @@ -31,18 +31,17 @@ import java.util.*; /** *

- * 异常单 服务实现类 + * 服务实现类 *

* - * @author robert - * @since 2021-07-05 + * @author 赵嘉伟 + * @since 2021-07-14 */ @Service @Transactional(rollbackFor = Exception.class) public class AbnormalBillServiceImpl extends ServiceImpl implements AbnormalBillService, AnomalyService { - @Autowired private AbnormalBillMapper abnormalBillMapper; @@ -100,8 +99,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl selectPage(FrontPage frontPage, AbnormalBill abnormalBill) { QueryWrapper queryWrapper = new QueryWrapper<>(); @@ -116,6 +113,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl ncByNG = ncCodeService.findNcByNG(abnormalBill.getMessageType(), abnormalBill.getNcCode()); -// if(ncByNG == null || ncByNG.size() <= 0){ -// throw BusinessException.build("该消息类型下没有该不良代码"); -// } this.saveOrUpdate(abnormalBill); abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose); @@ -208,22 +202,18 @@ public class AbnormalBillServiceImpl extends ServiceImpl init(String messageType,String type) { + public HashMap init(String messageType, String type) { HashMap hashMap = new HashMap<>(); String site = CommonMethods.getSite(); //消息类型 - if("Z".equals(type)){ - List category = ncCodeService.findNcByCategory(messageType,null); - hashMap.put("ncByNG",category); - } +// if("Z".equals(type)){ +// List category = ncCodeService.findNcByCategory(messageType,null); +// hashMap.put("ncByNG",category); +// } //工作中心 WorkCenter workCenter = new WorkCenter(); workCenter.setWcCategory("LEVEL4"); @@ -231,10 +221,10 @@ public class AbnormalBillServiceImpl extends ServiceImpl workCenterList = workCenterService.selectList(workCenter); hashMap.put("workCenter",workCenterList); //原因分类 - NcCode ncCode = new NcCode(); + DataField ncCode = new DataField(); ncCode.setSite(site); - ncCode.setNcCategory("REPAIR"); - List ncCodeList = ncCodeService.selectList(ncCode); + ncCode.setDataField("REASON_CATEGORY"); + List ncCodeList = dataFieldListService.findDataFieldListById(ncCode); hashMap.put("causeType",ncCodeList); //责任部门 DataField dataField = new DataField(); @@ -668,6 +658,8 @@ public class AbnormalBillServiceImpl extends ServiceImpl + @@ -63,6 +64,7 @@ + @@ -617,14 +619,15 @@ SELECT ZAB.ABNORMAL_NO ABNORMAL_NO ,ZAB.STATUS STATUS,I.ITEM ITEM,IT.DESCRIPTION ITEM_DESCRIPTION, ZAB."TYPE" "TYPE" ,ZAB.SFC SFC,ZAB.MESSAGE_TYPE MESSAGE_TYPE,ZAB.SHOP_ORDER SHOP_ORDER, ZAB.WORK_CENTER WORK_CENTER,ZAB.RESRCE RESRCE, WORKORDER.VALUE WORK_ORDER,ITEMNUMBER.VALUE ITEM_NUMBER, - PRODUCTCATEGORY.VALUE PRODUCT_CATEGORY,listagg(NCT2.DESCRIPTION || '/'||NCT.DESCRIPTION || ',') within GROUP(ORDER BY zab.ABNORMAL_NO) NC_CODE , ZAB.PB_DESCRIPTION PB_DESCRIPTION ,ZAB.NC_QTY NC_QTY, + PRODUCTCATEGORY.VALUE PRODUCT_CATEGORY,listagg(NG.DESCRIPTION || '/'||NCT.DESCRIPTION || ',') within GROUP(ORDER BY zab.ABNORMAL_NO) NC_CODE_DESCRIPTION, + ZAB.PB_DESCRIPTION PB_DESCRIPTION ,ZAB.NC_QTY NC_QTY, ZAB.PB_GRADE PB_GRADE ,NWA.FULL_NAME PB_USER ,ZAB.PB_QTY PB_QTY ,ZAB.DISCOVER DISCOVER , ZAB.INSPECTOR INSPECTOR ,ZAB.ENTITY_LOCATION ENTITY_LOCATION ,ZAB.REPORT_FROM REPORT_FROM ,ZAB.OBJECT_BO OBJECT_BO , ZAB.PB_PHOTOSHOP PB_PHOTOSHOP,ZABD.DUTY_CAUSE_DESCRIPTION DUTY_CAUSE_DESCRIPTION,ZABD.DUTY_CAUSE_TYPE DUTY_CAUSE_TYPE,ZABD.DUTY_DEPART DUTY_DEPART, ZABD.DUTY_SEND_USER_GROUP DUTY_SEND_USER_GROUP,ZABD.DUTY_TYPE DUTY_TYPE,ZABD.PRINCIPAL_USER PRINCIPAL_USER,ZABD.ABNORMAL_METHOD ABNORMAL_METHOD, R.ROUTER ROUTER,ZABD.RESOLVE_SHOP_ORDER RESOLVE_SHOP_ORDER,ZABD.RESOLVE_REMARK RESOLVE_REMARK,ZABD.RESOLVE_SEND_USER RESOLVE_SEND_USER, - ZABD.ABNORMAL_REASON ABNORMAL_REASON,ZABD.BEFORE_MEASURE BEFORE_MEASURE,"MAP".VALUE "MAP", - ZABD.ROUTER_BO ROUTER_BO + ZABD.ABNORMAL_REASON ABNORMAL_REASON,ZABD.BEFORE_MEASURE BEFORE_MEASURE,"MAP".VALUE "MAP",listagg(ZANC.NC_CODE_GROUP || '/'||ZANC.NC_CODE || ',') within GROUP(ORDER BY zab.ABNORMAL_NO) NC_CODE, + ZABD.ROUTER_BO ROUTER_BO,ZAB.OPERATION OPERATION FROM Z_ABNORMAL_BILL ZAB LEFT JOIN Z_ABNORMAL_BILL_DISPOSE ZABD ON ZAB.HANDLE = ZABD.ABNORMAL_BILL_BO INNER JOIN ITEM I ON I.HANDLE = ZAB.ITEM_BO @@ -637,7 +640,7 @@ LEFT JOIN Z_ABNORMAL_NC_CODE ZANC ON ZAB.HANDLE = ZANC.ABNORMAL_BILL_BO LEFT JOIN NC_CODE_T NCT ON ('NCCodeBO:' || ZAB.SITE || ',' || ZANC.NC_CODE) = NCT.NC_CODE_BO AND NCT.LOCALE = #{language} INNER JOIN Z_NWA_USER NWA ON NWA.USER_NAME = ZAB.PB_USER AND NWA.SITE = ZAB.SITE - LEFT JOIN NC_CODE_T NCT2 ON ('NCCodeBO:' || ZAB.SITE || ',' || ZANC.NC_CODE_GROUP) = NCT2.NC_CODE_BO AND NCT2.LOCALE = #{language} + LEFT JOIN NC_GROUP NG ON NG.NC_GROUP = ZANC.NC_CODE_GROUP AND NG.SITE = ZAB.SITE LEFT JOIN ROUTER R ON SUBSTR(R.HANDLE,1,INSTR(R.HANDLE,',',-1)-1) = SUBSTR(ZABD.ROUTER_BO,1,INSTR(ZABD.ROUTER_BO,',',-1)-1) AND R.CURRENT_REVISION = 'true' @@ -659,7 +662,7 @@ ZAB.PB_PHOTOSHOP ,ZABD.DUTY_CAUSE_DESCRIPTION ,ZABD.DUTY_CAUSE_TYPE ,ZABD.DUTY_DEPART , ZABD.DUTY_SEND_USER_GROUP ,ZABD.DUTY_TYPE ,ZABD.PRINCIPAL_USER ,ZABD.ABNORMAL_METHOD , R.ROUTER ,ZABD.RESOLVE_SHOP_ORDER ,ZABD.RESOLVE_REMARK ,ZABD.RESOLVE_SEND_USER , - ZABD.ABNORMAL_REASON ,ZABD.BEFORE_MEASURE ,"MAP".VALUE,ZABD.ROUTER_BO + ZABD.ABNORMAL_REASON ,ZABD.BEFORE_MEASURE ,"MAP".VALUE,ZABD.ROUTER_BO,ZAB.OPERATION diff --git a/anomaly/src/main/resources/mapper/AbnormalBillMapper.xml b/anomaly/src/main/resources/mapper/AbnormalBillMapper.xml index a24e04ea..0381dd1b 100644 --- a/anomaly/src/main/resources/mapper/AbnormalBillMapper.xml +++ b/anomaly/src/main/resources/mapper/AbnormalBillMapper.xml @@ -11,6 +11,7 @@ + @@ -49,17 +50,14 @@ - - - - HANDLE, SITE, ABNORMAL_NO, STATUS, TYPE, ITEM_BO, SFC, WORK_CENTER, SHOP_ORDER, MESSAGE_TYPE, RESRCE, NC_CODE, SHUT_DOWN, RESPONSE_USER, RESPONSE_DATE_TIME, PB_DESCRIPTION, NC_QTY, PB_GRADE, PB_USER, PB_QTY, REPAIR_DATE_TIME, DISCOVER, INSPECTOR, ENTITY_LOCATION, REPORT_FROM, OBJECT_BO, PB_PHOTOSHOP, CANCEL_CODE, CANCEL_REASON, CANCEL_DATE_TIME, CANCEL_USER, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME + HANDLE, SITE, ABNORMAL_NO, STATUS, TYPE, ITEM_BO, SFC, OPERATION, WORK_CENTER, SHOP_ORDER, MESSAGE_TYPE, RESRCE, NC_CODE, SHUT_DOWN, RESPONSE_USER, RESPONSE_DATE_TIME, PB_DESCRIPTION, NC_QTY, PB_GRADE, PB_USER, PB_QTY, REPAIR_DATE_TIME, DISCOVER, INSPECTOR, ENTITY_LOCATION, REPORT_FROM, OBJECT_BO, PB_PHOTOSHOP, CANCEL_CODE, CANCEL_REASON, CANCEL_DATE_TIME, CANCEL_USER, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME @@ -100,6 +98,7 @@ AND TYPE=#{ew.entity.type} AND ITEM_BO=#{ew.entity.itemBo} AND SFC=#{ew.entity.sfc} + AND OPERATION=#{ew.entity.operation} AND WORK_CENTER=#{ew.entity.workCenter} AND SHOP_ORDER=#{ew.entity.shopOrder} AND MESSAGE_TYPE=#{ew.entity.messageType} @@ -145,6 +144,7 @@ AND TYPE=#{ew.entity.type} AND ITEM_BO=#{ew.entity.itemBo} AND SFC=#{ew.entity.sfc} + AND OPERATION=#{ew.entity.operation} AND WORK_CENTER=#{ew.entity.workCenter} AND SHOP_ORDER=#{ew.entity.shopOrder} AND MESSAGE_TYPE=#{ew.entity.messageType} @@ -198,6 +198,7 @@ AND TYPE=#{ew.entity.type} AND ITEM_BO=#{ew.entity.itemBo} AND SFC=#{ew.entity.sfc} + AND OPERATION=#{ew.entity.operation} AND WORK_CENTER=#{ew.entity.workCenter} AND SHOP_ORDER=#{ew.entity.shopOrder} AND MESSAGE_TYPE=#{ew.entity.messageType} @@ -251,6 +252,7 @@ AND TYPE=#{ew.entity.type} AND ITEM_BO=#{ew.entity.itemBo} AND SFC=#{ew.entity.sfc} + AND OPERATION=#{ew.entity.operation} AND WORK_CENTER=#{ew.entity.workCenter} AND SHOP_ORDER=#{ew.entity.shopOrder} AND MESSAGE_TYPE=#{ew.entity.messageType} @@ -304,6 +306,7 @@ AND TYPE=#{ew.entity.type} AND ITEM_BO=#{ew.entity.itemBo} AND SFC=#{ew.entity.sfc} + AND OPERATION=#{ew.entity.operation} AND WORK_CENTER=#{ew.entity.workCenter} AND SHOP_ORDER=#{ew.entity.shopOrder} AND MESSAGE_TYPE=#{ew.entity.messageType} @@ -357,6 +360,7 @@ AND TYPE=#{ew.entity.type} AND ITEM_BO=#{ew.entity.itemBo} AND SFC=#{ew.entity.sfc} + AND OPERATION=#{ew.entity.operation} AND WORK_CENTER=#{ew.entity.workCenter} AND SHOP_ORDER=#{ew.entity.shopOrder} AND MESSAGE_TYPE=#{ew.entity.messageType} @@ -410,6 +414,7 @@ AND TYPE=#{ew.entity.type} AND ITEM_BO=#{ew.entity.itemBo} AND SFC=#{ew.entity.sfc} + AND OPERATION=#{ew.entity.operation} AND WORK_CENTER=#{ew.entity.workCenter} AND SHOP_ORDER=#{ew.entity.shopOrder} AND MESSAGE_TYPE=#{ew.entity.messageType} @@ -459,6 +464,7 @@ TYPE, ITEM_BO, SFC, + OPERATION, WORK_CENTER, SHOP_ORDER, MESSAGE_TYPE, @@ -496,6 +502,7 @@ #{type}, #{itemBo}, #{sfc}, + #{operation}, #{workCenter}, #{shopOrder}, #{messageType}, @@ -540,6 +547,7 @@ #{type}, #{itemBo}, #{sfc}, + #{operation}, #{workCenter}, #{shopOrder}, #{messageType}, @@ -580,6 +588,7 @@ TYPE=#{et.type}, ITEM_BO=#{et.itemBo}, SFC=#{et.sfc}, + OPERATION=#{et.operation}, WORK_CENTER=#{et.workCenter}, SHOP_ORDER=#{et.shopOrder}, MESSAGE_TYPE=#{et.messageType}, @@ -620,6 +629,7 @@ TYPE=#{et.type}, ITEM_BO=#{et.itemBo}, SFC=#{et.sfc}, + OPERATION=#{et.operation}, WORK_CENTER=#{et.workCenter}, SHOP_ORDER=#{et.shopOrder}, MESSAGE_TYPE=#{et.messageType}, @@ -660,6 +670,7 @@ TYPE=#{et.type}, ITEM_BO=#{et.itemBo}, SFC=#{et.sfc}, + OPERATION=#{et.operation}, WORK_CENTER=#{et.workCenter}, SHOP_ORDER=#{et.shopOrder}, MESSAGE_TYPE=#{et.messageType}, @@ -699,6 +710,7 @@ AND TYPE=#{ew.entity.type} AND ITEM_BO=#{ew.entity.itemBo} AND SFC=#{ew.entity.sfc} + AND OPERATION=#{ew.entity.operation} AND WORK_CENTER=#{ew.entity.workCenter} AND SHOP_ORDER=#{ew.entity.shopOrder} AND MESSAGE_TYPE=#{ew.entity.messageType} @@ -769,6 +781,7 @@ AND TYPE=#{ew.entity.type} AND ITEM_BO=#{ew.entity.itemBo} AND SFC=#{ew.entity.sfc} + AND OPERATION=#{ew.entity.operation} AND WORK_CENTER=#{ew.entity.workCenter} AND SHOP_ORDER=#{ew.entity.shopOrder} AND MESSAGE_TYPE=#{ew.entity.messageType} @@ -861,19 +874,19 @@ + diff --git a/dataimport/pom.xml b/dataimport/pom.xml index bff4cf5f..b317b82c 100644 --- a/dataimport/pom.xml +++ b/dataimport/pom.xml @@ -59,6 +59,10 @@ commons-lang3 3.7 + + com.foreverwin.mesnac + anomaly + com.foreverwin.mesnac meapi diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/controller/DataImportController.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/controller/DataImportController.java index 53b33285..19ea9456 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/controller/DataImportController.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/controller/DataImportController.java @@ -1,17 +1,21 @@ package com.foreverwin.mesnac.dataimport.controller; -import com.foreverwin.mesnac.dataimport.util.APResult; -import com.foreverwin.mesnac.dataimport.util.ImportRequest; +import com.foreverwin.mesnac.anomaly.service.FileUploadedService; import com.foreverwin.mesnac.common.model.ExportTemplate; import com.foreverwin.mesnac.common.service.ExportTemplateService; import com.foreverwin.mesnac.dataimport.service.impl.MasterDataImportServiceImpl; +import com.foreverwin.mesnac.dataimport.util.APResult; +import com.foreverwin.mesnac.dataimport.util.ImportRequest; import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.R; import com.foreverwin.modular.core.util.SpringUtil; import com.sap.me.frame.Utils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.i18n.LocaleContextHolder; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import javax.websocket.server.PathParam; @@ -27,18 +31,26 @@ public class DataImportController { @Autowired private MasterDataImportServiceImpl masterDataImportService; - @PostMapping("/import") - public String importFile(@PathParam("fileType") String fileType, @PathParam("site") String site, @PathParam("user") String user, @PathParam("handleType") final String handleType, @PathParam("mode") final String mode, @RequestParam("file") MultipartFile multipartFile) { + @Autowired + FileUploadedService fileUploadedService; + + + @RequestMapping("/import") + public String importFile(@PathParam("fileType") String fileType, @PathParam("site") String site, + @PathParam("user") String user, @PathParam("handleType") final String handleType, + @PathParam("mode") final String mode, @RequestParam("file") MultipartFile multipartFile,@PathParam("taskNo")String taskNo) { ImportRequest importRequest = new ImportRequest(); importRequest.setFileType(fileType); importRequest.setSite(site); importRequest.setUser(user); importRequest.setMode(mode); importRequest.setMasterType(handleType); + //----------------------------------------------------------------------------------------------------------------------------------------- try { - String transInfo = masterDataImportService.importFile(multipartFile, importRequest); - return new APResult().getResult(0, transInfo, transInfo); + // String transInfo = masterDataImportService.importFile(multipartFile, importRequest); + fileUploadedService.uploadAttachment(multipartFile,site,taskNo,fileType); + return new APResult().getResult(0,"上传成功",null); } catch (Exception e) { e.printStackTrace(); return new APResult().getResult(9999, e.getMessage(), e.getMessage()); diff --git a/generator/src/main/java/com/foreverwin/minth/generator/GeneratorApplication.java b/generator/src/main/java/com/foreverwin/minth/generator/GeneratorApplication.java index b4ff0738..e7e7c283 100644 --- a/generator/src/main/java/com/foreverwin/minth/generator/GeneratorApplication.java +++ b/generator/src/main/java/com/foreverwin/minth/generator/GeneratorApplication.java @@ -32,8 +32,8 @@ public class GeneratorApplication { MpGenerator mpGenerator = mpGeneratorBuilder.dataSourceConfig(dataSourceConfig) .tablePrefix( "APS_", "DS_", "Z_" ) .packageName( "com.foreverwin.mesnac.anomaly" ) - .tables("Z_UPLOAD_PICTURES") - .author("Leon.L") + .tables("Z_ABNORMAL_BILL") + .author("赵嘉伟") .uiAppId("com.foreverwin.me") .uiPackage("com.foreverwin.me.migration") .build(); diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcCodeController.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcCodeController.java index 9fb677dc..951fc9b2 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcCodeController.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcCodeController.java @@ -140,10 +140,15 @@ public class NcCodeController { return R.ok(ncCodeService.findNcByCategory(category,code)); } - @GetMapping("findSecondaryNcByNc") + @GetMapping("/findSecondaryNcByNc") public R findSecondaryNcByNcI(String ncCode){ return R.ok(ncCodeService.findSecondaryNcByNc(ncCode)); } + + @GetMapping("/findNcCodeByNcGroup") + public R findNcCodeByNcGroup(NcGroup ncGroup){ + return R.ok(ncCodeService.findNcCodeByNcGroup(ncGroup)); + } } diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcGroupController.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcGroupController.java index b5a452cc..4b3dff76 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcGroupController.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/NcGroupController.java @@ -3,6 +3,7 @@ package com.foreverwin.mesnac.meapi.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.foreverwin.mesnac.meapi.model.NcGroup; +import com.foreverwin.mesnac.meapi.model.Operation; import com.foreverwin.mesnac.meapi.service.NcGroupService; import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.FrontPage; @@ -129,4 +130,9 @@ public class NcGroupController { public R removeByIds(List ids){ return R.ok(ncGroupService.removeByIds(ids)); } + + @GetMapping("/findNgGroupByOperationBo") + public R findNgGroupByOperationBo(Operation operation){ + return R.ok(ncGroupService.findNgGroupByOperationBo(operation)); + } } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/OperationController.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/OperationController.java index cfb28765..a0516d54 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/OperationController.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/OperationController.java @@ -91,4 +91,6 @@ public class OperationController { return R.ok(result); } + + } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/SfcController.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/SfcController.java index 3199bd5a..eb436400 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/SfcController.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/SfcController.java @@ -160,4 +160,9 @@ public class SfcController { return R.ok(sfcService.removeByIds(ids)); } + @GetMapping("/findOperationBySfc") + public R findOperationBySfc(String sfc){ + return R.ok(sfcService.findOperationBySfc(sfc)); + } + } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/NcCodeMapper.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/NcCodeMapper.java index 6527e30f..5cc7b576 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/NcCodeMapper.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/NcCodeMapper.java @@ -34,4 +34,6 @@ public interface NcCodeMapper extends BaseMapper { * @return */ Integer checkNcCode(@Param("NcCodeList")List ncCodes,@Param("site")String site,@Param("category")String category); + + List findNcCodeByNcGroup(@Param("ncGroup")NcGroup ncGroup); } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/NcGroupMapper.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/NcGroupMapper.java index c1151d51..68be48f3 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/NcGroupMapper.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/NcGroupMapper.java @@ -1,12 +1,15 @@ package com.foreverwin.mesnac.meapi.mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.foreverwin.mesnac.meapi.model.NcGroup; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.foreverwin.mesnac.meapi.model.Operation; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; +import java.util.List; + /** *

* Mapper 接口 @@ -19,4 +22,6 @@ import org.springframework.stereotype.Repository; public interface NcGroupMapper extends BaseMapper { IPage selectPageByOperation(Page frontPage, @Param("site") String site, @Param("operationBO") String operationBO,@Param("globalQuery") String globalQuery); + + List findNgGroupByOperationBo(@Param("operation") Operation operation); } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/OperationMapper.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/OperationMapper.java index 479d1cf4..125724c8 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/OperationMapper.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/OperationMapper.java @@ -28,4 +28,6 @@ public interface OperationMapper extends BaseMapper { Operation queryOperationByErpWorkCenter(@Param("site") String site, @Param("erpWorkCenter") String erpWorkCenter); IPage selectOperationStep( IPage page, @Param("locale") String locale,@Param("ew") Wrapper wrapper); + + } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/SfcMapper.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/SfcMapper.java index 021b01b0..aeb7d606 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/SfcMapper.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/SfcMapper.java @@ -31,4 +31,6 @@ public interface SfcMapper extends BaseMapper { Sfc findBySfc(@Param("sfc") Sfc sfc); IPage pageByResrce(Page pagePlus,@Param("ew") QueryWrapper queryWrapper,@Param("locale")String locale); + + String findOperationBySfc(@Param("site")String site,@Param("sfc")String sfc); } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/NcCodeService.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/NcCodeService.java index bed1fd1d..e1814694 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/NcCodeService.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/NcCodeService.java @@ -33,4 +33,6 @@ public interface NcCodeService extends IService { List findSecondaryNcByNc(String ncCode); IPage selectPageByNcGroup(Page pagePlus, String globalQuery, String ncGroup); + + List findNcCodeByNcGroup(NcGroup ncGroup); } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/NcGroupService.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/NcGroupService.java index a7f31ada..a4891d13 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/NcGroupService.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/NcGroupService.java @@ -2,8 +2,9 @@ package com.foreverwin.mesnac.meapi.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.foreverwin.mesnac.meapi.model.NcGroup; import com.baomidou.mybatisplus.extension.service.IService; +import com.foreverwin.mesnac.meapi.model.NcGroup; +import com.foreverwin.mesnac.meapi.model.Operation; import com.foreverwin.modular.core.util.FrontPage; import java.util.List; @@ -28,4 +29,6 @@ public interface NcGroupService extends IService { List selectList(NcGroup ncGroup); IPage selectPageByOperation(Page pagePlus, String globalQuery, String operation); + + List findNgGroupByOperationBo(Operation operation); } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/OperationService.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/OperationService.java index 821c6b87..c641d3fe 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/OperationService.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/OperationService.java @@ -39,4 +39,5 @@ public interface OperationService extends IService { * @return */ Operation queryOperationByErpWorkCenter(String site, String erpWorkCenter); + } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/SfcService.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/SfcService.java index c89430ad..d4ab900d 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/SfcService.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/SfcService.java @@ -2,7 +2,6 @@ package com.foreverwin.mesnac.meapi.service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.foreverwin.mesnac.meapi.dto.SfcDto; @@ -50,4 +49,7 @@ public interface SfcService extends IService { */ SfcDto findSfcData(String site, String sfc); + + String findOperationBySfc(String sfc); + } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/NcCodeServiceImpl.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/NcCodeServiceImpl.java index 7ddc9ed7..cb076984 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/NcCodeServiceImpl.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/NcCodeServiceImpl.java @@ -74,5 +74,12 @@ public class NcCodeServiceImpl extends ServiceImpl impleme return ncCodeMapper.selectPageByNcGroup(pagePlus, ncGroupBO, globalQuery,LocaleContextHolder.getLocale().getLanguage()); } + @Override + public List findNcCodeByNcGroup(NcGroup ncGroup) { + String site = CommonMethods.getSite(); + ncGroup.setSite(site); + return ncCodeMapper.findNcCodeByNcGroup(ncGroup); + } + } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/NcGroupServiceImpl.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/NcGroupServiceImpl.java index de6959b8..f8213039 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/NcGroupServiceImpl.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/NcGroupServiceImpl.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.foreverwin.mesnac.meapi.mapper.NcGroupMapper; import com.foreverwin.mesnac.meapi.model.NcGroup; +import com.foreverwin.mesnac.meapi.model.Operation; import com.foreverwin.mesnac.meapi.service.NcGroupService; import com.foreverwin.mesnac.meapi.util.StringUtils; import com.foreverwin.modular.core.exception.BaseException; @@ -58,5 +59,11 @@ public class NcGroupServiceImpl extends ServiceImpl impl return ncGroupMapper.selectPageByOperation(frontPage, site, operationBO, globalQuery); } + @Override + public List findNgGroupByOperationBo(Operation operation) { + String site = CommonMethods.getSite(); + operation.setSite(site); + return ncGroupMapper.findNgGroupByOperationBo(operation); + } } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java index 2cc00f3f..93215114 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java @@ -67,4 +67,6 @@ public class OperationServiceImpl extends ServiceImpl implements SfcSe public SfcDto findSfcData(String site, String sfc) { return sfcMapper.findSfcData(site, sfc); } + + @Override + public String findOperationBySfc(String sfc) { + String site = CommonMethods.getSite(); + return sfcMapper.findOperationBySfc(site,sfc); + } } \ No newline at end of file diff --git a/meapi/src/main/resources/mapper/NcCodeMapper.xml b/meapi/src/main/resources/mapper/NcCodeMapper.xml index 1a14cb98..5107aedf 100644 --- a/meapi/src/main/resources/mapper/NcCodeMapper.xml +++ b/meapi/src/main/resources/mapper/NcCodeMapper.xml @@ -396,4 +396,23 @@ AND NC_CATEGORY = #{category} + + diff --git a/meapi/src/main/resources/mapper/NcGroupMapper.xml b/meapi/src/main/resources/mapper/NcGroupMapper.xml index d0708a0a..ad3c26ea 100644 --- a/meapi/src/main/resources/mapper/NcGroupMapper.xml +++ b/meapi/src/main/resources/mapper/NcGroupMapper.xml @@ -19,6 +19,9 @@ HANDLE, CHANGE_STAMP, SITE, NC_GROUP, DESCRIPTION, VALID_AT_ALL_OPERATIONS, PRIORITY, CREATED_DATE_TIME, MODIFIED_DATE_TIME + + NG.HANDLE, NG.CHANGE_STAMP, NG.SITE, NG.NC_GROUP, NG.DESCRIPTION, NG.VALID_AT_ALL_OPERATIONS, NG.PRIORITY, NG.CREATED_DATE_TIME, NG.MODIFIED_DATE_TIME + @@ -350,4 +353,22 @@ AND (ng.NC_GROUP LIKE '%${globalQuery}%' or NG.DESCRIPTION LIKE '%${globalQuery}%') + + diff --git a/meapi/src/main/resources/mapper/OperationMapper.xml b/meapi/src/main/resources/mapper/OperationMapper.xml index 89da4fd5..5b8c146d 100644 --- a/meapi/src/main/resources/mapper/OperationMapper.xml +++ b/meapi/src/main/resources/mapper/OperationMapper.xml @@ -634,4 +634,6 @@ ORDER BY RS.STEP_ID + + diff --git a/meapi/src/main/resources/mapper/SfcMapper.xml b/meapi/src/main/resources/mapper/SfcMapper.xml index 5abc2826..144aed17 100644 --- a/meapi/src/main/resources/mapper/SfcMapper.xml +++ b/meapi/src/main/resources/mapper/SfcMapper.xml @@ -673,4 +673,15 @@ AND S.STATUS_BO IN ('StatusBO:'||#{ew.entity.site}||',401','StatusBO:'||#{ew.entity.site}||',402','StatusBO:'||#{ew.entity.site}||',403') AND zprt.STATUS='FINISH' AND ZPRT."RESULT"='OK' + + + From c8e30f1f348deabc5dcdde6cc8fb54382ec1fd84 Mon Sep 17 00:00:00 2001 From: Leon <3066758958@qq.com> Date: Thu, 15 Jul 2021 11:21:15 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=B8=BB=E6=95=B0=E6=8D=AE=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataimport/client/NcGroupWSClient.java | 19 +++++ .../service/MasterObjectDefine.java | 30 +++---- .../config/IntegrationConfiguration.java | 12 +++ .../service/CAPPAPIWebService.java | 21 +++++ .../service/impl/CAPPAPIWebServiceImpl.java | 85 +++++++++++++++++++ 5 files changed, 152 insertions(+), 15 deletions(-) create mode 100644 integration/src/main/java/com/foreverwin/mesnac/integration/service/CAPPAPIWebService.java create mode 100644 integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/CAPPAPIWebServiceImpl.java diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/NcGroupWSClient.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/NcGroupWSClient.java index 8b389f81..09773061 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/NcGroupWSClient.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/NcGroupWSClient.java @@ -9,6 +9,8 @@ import com.sap.me.common.ObjectReference; import com.sap.me.nonconformance.NcGroupConfigurationServiceInterface; import com.sap.me.nonconformance.NcGroupFullConfiguration; import com.sap.me.nonconformance.NcGroupValidOperation; +import com.visiprise.globalization.DateGlobalizationServiceInterface; +import com.visiprise.globalization.GlobalizationService; import java.util.ArrayList; import java.util.List; @@ -59,6 +61,7 @@ public class NcGroupWSClient { String applyOperation = jsonObject.getString("applyOperation"); String ncGroupBo = HandleEnum.NC_GROUP.getHandle(site, ncGroup); + DateGlobalizationServiceInterface dateService = GlobalizationService.getInvariantService("com.visiprise.globalization.DateGlobalizationService"); //--------------------------------------------------------------------------------------------------- NcGroupConfigurationServiceInterface ncGroupConfigurationService = MEServices.create("com.sap.me.nonconformance", "NcGroupConfigurationService", site); NcGroupFullConfiguration ncGroupFullConfiguration = new NcGroupFullConfiguration(); @@ -79,10 +82,18 @@ public class NcGroupWSClient { list.add(ncGroupValidOperation); } + ncGroupFullConfiguration.setNcGroupValidOperationList(list); + } else if (StringUtil.notBlank(applyOperation)) { + List list = new ArrayList<>(); + NcGroupValidOperation ncGroupValidOperation = new NcGroupValidOperation(); + String operationBo = HandleEnum.OPERATION.getHandle(site, applyOperation, "#"); + ncGroupValidOperation.setOperationRef(operationBo); + list.add(ncGroupValidOperation); ncGroupFullConfiguration.setNcGroupValidOperationList(list); } } + ncGroupFullConfiguration.setModifiedDateTime(dateService.createDateTime()); ncGroupConfigurationService.createNcGroup(ncGroupFullConfiguration); } catch (Exception e) { return ExceptionUtil.getExceptionMsg(e); @@ -105,6 +116,7 @@ public class NcGroupWSClient { String applyAll = jsonObject.getString("applyAll"); String applyOperation = jsonObject.getString("applyOperation"); + DateGlobalizationServiceInterface dateService = GlobalizationService.getInvariantService("com.visiprise.globalization.DateGlobalizationService"); //--------------------------------------------------------------------------------------------------- NcGroupConfigurationServiceInterface ncGroupConfigurationService = MEServices.create("com.sap.me.nonconformance", "NcGroupConfigurationService", site); ncGroupFullConfiguration.setDescription(description); @@ -122,6 +134,13 @@ public class NcGroupWSClient { list.add(ncGroupValidOperation); } + ncGroupFullConfiguration.setNcGroupValidOperationList(list); + } else if (StringUtil.notBlank(applyOperation)) { + List list = new ArrayList<>(); + NcGroupValidOperation ncGroupValidOperation = new NcGroupValidOperation(); + String operationBo = HandleEnum.OPERATION.getHandle(site, applyOperation, "#"); + ncGroupValidOperation.setOperationRef(operationBo); + list.add(ncGroupValidOperation); ncGroupFullConfiguration.setNcGroupValidOperationList(list); } } diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/service/MasterObjectDefine.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/service/MasterObjectDefine.java index b50c9678..6fd8d79f 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/service/MasterObjectDefine.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/service/MasterObjectDefine.java @@ -39,13 +39,13 @@ public class MasterObjectDefine { cvsHeadsMapping = new HashMap(); cvsHeadsMapping.put("seqNum", "序号"); - cvsHeadsMapping.put("resource", "资源编码"); - cvsHeadsMapping.put("description", "资源描述"); + cvsHeadsMapping.put("resource", "*设备(资源)命名(英文)"); + cvsHeadsMapping.put("description", "设备(资源)描述"); cvsHeadsMapping.put("defaultOperation", "默认操作"); - cvsHeadsMapping.put("status", "资源状态" ); + cvsHeadsMapping.put("status", "设备(资源)状态" ); cvsHeadsMapping.put("setupStatus", "设置状态"); cvsHeadsMapping.put("processResource", "工艺资源"); - cvsHeadsMapping.put("resourceType", "资源类型"); + cvsHeadsMapping.put("resourceType", "设备(资源)类型"); cvsHeadsMapping.put("validFrom", "资源有效期从"); cvsHeadsMapping.put("validTo", "资源有效期到"); cvsHeadsMapping.put("certificate", "证明编号"); @@ -56,7 +56,7 @@ public class MasterObjectDefine { cvsHeadsMapping = new HashMap(); cvsHeadsMapping.put("seqNum", "序号"); - cvsHeadsMapping.put("workCenter", "工作中心名称"); + cvsHeadsMapping.put("workCenter", "*工作中心名称(英文)"); cvsHeadsMapping.put("descriptionZH", "工作中心描述(中文)"); cvsHeadsMapping.put("descriptionEN", "工作中心描述(英文)"); cvsHeadsMapping.put("status", "状态"); @@ -66,8 +66,8 @@ public class MasterObjectDefine { cvsHeadsMapping.put("memberSeq", "序列号"); cvsHeadsMapping.put("memberType", "子工作中心类型"); cvsHeadsMapping.put("memberGBO", "工作中心或资源"); - cvsHeadsMapping.put("ERPWC", "ERP工作中心"); - cvsHeadsMapping.put("isERPWC", "是ERP工作中心"); + cvsHeadsMapping.put("ERPWC", "ERP 工作中心"); + cvsHeadsMapping.put("isERPWC", "是 ERP 工作中心"); break; //工序主数据 @@ -75,15 +75,15 @@ public class MasterObjectDefine { cvsHeadsMapping = new HashMap(); cvsHeadsMapping.put("seqNum","序号"); - cvsHeadsMapping.put("operation", "工序名称"); - cvsHeadsMapping.put("version", "工序版本"); + cvsHeadsMapping.put("operation", "*关键工序名称(英文)"); + cvsHeadsMapping.put("version", "*关键工序版本"); cvsHeadsMapping.put("currentVersion", "当前版本(是/否)"); - cvsHeadsMapping.put("status", "状态"); - cvsHeadsMapping.put("descriptionZH", "工序描述(中文)"); - cvsHeadsMapping.put("descriptionEN", "工序描述(英文)"); - cvsHeadsMapping.put("operationType", "操作类型"); - cvsHeadsMapping.put("resourceType", "资源类型"); - cvsHeadsMapping.put("defaultResource", "默认资源"); + cvsHeadsMapping.put("status", "*状态"); + cvsHeadsMapping.put("descriptionZH", "关键工序描述(中文)"); + cvsHeadsMapping.put("descriptionEN", "关键工序描述(英文)"); + cvsHeadsMapping.put("operationType", "*操作类型"); + cvsHeadsMapping.put("resourceType", "*设备(资源)类型"); + cvsHeadsMapping.put("defaultResource", "默认设备(资源)"); break; //不合格代码组 diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/config/IntegrationConfiguration.java b/integration/src/main/java/com/foreverwin/mesnac/integration/config/IntegrationConfiguration.java index f2823297..b81780ff 100644 --- a/integration/src/main/java/com/foreverwin/mesnac/integration/config/IntegrationConfiguration.java +++ b/integration/src/main/java/com/foreverwin/mesnac/integration/config/IntegrationConfiguration.java @@ -1,6 +1,7 @@ package com.foreverwin.mesnac.integration.config; +import com.foreverwin.mesnac.integration.service.CAPPAPIWebService; import com.foreverwin.mesnac.integration.service.ERPAPIWebService; import org.apache.cxf.Bus; import org.apache.cxf.jaxws.EndpointImpl; @@ -22,6 +23,8 @@ public class IntegrationConfiguration { private Bus bus; @Autowired private ERPAPIWebService ERPAPIWebService; + @Autowired + private CAPPAPIWebService CAPPAPIWebService; @Bean public Endpoint erpWebService() { @@ -30,4 +33,13 @@ public class IntegrationConfiguration { endpoint.publish("/ERPAPIWebService"); return endpoint; } + + + @Bean + public Endpoint cappWebService() { + EndpointImpl endpoint = new EndpointImpl(bus, CAPPAPIWebService); + //显示要发布的名称 + endpoint.publish("/CAPPAPIWebService"); + return endpoint; + } } diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/service/CAPPAPIWebService.java b/integration/src/main/java/com/foreverwin/mesnac/integration/service/CAPPAPIWebService.java new file mode 100644 index 00000000..4485072d --- /dev/null +++ b/integration/src/main/java/com/foreverwin/mesnac/integration/service/CAPPAPIWebService.java @@ -0,0 +1,21 @@ +package com.foreverwin.mesnac.integration.service; + +import com.foreverwin.mesnac.integration.dto.BomSyncRequest; +import com.foreverwin.mesnac.integration.dto.WebServiceResponse; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +@WebService(targetNamespace="http://service.integration.mesnac.com") +public interface CAPPAPIWebService { + + /** + * 物料清单同步 + * + * @param bomSyncRequest + * @return + */ + @WebMethod(action = "http://service.integration.mesnac.com/itemSync") + WebServiceResponse itemSync(@WebParam(name = "itemSyncRequest") BomSyncRequest bomSyncRequest); +} diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/CAPPAPIWebServiceImpl.java b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/CAPPAPIWebServiceImpl.java new file mode 100644 index 00000000..2d7bdfd7 --- /dev/null +++ b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/CAPPAPIWebServiceImpl.java @@ -0,0 +1,85 @@ +package com.foreverwin.mesnac.integration.service.impl; + +import com.foreverwin.mesnac.common.constant.IntegrationTypeConstant; +import com.foreverwin.mesnac.common.util.ExceptionUtil; +import com.foreverwin.mesnac.common.util.StringUtil; +import com.foreverwin.mesnac.integration.dto.BomSyncRequest; +import com.foreverwin.mesnac.integration.dto.WebServiceResponse; +import com.foreverwin.mesnac.integration.model.IntegrationLog; +import com.foreverwin.mesnac.integration.service.CAPPAPIWebService; +import com.foreverwin.mesnac.integration.service.IntegrationLogService; +import com.foreverwin.mesnac.integration.service.InterfaceService; +import com.foreverwin.modular.core.exception.BusinessException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.jws.WebService; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.UUID; + +@Component +@WebService(serviceName = "CAPPAPIWebService", + targetNamespace = "http://service.integration.mesnac.com", + endpointInterface = "com.foreverwin.mesnac.integration.service.CAPPAPIWebService") +public class CAPPAPIWebServiceImpl implements CAPPAPIWebService { + + @Autowired + private InterfaceService interfaceService; + @Autowired + private IntegrationLogService integrationLogService; + + @Override + public WebServiceResponse itemSync(BomSyncRequest bomSyncRequest) { + WebServiceResponse response = new WebServiceResponse(); + + String site = null; + try { + if (bomSyncRequest == null) { + throw BusinessException.build("传递的参数格式不正确,或者为空"); + } + if (StringUtil.isBlank(bomSyncRequest.getTRANID())) { + throw BusinessException.build("参数【TRANID】不能为空"); + } + if (StringUtil.isBlank(bomSyncRequest.getDATE_TIME())) { + throw BusinessException.build("参数【DATE_TIME】不能为空"); + } + response.setHANDLE(bomSyncRequest.getTRANID()); + response.setSTATUS("S"); + + site = bomSyncRequest.getSITE(); + String shopOrder = bomSyncRequest.getSHOP_ORDER(); + if (StringUtil.isBlank(site)) { + throw BusinessException.build("参数【SITE】不能为空"); + } + + //调用业务接口 + interfaceService.bomSync(site, bomSyncRequest); + response.setMESSAGE("工单【" + shopOrder + "】BOM数据同步成功"); + + } catch (Exception e) { + response.setSTATUS("E"); + response.setMESSAGE(ExceptionUtil.getExceptionMsg(e)); + } finally { + + //记录接口日志 + IntegrationLog log = new IntegrationLog(); + log.setHandle(UUID.randomUUID().toString()); + log.setSite(site); + log.setIntegrationType(IntegrationTypeConstant.BOM); + log.setCategory("RESPONSE"); + log.setIntegrationWay("ERP"); + log.setIntegrationMethod("InterfaceService.shopOrderSync"); + log.setParam(bomSyncRequest.toString()); + log.setStatus(response.getSTATUS()); + log.setResultMessage(response.getMESSAGE()); + log.setTransactionId(bomSyncRequest.getTRANID()); + log.setRequestDateTime(LocalDateTime.parse(bomSyncRequest.getDATE_TIME(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + log.setCreatedDateTime(LocalDateTime.now()); + integrationLogService.saveIntegrationLog(log); + } + + //接口返回 + return response; + } +}