fix(手工打印取样标签):新增
This commit is contained in:
parent
c69b6bfbf4
commit
59248d50ce
@ -0,0 +1,39 @@
|
||||
package com.foreverwin.iep.qms.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 打印取样标签生产批DTO
|
||||
*
|
||||
* @author hechuan.liao
|
||||
* @date 2024-11-15 21:29:36
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class QmsPrintSamplingLabelLotNoDTO {
|
||||
|
||||
/**
|
||||
* 站点
|
||||
*/
|
||||
private String site;
|
||||
|
||||
/**
|
||||
* 生产批/条码号
|
||||
*/
|
||||
private String lotNo;
|
||||
|
||||
/**
|
||||
* 工单
|
||||
*/
|
||||
private String shopOrder;
|
||||
|
||||
/**
|
||||
* 产品编号
|
||||
*/
|
||||
private String item;
|
||||
|
||||
/**
|
||||
* 产品描述
|
||||
*/
|
||||
private String itemDesc;
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.foreverwin.iep.qms.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 打印取样标签打印请求DTO
|
||||
*
|
||||
* @author hechuan.liao
|
||||
* @date 2024-11-15 21:29:36
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class QmsPrintSamplingLabelRequestDTO {
|
||||
|
||||
/**
|
||||
* 站点
|
||||
*/
|
||||
private String site;
|
||||
|
||||
/**
|
||||
* 生产批/条码号
|
||||
*/
|
||||
private String lotNo;
|
||||
|
||||
/**
|
||||
* 产品编号
|
||||
*/
|
||||
private String item;
|
||||
|
||||
/**
|
||||
* 工序编号
|
||||
*/
|
||||
private String operation;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String resrce;
|
||||
|
||||
/**
|
||||
* 打印数量
|
||||
*/
|
||||
private String labelQty;
|
||||
|
||||
/**
|
||||
* 打印机名称
|
||||
*/
|
||||
private String printerName;
|
||||
}
|
||||
@ -11,10 +11,10 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
@EnableMomXxlJob
|
||||
@EnableMomSwagger2
|
||||
@EnableMomFeignClients(basePackages = {"com.foreverwin.mom", "com.foreverwin.iep"})
|
||||
@EnableMomFeignClients(basePackages = {"com.foreverwin.mom", "com.foreverwin.iep", "com.foreverwin.nlv"})
|
||||
@EnableDiscoveryClient
|
||||
@EnableMomResourceServer
|
||||
@SpringBootApplication(scanBasePackages = {"com.foreverwin.mom", "com.foreverwin.iep"})
|
||||
@SpringBootApplication(scanBasePackages = {"com.foreverwin.mom", "com.foreverwin.iep", "com.foreverwin.nlv"})
|
||||
// 需配置不然扫不到mes-db的mapper
|
||||
@MapperScan({"com.foreverwin.iep.**.mapper"})
|
||||
public class Application {
|
||||
|
||||
@ -0,0 +1,73 @@
|
||||
package com.foreverwin.iep.qms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.foreverwin.iep.qms.dto.QmsPrintSamplingLabelLotNoDTO;
|
||||
import com.foreverwin.iep.qms.dto.QmsPrintSamplingLabelRequestDTO;
|
||||
import com.foreverwin.iep.qms.service.QmsPrintSamplingLabelService;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 手工打印取样标签
|
||||
*
|
||||
* @author hechuan.liao
|
||||
* @date 2024-11-15 21:29:36
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/print-sampling-label" )
|
||||
@Api(value = "print-sampling-label", tags = "手工打印取样标签")
|
||||
public class QmsPrintSamplingLabelController {
|
||||
|
||||
private final QmsPrintSamplingLabelService qmsPrintSamplingLabelService;
|
||||
|
||||
/**
|
||||
* 生产批号帮助框分页查询
|
||||
* @param page 分页对象
|
||||
* @param qmsPrintSamplingLabelLotNoDTO 打印取样标签生产批DTO
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "生产批号帮助框分页查询", notes = "生产批号帮助框分页查询")
|
||||
@GetMapping("/readLotNoPage" )
|
||||
public R<IPage<QmsPrintSamplingLabelLotNoDTO>> readLotNoPage(Page page, QmsPrintSamplingLabelLotNoDTO qmsPrintSamplingLabelLotNoDTO) {
|
||||
return R.ok(qmsPrintSamplingLabelService.readLotNoPage(page, qmsPrintSamplingLabelLotNoDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过生产批号查询产品编号
|
||||
* @param qmsPrintSamplingLabelLotNoDTO 打印取样标签生产批DTO
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "通过生产批号查询产品编号", notes = "通过生产批号查询产品编号")
|
||||
@GetMapping("/getItemByLotNo" )
|
||||
public R<String> getItemByLotNo(QmsPrintSamplingLabelLotNoDTO qmsPrintSamplingLabelLotNoDTO) {
|
||||
return R.ok(qmsPrintSamplingLabelService.getItemByLotNo(qmsPrintSamplingLabelLotNoDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品编号帮助框分页查询
|
||||
* @param page 分页对象
|
||||
* @param qmsPrintSamplingLabelLotNoDTO 打印取样标签生产批DTO
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "产品编号帮助框分页查询", notes = "产品编号帮助框分页查询")
|
||||
@GetMapping("/readItemPage" )
|
||||
public R<IPage<QmsPrintSamplingLabelLotNoDTO>> readItemPage(Page page, QmsPrintSamplingLabelLotNoDTO qmsPrintSamplingLabelLotNoDTO) {
|
||||
return R.ok(qmsPrintSamplingLabelService.readItemPage(page, qmsPrintSamplingLabelLotNoDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印
|
||||
* @param qmsPrintSamplingLabelRequestDTO 打印取样标签打印请求DTO
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "打印", notes = "打印")
|
||||
@PostMapping("/podPrint" )
|
||||
public R<String> podPrint(@RequestBody QmsPrintSamplingLabelRequestDTO qmsPrintSamplingLabelRequestDTO) {
|
||||
return R.ok(qmsPrintSamplingLabelService.podPrint(qmsPrintSamplingLabelRequestDTO));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.foreverwin.iep.qms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.iep.qms.dto.QmsPrintSamplingLabelLotNoDTO;
|
||||
import com.foreverwin.iep.qms.dto.QmsPrintSamplingLabelRequestDTO;
|
||||
|
||||
/**
|
||||
* 手工打印取样标签
|
||||
*
|
||||
* @author hechuan.liao
|
||||
* @date 2024-11-15 21:29:36
|
||||
*/
|
||||
public interface QmsPrintSamplingLabelService extends IService<QmsPrintSamplingLabelRequestDTO> {
|
||||
|
||||
/**
|
||||
* 生产批号帮助框分页查询
|
||||
* @param page 分页对象
|
||||
* @param qmsPrintSamplingLabelLotNoDTO 打印取样标签生产批DTO
|
||||
* @return
|
||||
*/
|
||||
IPage<QmsPrintSamplingLabelLotNoDTO> readLotNoPage(Page page, QmsPrintSamplingLabelLotNoDTO qmsPrintSamplingLabelLotNoDTO);
|
||||
|
||||
/**
|
||||
* 通过生产批号查询产品编号
|
||||
* @param qmsPrintSamplingLabelLotNoDTO 打印取样标签生产批DTO
|
||||
* @return
|
||||
*/
|
||||
String getItemByLotNo(QmsPrintSamplingLabelLotNoDTO qmsPrintSamplingLabelLotNoDTO);
|
||||
|
||||
/**
|
||||
* 产品编号帮助框分页查询
|
||||
* @param page 分页对象
|
||||
* @param qmsPrintSamplingLabelLotNoDTO 打印取样标签生产批DTO
|
||||
* @return
|
||||
*/
|
||||
IPage<QmsPrintSamplingLabelLotNoDTO> readItemPage(Page page, QmsPrintSamplingLabelLotNoDTO qmsPrintSamplingLabelLotNoDTO);
|
||||
|
||||
/**
|
||||
* 打印
|
||||
* @param qmsPrintSamplingLabelRequestDTO 打印取样标签打印请求DTO
|
||||
* @return R
|
||||
*/
|
||||
String podPrint(QmsPrintSamplingLabelRequestDTO qmsPrintSamplingLabelRequestDTO);
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
package com.foreverwin.iep.qms.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.iep.integration.constant.Msg;
|
||||
import com.foreverwin.iep.qms.dto.QmsPrintSamplingLabelLotNoDTO;
|
||||
import com.foreverwin.iep.qms.dto.QmsPrintSamplingLabelRequestDTO;
|
||||
import com.foreverwin.iep.qms.mapper.QmsPrintSamplingLabelMapper;
|
||||
import com.foreverwin.iep.qms.service.QmsPrintSamplingLabelService;
|
||||
import com.foreverwin.mom.common.core.exception.BusinessException;
|
||||
import com.foreverwin.nlv.print.feign.RemotePrintService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 手工打印取样标签
|
||||
*
|
||||
* @author hechuan.liao
|
||||
* @date 2024-11-15 21:29:36
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class QmsPrintSamplingLabelServiceImpl extends ServiceImpl<QmsPrintSamplingLabelMapper, QmsPrintSamplingLabelRequestDTO> implements QmsPrintSamplingLabelService {
|
||||
|
||||
private final RemotePrintService remotePrintService;
|
||||
|
||||
/**
|
||||
* 生产批号帮助框分页查询
|
||||
* @param page 分页对象
|
||||
* @param qmsPrintSamplingLabelLotNoDTO 打印取样标签生产批DTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<QmsPrintSamplingLabelLotNoDTO> readLotNoPage(Page page, QmsPrintSamplingLabelLotNoDTO qmsPrintSamplingLabelLotNoDTO) {
|
||||
return baseMapper.readLotNoPage(page, qmsPrintSamplingLabelLotNoDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过生产批号查询产品编号
|
||||
* @param qmsPrintSamplingLabelLotNoDTO 打印取样标签生产批DTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getItemByLotNo(QmsPrintSamplingLabelLotNoDTO qmsPrintSamplingLabelLotNoDTO) {
|
||||
return baseMapper.getItemByLotNo(qmsPrintSamplingLabelLotNoDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品编号帮助框分页查询
|
||||
* @param page 分页对象
|
||||
* @param qmsPrintSamplingLabelLotNoDTO 打印取样标签生产批DTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<QmsPrintSamplingLabelLotNoDTO> readItemPage(Page page, QmsPrintSamplingLabelLotNoDTO qmsPrintSamplingLabelLotNoDTO) {
|
||||
return baseMapper.readItemPage(page, qmsPrintSamplingLabelLotNoDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印
|
||||
* @param qmsPrintSamplingLabelRequestDTO 打印取样标签打印请求DTO
|
||||
* @return R
|
||||
*/
|
||||
@Override
|
||||
public String podPrint(QmsPrintSamplingLabelRequestDTO qmsPrintSamplingLabelRequestDTO) {
|
||||
// 获取打印规则模板
|
||||
List<String> templateCodeList = baseMapper.readTemplateCodeList(qmsPrintSamplingLabelRequestDTO.getSite());
|
||||
if (CollectionUtils.isEmpty(templateCodeList)) {
|
||||
throw BusinessException.build("站点【"+qmsPrintSamplingLabelRequestDTO.getSite()+"】、客户代码【QMS_SAMPLE】、车间代码【PRINT】、对应工序【PRINT】、规则状态【Y】未获取到打印模板!");
|
||||
} else if (templateCodeList.size() > 1) {
|
||||
throw BusinessException.build("站点【"+qmsPrintSamplingLabelRequestDTO.getSite()+"】、客户代码【QMS_SAMPLE】、车间代码【PRINT】、对应工序【PRINT】、规则状态【Y】维护数据量有误,有且只能存在一条!");
|
||||
}
|
||||
// 组装打印数据
|
||||
JSONObject printRequestObj = new JSONObject();
|
||||
printRequestObj.put("PRINT_NAME", qmsPrintSamplingLabelRequestDTO.getPrinterName());
|
||||
printRequestObj.put("LABEL_QTY", qmsPrintSamplingLabelRequestDTO.getLabelQty());
|
||||
printRequestObj.put("TEMPLATE", templateCodeList.get(0));
|
||||
printRequestObj.put("qmsLotNo", qmsPrintSamplingLabelRequestDTO.getLotNo());
|
||||
printRequestObj.put("qmsItem", qmsPrintSamplingLabelRequestDTO.getItem());
|
||||
printRequestObj.put("qmsOperation", qmsPrintSamplingLabelRequestDTO.getOperation());
|
||||
printRequestObj.put("qmsResrce", qmsPrintSamplingLabelRequestDTO.getResrce());
|
||||
|
||||
// 开个独立的线程,避免阻塞
|
||||
try {
|
||||
remotePrintService.remotePrintSaveLog(printRequestObj);
|
||||
} catch (Exception e) {
|
||||
throw BusinessException.build("调用打印失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
return Msg.S;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.foreverwin.iep.qms.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.iep.qms.dto.QmsPrintSamplingLabelLotNoDTO;
|
||||
import com.foreverwin.iep.qms.dto.QmsPrintSamplingLabelRequestDTO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 手工打印取样标签
|
||||
*
|
||||
* @author hechuan.liao
|
||||
* @date 2024-11-15 21:29:36
|
||||
*/
|
||||
@Mapper
|
||||
public interface QmsPrintSamplingLabelMapper extends BaseMapper<QmsPrintSamplingLabelRequestDTO> {
|
||||
|
||||
IPage<QmsPrintSamplingLabelLotNoDTO> readLotNoPage(Page page, @Param("dto") QmsPrintSamplingLabelLotNoDTO qmsPrintSamplingLabelLotNoDTO);
|
||||
|
||||
String getItemByLotNo(@Param("dto") QmsPrintSamplingLabelLotNoDTO qmsPrintSamplingLabelLotNoDTO);
|
||||
|
||||
IPage<QmsPrintSamplingLabelLotNoDTO> readItemPage(Page page, @Param("dto") QmsPrintSamplingLabelLotNoDTO qmsPrintSamplingLabelLotNoDTO);
|
||||
|
||||
List<String> readTemplateCodeList(@Param("site") String site);
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.foreverwin.iep.qms.mapper.QmsPrintSamplingLabelMapper">
|
||||
|
||||
<!--生产批号帮助框分页查询-->
|
||||
<select id="readLotNoPage" resultType="com.foreverwin.iep.qms.dto.QmsPrintSamplingLabelLotNoDTO">
|
||||
select
|
||||
lb.LOT_NO,
|
||||
so.SHOP_ORDER,
|
||||
i.ITEM,
|
||||
i.DESCRIPTION as ITEM_DESC
|
||||
from
|
||||
wip.lot_basis lb
|
||||
inner join wip.shop_order so on
|
||||
so.SITE = lb.SITE
|
||||
and so.HANDLE = lb.SHOP_ORDER_BO
|
||||
inner join wip.item i on
|
||||
i.SITE = lb.SITE
|
||||
and i.HANDLE = lb.ITEM_BO
|
||||
where
|
||||
lb.SITE = #{dto.site}
|
||||
<if test="dto.lotNo != null and dto.lotNo != ''">
|
||||
and (lb.LOT_NO like concat('%',#{dto.lotNo}, '%')
|
||||
or so.SHOP_ORDER like concat('%',#{dto.lotNo}, '%')
|
||||
or i.ITEM like concat('%',#{dto.lotNo}, '%')
|
||||
or i.DESCRIPTION like concat('%',#{dto.lotNo}, '%'))
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!--通过生产批号查询产品编号-->
|
||||
<select id="getItemByLotNo"
|
||||
resultType="java.lang.String">
|
||||
select
|
||||
i.ITEM as INVENTORY_ITEM
|
||||
from
|
||||
wms.wms_inventory wi
|
||||
inner join wip.item i on
|
||||
i.SITE = wi.SITE
|
||||
and i.HANDLE = wi.ITEM_BO
|
||||
where
|
||||
wi.SITE = #{dto.site}
|
||||
and wi.INVENTORY_ID = #{dto.lotNo}
|
||||
</select>
|
||||
|
||||
<!--产品编号帮助框分页查询-->
|
||||
<select id="readItemPage" resultType="com.foreverwin.iep.qms.dto.QmsPrintSamplingLabelLotNoDTO">
|
||||
select
|
||||
i.ITEM,
|
||||
i.DESCRIPTION as ITEM_DESC
|
||||
from
|
||||
wip.shop_order so
|
||||
inner join wip.item i on
|
||||
i.SITE = so.SITE
|
||||
and i.HANDLE = so.PLANNED_ITEM_BO
|
||||
where
|
||||
so.SITE = #{dto.site}
|
||||
and so.SHOP_ORDER = #{dto.shopOrder}
|
||||
union
|
||||
select
|
||||
i.ITEM,
|
||||
i.DESCRIPTION as ITEM_DESC
|
||||
from
|
||||
wip.shop_order so
|
||||
inner join wip.bom b on
|
||||
b.SITE = so.SITE
|
||||
and b.HANDLE = so.PLANNED_BOM_BO
|
||||
inner join wip.bom_component bc on
|
||||
bc.BOM_BO = b.HANDLE
|
||||
and bc.BOM_COMPONENT_TYPE in ('B', 'C')
|
||||
inner join wip.item i on
|
||||
i.SITE = b.SITE
|
||||
and concat('ItemBO:', i.SITE, ',', i.ITEM, ',#') = bc.COMPONENT_GBO
|
||||
and i.CURRENT_REVISION = 'Y'
|
||||
where
|
||||
so.SITE = #{dto.site}
|
||||
and so.SHOP_ORDER = #{dto.shopOrder}
|
||||
</select>
|
||||
|
||||
<!--获取打印规则模板-->
|
||||
<select id="readTemplateCodeList" resultType="java.lang.String">
|
||||
select
|
||||
pp.TEMPLATE_CODE
|
||||
from
|
||||
wip.print_rule pr
|
||||
inner join wip.print_pages pp on
|
||||
pp.SITE = pr.SITE
|
||||
and pp.PRINT_RULE_BO = pr.HANDLE
|
||||
where
|
||||
pr.SITE = #{site}
|
||||
and pr.FAB_NO = 'PRINT'
|
||||
and pr.OPERATION = 'PRINT'
|
||||
and pr.CUSTOMER_CODE = 'QMS_SAMPLE'
|
||||
and pr.STATUS = 'Y'
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user