From a871eb28d845fc01f9d03e12a9a946334ff51035 Mon Sep 17 00:00:00 2001 From: zpl Date: Wed, 25 Aug 2021 09:23:33 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=BB=B4=E4=BF=AE?= =?UTF-8?q?=E6=8F=90=E6=8A=A5bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equip/service/impl/ResourceRepairTaskServiceImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/equip/src/main/java/com/foreverwin/mesnac/equip/service/impl/ResourceRepairTaskServiceImpl.java b/equip/src/main/java/com/foreverwin/mesnac/equip/service/impl/ResourceRepairTaskServiceImpl.java index 0d852bb8..b07df861 100644 --- a/equip/src/main/java/com/foreverwin/mesnac/equip/service/impl/ResourceRepairTaskServiceImpl.java +++ b/equip/src/main/java/com/foreverwin/mesnac/equip/service/impl/ResourceRepairTaskServiceImpl.java @@ -140,8 +140,10 @@ public class ResourceRepairTaskServiceImpl extends ServiceImpl Date: Wed, 25 Aug 2021 09:36:56 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E6=B4=BE=E5=B7=A5?= =?UTF-8?q?=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/foreverwin/mesnac/common/constant/Constants.java | 2 +- .../mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java b/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java index 0eff2fef..fc5b2f59 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java @@ -189,7 +189,7 @@ public interface Constants { //用户组 - String USER_GROUP_ADMINISTRATOR = "ADMINISTRATOR"; + String USER_GROUP_ADMINISTRATOR = "ADMINISTRATORS"; //车间调度 String USER_GROUP_CJDD = "CJDD"; //总计划 diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java index 091485ca..b786ea0d 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java @@ -99,7 +99,7 @@ public class SfcDispatchServiceImpl extends ServiceImpl userGroupList = userGroupService.getUserGroupListByUserBo(userBo); - String role = "ADMINISTRATOR"; + String role = "ADMINISTRATORS"; if (userGroupList != null && userGroupList.size() > 0) { for (UserGroup userGroupModel: userGroupList) { String userGroup = userGroupModel.getUserGroup(); From 9f1d9862d300e2e634ba097a16cdd343a9cf17b9 Mon Sep 17 00:00:00 2001 From: zpl Date: Wed, 25 Aug 2021 10:15:53 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=96=B0=E5=A2=9ESFC=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mesnac/common/constant/Constants.java | 2 + .../common/controller/PrintLogController.java | 31 +++++++ .../mesnac/common/mapper/PrintLogMapper.java | 4 + .../common/service/PrintLogService.java | 6 ++ .../service/impl/PrintLogServiceImpl.java | 81 ++++++++++++++++--- .../main/resources/mapper/PrintLogMapper.xml | 14 ++++ 6 files changed, 125 insertions(+), 13 deletions(-) diff --git a/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java b/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java index 0eff2fef..49d73406 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java @@ -172,6 +172,8 @@ public interface Constants { String PRINT_TYPE_INV = "INV"; // 在制品标签 String PRINT_TYPE_SFC = "SFC"; + // 在制品标签条件打印 + String PRINT_TYPE_SFC_SPE = "SFC_SPE"; // 余料标签 String PRINT_TYPE_EXM = "EXM"; diff --git a/common/src/main/java/com/foreverwin/mesnac/common/controller/PrintLogController.java b/common/src/main/java/com/foreverwin/mesnac/common/controller/PrintLogController.java index 465137ed..b9153a28 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/controller/PrintLogController.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/controller/PrintLogController.java @@ -1,6 +1,7 @@ package com.foreverwin.mesnac.common.controller; import cn.hutool.core.date.DateUtil; +import com.foreverwin.mesnac.common.dto.LabelPrintDto; import com.foreverwin.modular.core.exception.BusinessException; import com.foreverwin.modular.core.util.R; import com.foreverwin.modular.core.util.FrontPage; @@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*; import com.foreverwin.mesnac.common.service.PrintLogService; import com.foreverwin.mesnac.common.model.PrintLog; import java.util.List; +import java.util.Map; /** * @@ -93,4 +95,33 @@ public class PrintLogController { return R.ok(); } + + /** + * 根据sfc,查询当前sfc的打印信息 + * @param sfc + * @return + */ + @ResponseBody + @GetMapping("/findSfcPrintInfoBySfc") + public R findSfcInfoBySfc(String sfc){ + try { + return R.ok(printLogService.findSfcPrintInfoBySfc(sfc)); + } catch (Exception e) { + return R.failed(e.getMessage()); + } + } + + @ResponseBody + @PostMapping("/sfcLabelPrint") + public R sfcLabelPrint(@RequestBody Map map) { + try { + printLogService.sfcLabelPrint(map); + } catch (Exception e) { + return R.failed(e.getMessage()); + } + return R.ok(); + } + + + } \ No newline at end of file diff --git a/common/src/main/java/com/foreverwin/mesnac/common/mapper/PrintLogMapper.java b/common/src/main/java/com/foreverwin/mesnac/common/mapper/PrintLogMapper.java index 9e527a85..67ced48f 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/mapper/PrintLogMapper.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/mapper/PrintLogMapper.java @@ -1,7 +1,9 @@ package com.foreverwin.mesnac.common.mapper; +import com.foreverwin.mesnac.common.dto.LabelPrintDto; import com.foreverwin.mesnac.common.model.PrintLog; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @@ -24,4 +26,6 @@ public interface PrintLogMapper extends BaseMapper { */ List getPrintLogListByCondition(PrintLog printLog); + LabelPrintDto findSfcPrintInfoBySfc(@Param("sfc") String sfc, @Param("site") String site); + } \ No newline at end of file diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/PrintLogService.java b/common/src/main/java/com/foreverwin/mesnac/common/service/PrintLogService.java index 6a773739..10870161 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/service/PrintLogService.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/service/PrintLogService.java @@ -1,9 +1,11 @@ package com.foreverwin.mesnac.common.service; +import com.foreverwin.mesnac.common.dto.LabelPrintDto; import com.foreverwin.mesnac.common.model.PrintLog; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; +import java.util.Map; /** *

@@ -37,4 +39,8 @@ public interface PrintLogService extends IService { * @return */ List getPrintLogListByCondition(PrintLog printLog); + + LabelPrintDto findSfcPrintInfoBySfc(String sfc); + + void sfcLabelPrint(Map map); } \ No newline at end of file diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/impl/PrintLogServiceImpl.java b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/PrintLogServiceImpl.java index 8facf6b1..67bddb6c 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/service/impl/PrintLogServiceImpl.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/PrintLogServiceImpl.java @@ -12,16 +12,19 @@ import com.foreverwin.mesnac.common.mapper.PrintLogMapper; import com.foreverwin.mesnac.common.service.PrintLogService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.foreverwin.modular.core.exception.BusinessException; +import com.foreverwin.modular.core.util.CommonMethods; import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.UUID; /** *

@@ -73,19 +76,9 @@ public class PrintLogServiceImpl extends ServiceImpl i list.get(i).setPrintTemplate(printList.get(i).getPrintTemplate()); list.get(i).setPrintNum(printList.get(i).getPrintNum()); } - String post = HttpUtil.post(printServer, JSON.toJSONString(list), 60000); - /** - * {"msg":"打印成功","code":0} - * {"msg":"打印失败","code":500} - * 根据返回值,更新打印机信息-printName及打印是否成功信息isPrint - * */ - JSONObject jsonObject = JSONObject.parseObject(post); - Integer code = jsonObject.getInteger("code"); - String msg = jsonObject.getString("msg"); - if (code != 0){ - throw BusinessException.build(msg); - } + printServer(list); + // 更新打印记录:是否已打印、使用的打印机、打印次数 List printLogList = new ArrayList<>(); for (PrintLog printLog : printList) { @@ -113,4 +106,66 @@ public class PrintLogServiceImpl extends ServiceImpl i return printLogMapper.getPrintLogListByCondition(printLog); } + @Override + public LabelPrintDto findSfcPrintInfoBySfc(String sfc) { + return printLogMapper.findSfcPrintInfoBySfc(sfc,CommonMethods.getSite()); + } + + @Override + public void sfcLabelPrint(Map map) { + Integer qty = (Integer) map.get("qty"); + List labelPrintDtoList = (List) map.get("labelPrintDtoList"); + printServer(labelPrintDtoList); + // 解决无法获取list中对象的问题 + String parse = JSON.toJSONString(labelPrintDtoList); + List labelPrintDtos = JSONObject.parseArray(parse, LabelPrintDto.class); + // 打印张数 + Integer printNum = 0; + for (LabelPrintDto labelP:labelPrintDtos) { + printNum += labelP.getPrintNum(); + } + LabelPrintDto labelPrintDto = labelPrintDtos.get(0); + PrintLog printLog = new PrintLog(); + printLog.setCategory(Constants.PRINT_TYPE_SFC_SPE); + printLog.setSfc(labelPrintDto.getSfc()); + printLog.setSite(CommonMethods.getSite()); + List printLogListByCondition = printLogService.getPrintLogListByCondition(printLog); + if (printLogListByCondition.size() == 1){ + PrintLog printLog1 = printLogListByCondition.get(0); + printLog1.setPrintNum(printNum); + printLog1.setModifiedDateTime(LocalDateTime.now()); + printLog1.setModifyUser(CommonMethods.getUser()); + printLogService.updateById(printLog1); + }else{ + labelPrintDto.setQty(BigDecimal.valueOf(qty)); + printLog.setCreateUser(labelPrintDto.getPrintTemplate()); + printLog.setPrintParam(JSON.toJSONString(labelPrintDto)); + printLog.setItem(labelPrintDto.getItem()); + printLog.setPrintName(labelPrintDto.getPrinter()); + printLog.setPrintTemplate(labelPrintDto.getPrintTemplate()); + printLog.setIsPrint("true"); + printLog.setPrintNum(printNum); + printLog.setHandle(UUID.randomUUID().toString()); + printLog.setCreatedDateTime(LocalDateTime.now()); + printLog.setCreateUser(CommonMethods.getUser()); + printLogService.save(printLog); + } + } + + public void printServer(List list){ + /*String post = HttpUtil.post(printServer, JSON.toJSONString(list), 60000); + *//** + * {"msg":"打印成功","code":0} + * {"msg":"打印失败","code":500} + * 根据返回值,更新打印机信息-printName及打印是否成功信息isPrint + *//* + JSONObject jsonObject = JSONObject.parseObject(post); + Integer code = jsonObject.getInteger("code"); + String msg = jsonObject.getString("msg"); + if (code != 0){ + throw BusinessException.build(msg); + }*/ + + } + } \ No newline at end of file diff --git a/common/src/main/resources/mapper/PrintLogMapper.xml b/common/src/main/resources/mapper/PrintLogMapper.xml index aa9635f4..05471fe5 100644 --- a/common/src/main/resources/mapper/PrintLogMapper.xml +++ b/common/src/main/resources/mapper/PrintLogMapper.xml @@ -567,6 +567,20 @@ ORDER BY PL.CREATED_DATE_TIME DESC + +