Merge remote-tracking branch 'origin/master'

master
philip 3 years ago
commit 54772894f5

@ -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";
@ -189,7 +191,7 @@ public interface Constants {
//用户组
String USER_GROUP_ADMINISTRATOR = "ADMINISTRATOR";
String USER_GROUP_ADMINISTRATOR = "ADMINISTRATORS";
//车间调度
String USER_GROUP_CJDD = "CJDD";
//总计划

@ -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();
}
/**
* sfcsfc
* @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<String,Object> map) {
try {
printLogService.sfcLabelPrint(map);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok();
}
}

@ -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<PrintLog> {
*/
List<PrintLog> getPrintLogListByCondition(PrintLog printLog);
LabelPrintDto findSfcPrintInfoBySfc(@Param("sfc") String sfc, @Param("site") String site);
}

@ -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;
/**
* <p>
@ -37,4 +39,8 @@ public interface PrintLogService extends IService<PrintLog> {
* @return
*/
List<PrintLog> getPrintLogListByCondition(PrintLog printLog);
LabelPrintDto findSfcPrintInfoBySfc(String sfc);
void sfcLabelPrint(Map<String,Object> map);
}

@ -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;
/**
* <p>
@ -73,19 +76,9 @@ public class PrintLogServiceImpl extends ServiceImpl<PrintLogMapper, PrintLog> 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}
* -printNameisPrint
* */
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<PrintLog> printLogList = new ArrayList<>();
for (PrintLog printLog : printList) {
@ -113,4 +106,66 @@ public class PrintLogServiceImpl extends ServiceImpl<PrintLogMapper, PrintLog> i
return printLogMapper.getPrintLogListByCondition(printLog);
}
@Override
public LabelPrintDto findSfcPrintInfoBySfc(String sfc) {
return printLogMapper.findSfcPrintInfoBySfc(sfc,CommonMethods.getSite());
}
@Override
public void sfcLabelPrint(Map<String,Object> map) {
Integer qty = (Integer) map.get("qty");
List<LabelPrintDto> labelPrintDtoList = (List<LabelPrintDto>) map.get("labelPrintDtoList");
printServer(labelPrintDtoList);
// 解决无法获取list中对象的问题
String parse = JSON.toJSONString(labelPrintDtoList);
List<LabelPrintDto> 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<PrintLog> 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<LabelPrintDto> list){
/*String post = HttpUtil.post(printServer, JSON.toJSONString(list), 60000);
*//**
* {"msg":"打印成功","code":0}
* {"msg":"打印失败","code":500}
* -printNameisPrint
*//*
JSONObject jsonObject = JSONObject.parseObject(post);
Integer code = jsonObject.getInteger("code");
String msg = jsonObject.getString("msg");
if (code != 0){
throw BusinessException.build(msg);
}*/
}
}

@ -567,6 +567,20 @@
ORDER BY PL.CREATED_DATE_TIME DESC
</select>
<!--根据sfcBo查询当前条码的打印信息-->
<select id="findSfcPrintInfoBySfc" resultType="com.foreverwin.mesnac.common.dto.LabelPrintDto">
SELECT IM.ITEM ,S.SFC, IT.DESCRIPTION ITEM_DESCRIPTION, ZSD.SHOP_ORDER,
I.QTY_ON_HAND QTY ,ZSD.BLANKING_SIZE , CF.VALUE DRAWING_REVISION
FROM INVENTORY I
LEFT JOIN SFC S ON I.INVENTORY_CONTEXT_GBO = S.HANDLE
LEFT JOIN
(SELECT MAX(STEP_ID),BLANKING_SIZE,SFC,SHOP_ORDER FROM Z_SFC_DISPATCH
WHERE SFC = #{sfc} AND SITE = #{site} GROUP BY BLANKING_SIZE ,SFC,SHOP_ORDER) ZSD ON ZSD.SFC = S.SFC
LEFT JOIN ITEM IM ON IM.HANDLE = I.ITEM_BO
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = IM.HANDLE AND IT.LOCALE = 'zh'
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = I.ITEM_BO AND CF."ATTRIBUTE" = 'DRAWING_REVISION'
WHERE S.SFC = #{sfc} AND I.SITE = #{site}
</select>
<!--自定义sql-->

@ -99,7 +99,7 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
String user = CommonMethods.getUser();
String userBo = HandleEnum.USER.getHandle(site, user);
List<UserGroup> userGroupList = userGroupService.getUserGroupListByUserBo(userBo);
String role = "ADMINISTRATOR";
String role = "ADMINISTRATORS";
if (userGroupList != null && userGroupList.size() > 0) {
for (UserGroup userGroupModel: userGroupList) {
String userGroup = userGroupModel.getUserGroup();

@ -140,8 +140,10 @@ public class ResourceRepairTaskServiceImpl extends ServiceImpl<ResourceRepairTas
throw BusinessException.build("提报人不能为空!!!");
}
//调用方法,关闭异常单的状态
anomalyService.anomalyReveseRepairShutDown(resourceRepairTask.getObjectBo());
String objectBo = resourceRepairTask.getObjectBo();
if (objectBo != null){
anomalyService.anomalyReveseRepairShutDown(objectBo);
}
resourceRepairTask.setCreateUser(reportUser);
resourceRepairTask.setCreatedDateTime(LocalDateTime.now());

Loading…
Cancel
Save