Merge remote-tracking branch 'origin/master'

master
philip 4 years ago
commit 5e053f8671

@ -246,16 +246,16 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
public String anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose) { public String anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose) {
String message = this.generateAbnormalBill(abnormalBill, abnormalBillDispose, null, null); String message = this.generateAbnormalBill(abnormalBill, abnormalBillDispose, null, null);
//判断设备异常是否有为处理完成的sfc //判断设备异常是否有为处理完成的sfc
if(!StringUtil.isBlank(abnormalBill.getSfc()) ){ // if(!StringUtil.isBlank(abnormalBill.getSfc()) ){
List<String> status = new ArrayList<>(); // List<String> status = new ArrayList<>();
status.add(Constants.PROGRAM_CONFIRM); // status.add(Constants.PROGRAM_CONFIRM);
status.add(Constants.CANCEL); // status.add(Constants.CANCEL);
status.add(Constants.SHUT_DOWN); // status.add(Constants.SHUT_DOWN);
List<AbnormalBill> abnormalBillList = abnormalBillMapper.findCountBySfc(abnormalBill.getSite(), abnormalBill.getType(), abnormalBill.getSfc(), status); // List<AbnormalBill> abnormalBillList = abnormalBillMapper.findCountBySfc(abnormalBill.getSite(), abnormalBill.getType(), abnormalBill.getSfc(), status);
if(abnormalBillList.size() >= 1 ){ // if(abnormalBillList.size() >= 1 ){
throw BusinessException.build("设备异常有未处理完成的sfc"); // throw BusinessException.build("设备异常有未处理完成的sfc");
} // }
} // }
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose); abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
this.saveOrUpdate(abnormalBill); this.saveOrUpdate(abnormalBill);
//发送消息 //发送消息
@ -463,20 +463,29 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Override @Override
public String generateAbnormalBill(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose,List<String> dutyCauseType,List<String> dutyType) { public String generateAbnormalBill(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose,List<String> dutyCauseType,List<String> dutyType) {
String site = CommonMethods.getSite(); String site = CommonMethods.getSite();
//返回的消息
String message = "提报成功";
LocalDateTime currentTime = LocalDateTime.now(); LocalDateTime currentTime = LocalDateTime.now();
String user = CommonMethods.getUser(); String user = CommonMethods.getUser();
//return 返回的消息
String message = "提报成功";
//如果前台传过来的异常单为空的话,则抛出一个异常 //如果前台传过来的异常单为空的话,则抛出一个异常
if(StringUtil.isBlank(abnormalBill.getAbnormalNo())) { if(StringUtil.isBlank(abnormalBill.getAbnormalNo())) {
throw BusinessException.build("异常单号不存在"); throw BusinessException.build("异常单号不存在");
} }
//设置异常单的handle //设置异常单的handle
abnormalBill.setHandle(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo())); abnormalBill.setHandle(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo()));
//判断该异常单是否已经提交
if(abnormalBillMapper.selectById(abnormalBill.getHandle()) != null && if(abnormalBillMapper.selectById(abnormalBill.getHandle()) != null &&
!Constants.SHUT_DOWN.equals(abnormalBill.getStatus())){ !Constants.SHUT_DOWN.equals(abnormalBill.getStatus())){
throw BusinessException.build("该异常单已经提交,请清空后提交"); throw BusinessException.build("该异常单已经提交,请清空后提交");
} }
/** /**
* *
*/ */
@ -492,14 +501,18 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
// message = "保存成功"; // message = "保存成功";
// } // }
// abnormalBillDispose.setClosedUser(null); // abnormalBillDispose.setClosedUser(null);
//设置异常单详细表的handle和abnormalBillBo //设置异常单详细表的handle和abnormalBillBo
abnormalBillDispose.setAbnormalBillBo(abnormalBill.getHandle()); abnormalBillDispose.setAbnormalBillBo(abnormalBill.getHandle());
abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo())); abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
//设置责任划分填报人和填报时间 //设置责任划分填报人和填报时间
abnormalBillDispose.setDutyUser(user); abnormalBillDispose.setDutyUser(user);
abnormalBillDispose.setDutyDateTime(currentTime); abnormalBillDispose.setDutyDateTime(currentTime);
//判断原因分类是否为空,如果不为空把它放进Z_ABNORMAL_CAUSE表里面 //判断原因分类是否为空,如果不为空把它放进Z_ABNORMAL_CAUSE表里面
ArrayList<AbnormalCause> causeTypes = new ArrayList<>(); ArrayList<AbnormalCause> causeTypes = new ArrayList<>();
if(dutyCauseType != null && dutyCauseType.size() >= 1){ if(dutyCauseType != null && dutyCauseType.size() >= 1){
@ -525,6 +538,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
} }
} }
//判断工序编码是否传递错误 //判断工序编码是否传递错误
if(!StringUtil.isBlank(abnormalBill.getOperation())){ if(!StringUtil.isBlank(abnormalBill.getOperation())){
QueryWrapper<Operation> operationQueryWrapper = new QueryWrapper<Operation>(); QueryWrapper<Operation> operationQueryWrapper = new QueryWrapper<Operation>();
@ -536,7 +550,8 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
} }
} }
//判断设备传递的不良代码是否有误
//判断设备异常提报传递的不良代码是否有误
if(!StringUtil.isBlank(abnormalBill.getNcCode()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){ if(!StringUtil.isBlank(abnormalBill.getNcCode()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
List<String> ncCodes = Arrays.asList(abnormalBill.getNcCode().split(",")); List<String> ncCodes = Arrays.asList(abnormalBill.getNcCode().split(","));
Integer length = ncCodeMapper.checkNcCode(ncCodes,site,"FAILURE"); Integer length = ncCodeMapper.checkNcCode(ncCodes,site,"FAILURE");
@ -571,17 +586,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
} }
} }
//设置创建时间和更新时间
if(abnormalBillMapper.selectById(abnormalBill.getHandle()) == null){
abnormalBill.setCreatedDateTime(currentTime);
abnormalBill.setCreatedUser(user);
abnormalBillDispose.setCreatedDataTime(currentTime);
abnormalBillDispose.setCreatedUser(user);
}
abnormalBill.setModifiedDateTime(currentTime);
abnormalBill.setModifiedUser(user);
abnormalBillDispose.setModifiedDateTime(currentTime);
abnormalBillDispose.setModifiedUser(user);
/** /**
* SFC sfc * SFC sfc
@ -591,10 +595,14 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
if(StringUtil.isBlank(abnormalBill.getSfc()) && !Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())) { if(StringUtil.isBlank(abnormalBill.getSfc()) && !Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())) {
throw BusinessException.build("产品条码不能为空"); throw BusinessException.build("产品条码不能为空");
} }
//异常提报的时候,提报用户不可以为空
//异常提报的时候,提报用户组不可以为空
if(StringUtil.isBlank(abnormalBill.getReportSendUserGroup()) ) { if(StringUtil.isBlank(abnormalBill.getReportSendUserGroup()) ) {
throw BusinessException.build("提报用户组不能为空"); throw BusinessException.build("提报用户组不能为空");
} }
// }else if(!StringUtil.isBlank(abnormalBill.getSfc()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){ // }else if(!StringUtil.isBlank(abnormalBill.getSfc()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
// AbnormalBill abnormalBill2 = new AbnormalBill(); // AbnormalBill abnormalBill2 = new AbnormalBill();
// abnormalBill2.setType(abnormalBill.getType()); // abnormalBill2.setType(abnormalBill.getType());
@ -617,12 +625,16 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
// } // }
// } // }
//判断设备异常提交的设备是否正确
if(!StringUtil.isBlank(abnormalBill.getResrce()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){ if(!StringUtil.isBlank(abnormalBill.getResrce()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
Resrce resrce = resrceMapper.selectById(HandleEnum.RESOURCE.getHandle(site, abnormalBill.getResrce())); Resrce resrce = resrceMapper.selectById(HandleEnum.RESOURCE.getHandle(site, abnormalBill.getResrce()));
if(resrce == null){ if(resrce == null){
throw BusinessException.build("该设备编号不存在"); throw BusinessException.build("该设备编号不存在");
} }
} }
//判断不良品数量和问题数量是否为正整数 //判断不良品数量和问题数量是否为正整数
try { try {
if(!StringUtil.isBlank(abnormalBill.getNcQty()) && Integer.parseInt(abnormalBill.getNcQty()) < 0) { if(!StringUtil.isBlank(abnormalBill.getNcQty()) && Integer.parseInt(abnormalBill.getNcQty()) < 0) {
@ -635,8 +647,11 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
throw BusinessException.build("问题数量或不良品数量必须为一个正整数"); throw BusinessException.build("问题数量或不良品数量必须为一个正整数");
} }
//判断输入的责任划分用户组是否正确,并返回对应的用户
//判断输入的责任划分用户组是否正确,并返回对应的用户组下的用户
nwaUserService.checkUserGroup(site,abnormalBillDispose.getDutySendUserGroup()); nwaUserService.checkUserGroup(site,abnormalBillDispose.getDutySendUserGroup());
//插入原因分类和责任分类 //插入原因分类和责任分类
if(dutyTypes.size() > 0){ if(dutyTypes.size() > 0){
abnormalDutyService.saveOrUpdateBatch(dutyTypes); abnormalDutyService.saveOrUpdateBatch(dutyTypes);
@ -649,6 +664,33 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
this.fileUpload(abnormalBill); this.fileUpload(abnormalBill);
} }
//判断该sfc是否已经提交过一个异常如果已经提交且状态不是方案确认、取消、闭环关闭则报错
List<String> status = new ArrayList<>();
status.add(Constants.PROGRAM_CONFIRM);
status.add(Constants.CANCEL);
status.add(Constants.SHUT_DOWN);
List<AbnormalBill> abnormalBillList = abnormalBillMapper.findCountBySfc(abnormalBill.getSite(), abnormalBill.getType(), abnormalBill.getSfc(), status);
String abnormalType = abnormalBill.getType().equals(Constants.ABNORMAL_QUALITY) ? "质量异常" :
abnormalBill.getType().equals(Constants.ABNORMAL_OTHER) ? "其他异常" : "设备异常" ;
if(abnormalBillList.size() >= 1 ){
throw BusinessException.build(abnormalType + "有未处理完成的产品条码SFC");
}
//设置创建时间和更新时间
if(abnormalBillMapper.selectById(abnormalBill.getHandle()) == null){
abnormalBill.setCreatedDateTime(currentTime);
abnormalBill.setCreatedUser(user);
abnormalBillDispose.setCreatedDataTime(currentTime);
abnormalBillDispose.setCreatedUser(user);
}
abnormalBill.setModifiedDateTime(currentTime);
abnormalBill.setModifiedUser(user);
abnormalBillDispose.setModifiedDateTime(currentTime);
abnormalBillDispose.setModifiedUser(user);
// this.anomalyCreatedAndSendMessage(abnormalBill,null); // this.anomalyCreatedAndSendMessage(abnormalBill,null);
return message; return message;

@ -0,0 +1,112 @@
package com.foreverwin.mesnac.common.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.model.Printer;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.R;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.foreverwin.mesnac.common.service.PrinterService;
import java.time.LocalDateTime;
import java.util.List;
/**
*
* @author Leon.L
* @since 2021-08-11
*/
@RestController
@RequestMapping("/PRINTER")
public class PrinterController {
@Autowired
public PrinterService printerService;
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getPrinterList(Printer printer){
List<Printer> result;
try {
String site = CommonMethods.getSite();
printer.setSite(site);
QueryWrapper<Printer> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(printer);
result = printerService.list(queryWrapper);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok(result);
}
@ResponseBody
@GetMapping("/getPrinter")
public R savePrinter(String printer) {
Printer result = null;
try {
String site = CommonMethods.getSite();
String handle = HandleEnum.PRINT.getHandle(site, printer);
result = printerService.getById(handle);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok(result);
}
@ResponseBody
@PostMapping("/savePrinter")
public R savePrinter(@RequestBody Printer printer) {
try {
LocalDateTime nowDate = LocalDateTime.now();
String site = CommonMethods.getSite();
String handle = HandleEnum.PRINT.getHandle(site, printer.getPrinter());
Printer printerModel = printerService.getById(handle);
if (printerModel == null) {
printer.setHandle(handle);
printer.setSite(site);
printer.setCreatedDateTime(nowDate);
printer.setModifiedDateTime(nowDate);
printerService.save(printer);
} else {
printerModel.setDescription(printer.getDescription());
printerModel.setModifiedDateTime(nowDate);
printerService.updateById(printerModel);
}
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok();
}
@ResponseBody
@PostMapping("/delPrinter")
public R delPrinter(Printer printer) {
try {
String site = CommonMethods.getSite();
String handle = HandleEnum.PRINT.getHandle(site, printer.getPrinter());
Printer printerModel = printerService.getById(handle);
if (printerModel == null) {
throw BusinessException.build("请先检索再删除!");
} else {
printerService.removeById(printerModel);
}
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok();
}
}

@ -20,6 +20,8 @@ public enum HandleEnum {
/**物料清单**/ /**物料清单**/
BOM("BOMBO:","BOMBO:{0},{1},{2},{3}"), BOM("BOMBO:","BOMBO:{0},{1},{2},{3}"),
PRINT("PrintBO:", "PrintBO:{0},{1}"),
/**叫料**/ /**叫料**/
CALL_ITEM("CallItemBO:", "CallItemBO:{0},{1}"), CALL_ITEM("CallItemBO:", "CallItemBO:{0},{1}"),

@ -1,6 +1,6 @@
package com.foreverwin.mesnac.meapi.mapper; package com.foreverwin.mesnac.common.mapper;
import com.foreverwin.mesnac.meapi.model.Printer; import com.foreverwin.mesnac.common.model.Printer;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -10,7 +10,7 @@ import org.springframework.stereotype.Repository;
* </p> * </p>
* *
* @author Leon.L * @author Leon.L
* @since 2021-07-22 * @since 2021-08-11
*/ */
@Repository @Repository
public interface PrinterMapper extends BaseMapper<Printer> { public interface PrinterMapper extends BaseMapper<Printer> {

@ -1,7 +1,8 @@
package com.foreverwin.mesnac.meapi.model; package com.foreverwin.mesnac.common.model;
import java.io.Serializable; import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -15,15 +16,15 @@ import com.baomidou.mybatisplus.annotation.IdType;
* </p> * </p>
* *
* @author Leon.L * @author Leon.L
* @since 2021-07-22 * @since 2021-08-11
*/ */
@TableName("PRINTER") @TableName("Z_PRINTER")
public class Printer extends Model<Printer> { public class Printer extends Model<Printer> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableField("HANDLE") @TableId(value = "HANDLE", type = IdType.INPUT)
private String handle; private String handle;
@TableField("SITE") @TableField("SITE")
private String site; private String site;

@ -1,7 +1,7 @@
package com.foreverwin.mesnac.meapi.service; package com.foreverwin.mesnac.common.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.model.Printer; import com.foreverwin.mesnac.common.model.Printer;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.modular.core.util.FrontPage; import com.foreverwin.modular.core.util.FrontPage;
@ -13,7 +13,7 @@ import java.util.List;
* </p> * </p>
* *
* @author Leon.L * @author Leon.L
* @since 2021-07-22 * @since 2021-08-11
*/ */
public interface PrinterService extends IService<Printer> { public interface PrinterService extends IService<Printer> {

@ -1,11 +1,11 @@
package com.foreverwin.mesnac.meapi.service.impl; package com.foreverwin.mesnac.common.service.impl;
import com.foreverwin.modular.core.util.FrontPage; import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.model.Printer; import com.foreverwin.mesnac.common.model.Printer;
import com.foreverwin.mesnac.meapi.mapper.PrinterMapper; import com.foreverwin.mesnac.common.mapper.PrinterMapper;
import com.foreverwin.mesnac.meapi.service.PrinterService; import com.foreverwin.mesnac.common.service.PrinterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -18,7 +18,7 @@ import java.util.List;
* </p> * </p>
* *
* @author Leon.L * @author Leon.L
* @since 2021-07-22 * @since 2021-08-11
*/ */
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.foreverwin.mesnac.meapi.mapper.PrinterMapper"> <mapper namespace="com.foreverwin.mesnac.common.mapper.PrinterMapper">
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.meapi.model.Printer"> <resultMap id="BaseResultMap" type="com.foreverwin.mesnac.common.model.Printer">
<result column="HANDLE" property="handle" /> <result column="HANDLE" property="handle" />
<result column="SITE" property="site" /> <result column="SITE" property="site" />
<result column="PRINTER" property="printer" /> <result column="PRINTER" property="printer" />
@ -22,7 +22,7 @@
<select id="selectByMap" resultMap="BaseResultMap"> <select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> SELECT <include refid="Base_Column_List"></include>
FROM PRINTER FROM Z_PRINTER
<if test="cm!=null and !cm.isEmpty"> <if test="cm!=null and !cm.isEmpty">
<where> <where>
<foreach collection="cm.keys" item="k" separator="AND"> <foreach collection="cm.keys" item="k" separator="AND">
@ -36,7 +36,7 @@
<select id="selectOne" resultMap="BaseResultMap"> <select id="selectOne" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM PRINTER SELECT <include refid="Base_Column_List"></include> FROM Z_PRINTER
<where> <where>
<if test="ew.entity.handle!=null"> <if test="ew.entity.handle!=null">
HANDLE=#{ew.handle} HANDLE=#{ew.handle}
@ -51,7 +51,7 @@
</select> </select>
<select id="selectCount" resultType="Integer"> <select id="selectCount" resultType="Integer">
SELECT COUNT(1) FROM PRINTER SELECT COUNT(1) FROM Z_PRINTER
<where> <where>
<if test="ew!=null"> <if test="ew!=null">
<if test="ew.entity!=null"> <if test="ew.entity!=null">
@ -76,7 +76,7 @@
</select> </select>
<select id="selectList" resultMap="BaseResultMap"> <select id="selectList" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM PRINTER SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_PRINTER
<where> <where>
<if test="ew!=null"> <if test="ew!=null">
<if test="ew.entity!=null"> <if test="ew.entity!=null">
@ -101,7 +101,7 @@
</select> </select>
<select id="selectMaps" resultType="HashMap"> <select id="selectMaps" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM PRINTER SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_PRINTER
<where> <where>
<if test="ew!=null"> <if test="ew!=null">
<if test="ew.entity!=null"> <if test="ew.entity!=null">
@ -126,7 +126,7 @@
</select> </select>
<select id="selectObjs" resultType="Object"> <select id="selectObjs" resultType="Object">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM PRINTER SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_PRINTER
<where> <where>
<if test="ew!=null"> <if test="ew!=null">
<if test="ew.entity!=null"> <if test="ew.entity!=null">
@ -151,7 +151,7 @@
</select> </select>
<select id="selectPage" resultMap="BaseResultMap"> <select id="selectPage" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM PRINTER SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_PRINTER
<where> <where>
<if test="ew!=null"> <if test="ew!=null">
<if test="ew.entity!=null"> <if test="ew.entity!=null">
@ -176,7 +176,7 @@
</select> </select>
<select id="selectMapsPage" resultType="HashMap"> <select id="selectMapsPage" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM PRINTER SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_PRINTER
<where> <where>
<if test="ew!=null"> <if test="ew!=null">
<if test="ew.entity!=null"> <if test="ew.entity!=null">
@ -200,8 +200,8 @@
</if> </if>
</select> </select>
<insert id="insert" parameterType="com.foreverwin.mesnac.meapi.model.Printer"> <insert id="insert" parameterType="com.foreverwin.mesnac.common.model.Printer">
INSERT INTO PRINTER INSERT INTO Z_PRINTER
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE, HANDLE,
<if test="site!=null">SITE,</if> <if test="site!=null">SITE,</if>
@ -222,8 +222,8 @@
</trim> </trim>
</insert> </insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.meapi.model.Printer"> <insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.common.model.Printer">
INSERT INTO PRINTER INSERT INTO Z_PRINTER
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include> <include refid="Base_Column_List"></include>
</trim> VALUES </trim> VALUES
@ -244,7 +244,7 @@
<update id="update"> <update id="update">
UPDATE PRINTER <trim prefix="SET" suffixOverrides=","> UPDATE Z_PRINTER <trim prefix="SET" suffixOverrides=",">
<if test="et.handle!=null">HANDLE=#{et.handle},</if> <if test="et.handle!=null">HANDLE=#{et.handle},</if>
<if test="et.site!=null">SITE=#{et.site},</if> <if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.printer!=null">PRINTER=#{et.printer},</if> <if test="et.printer!=null">PRINTER=#{et.printer},</if>
@ -276,7 +276,7 @@
<delete id="deleteByMap"> <delete id="deleteByMap">
DELETE FROM PRINTER DELETE FROM Z_PRINTER
<if test="cm!=null and !cm.isEmpty"> <if test="cm!=null and !cm.isEmpty">
<where> <where>
<foreach collection="cm.keys" item="k" separator="AND"> <foreach collection="cm.keys" item="k" separator="AND">
@ -289,7 +289,7 @@
</delete> </delete>
<delete id="delete"> <delete id="delete">
DELETE FROM PRINTER DELETE FROM Z_PRINTER
<where> <where>
<if test="ew!=null"> <if test="ew!=null">
<if test="ew.entity!=null"> <if test="ew.entity!=null">

@ -151,6 +151,24 @@ public class CallItemController {
return R.ok("叫料操作成功"); return R.ok("叫料操作成功");
} }
/**
* pda
* @param callItemList
* @return
*/
@ResponseBody
@PostMapping("/callOrConfirmItemPda")
public R callOrConfirmItemPda(@RequestBody List<CallItem> callItemList) {
try {
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
callItemService.callOrConfirmItemPda(site, user, callItemList.get(0).getCallStatus() ,callItemList);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok("叫料成功");
}
@ResponseBody @ResponseBody
@PostMapping("/confirmReceive") @PostMapping("/confirmReceive")
@ -203,6 +221,24 @@ public class CallItemController {
return R.ok("刷新叫料明细成功"); return R.ok("刷新叫料明细成功");
} }
/**
*
* @param callItemList
* @return
*/
@ResponseBody
@PostMapping("/refreshCallItemPda")
public R refreshCallItemPda(@RequestBody List<CallItem> callItemList) {
try {
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
callItemService.refreshCallItemPda(site, user, callItemList);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok("刷新叫料明细成功");
}
@ResponseBody @ResponseBody
@PostMapping("/refreshRequiredTime") @PostMapping("/refreshRequiredTime")
public R refreshRequiredTime(@RequestBody List<String> callItemNoList) { public R refreshRequiredTime(@RequestBody List<String> callItemNoList) {

@ -40,6 +40,17 @@ public interface CallItemMapper extends BaseMapper<CallItem> {
void updateCallItemStatusByDispatchBo(@Param("status") String status, @Param("user") String user, @Param("dateTime") LocalDateTime dateTime, @Param("list") List<String> list); void updateCallItemStatusByDispatchBo(@Param("status") String status, @Param("user") String user, @Param("dateTime") LocalDateTime dateTime, @Param("list") List<String> list);
/**
* PDA--
* @param status
* @param user
* @param dateTime
* @param list
*/
void updateCallItemStatusByHandle(@Param("status") String status, @Param("user") String user, @Param("dateTime") LocalDateTime dateTime, @Param("list") List<String> list);
void findRefreshCallItemPda(@Param("list") List<String> list);
void updateCallItemStatusByCallItemNo(@Param("status") String status, @Param("user") String user, @Param("dateTime") LocalDateTime dateTime, @Param("list") List<String> list); void updateCallItemStatusByCallItemNo(@Param("status") String status, @Param("user") String user, @Param("dateTime") LocalDateTime dateTime, @Param("list") List<String> list);
void refreshRequiredTime(@Param("user") String user, @Param("dateTime") LocalDateTime dateTime, @Param("list") List<String> list); void refreshRequiredTime(@Param("user") String user, @Param("dateTime") LocalDateTime dateTime, @Param("list") List<String> list);

@ -76,6 +76,14 @@ public interface CallItemService extends IService<CallItem> {
*/ */
void callItem(String site, String user, List<CallItem> callItemList); void callItem(String site, String user, List<CallItem> callItemList);
/**
* PDA
* @param site
* @param user
* @param callItemList
*/
void callOrConfirmItemPda(String site, String user, String status ,List<CallItem> callItemList);
/** /**
* *
* ---- * ----
@ -104,6 +112,14 @@ public interface CallItemService extends IService<CallItem> {
*/ */
void refreshCallItem(String site, String user, List<CallItem> callItemList); void refreshCallItem(String site, String user, List<CallItem> callItemList);
/**
* PDA
* @param site
* @param user
* @param callItemList
*/
void refreshCallItemPda(String site, String user, List<CallItem> callItemList);
/** /**
* *
* *

@ -155,6 +155,16 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
this.updateCallItemStatusByDispatchBo(Constants.CALL_ITEM_STATUS_CALLED, user, dispatchBoList); this.updateCallItemStatusByDispatchBo(Constants.CALL_ITEM_STATUS_CALLED, user, dispatchBoList);
} }
@Override
public void callOrConfirmItemPda(String site, String user,String status ,List<CallItem> callItemList) {
LocalDateTime dateTime = LocalDateTime.now();
List<String> list = new ArrayList<>();
for (CallItem callItem : callItemList) {
list.add(callItem.getHandle());
}
callItemMapper.updateCallItemStatusByHandle(status, user, dateTime, list);
}
@Override @Override
public void confirmReceive(String site, String user, List<CallItem> callItemList) { public void confirmReceive(String site, String user, List<CallItem> callItemList) {
if (callItemList == null || callItemList.size() <= 0) { if (callItemList == null || callItemList.size() <= 0) {
@ -260,6 +270,11 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
} }
} }
@Override
public void refreshCallItemPda(String site, String user, List<CallItem> callItemList) {
}
@Override @Override
public void refreshRequiredTime(String site, String user, List<String> callItemNoList) { public void refreshRequiredTime(String site, String user, List<String> callItemNoList) {
if (callItemNoList == null || callItemNoList.size() <= 0) { if (callItemNoList == null || callItemNoList.size() <= 0) {
@ -314,7 +329,17 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
continue; continue;
} }
if ("GB".equals(itemGroup) && blankingSize.contains("*")) { if (StringUtil.isBlank(blankingSize)) {
callItem.setSizeReqQty(callItem.getRequiredQty());
compQtyMap.put(component, callItem.getRequiredQty());
continue;
}
if ("GB".equals(itemGroup)) {
if (!blankingSize.contains("*")) {
continue;
}
String []size = blankingSize.split("\\*"); String []size = blankingSize.split("\\*");
if (size != null && size.length >= 2) { if (size != null && size.length >= 2) {
int sizeLength = size.length; int sizeLength = size.length;
@ -327,7 +352,13 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
compQtyMap.put(component, (compQtyMap.get(component) != null ? compQtyMap.get(component).add(sizeReqQty) : sizeReqQty)); compQtyMap.put(component, (compQtyMap.get(component) != null ? compQtyMap.get(component).add(sizeReqQty) : sizeReqQty));
} }
} else { } else {
String []size = blankingSize.split("\\*"); String[] size = new String[1];
if (blankingSize.contains("*")) {
size = blankingSize.split("\\*");
} else {
size[0] = blankingSize;
}
if (size != null && size.length >= 1) { if (size != null && size.length >= 1) {
int sizeLength = size.length; int sizeLength = size.length;
BigDecimal length = new BigDecimal(size[sizeLength-1]); BigDecimal length = new BigDecimal(size[sizeLength-1]);

@ -833,6 +833,14 @@
</foreach> </foreach>
</update> </update>
<update id="updateCallItemStatusByHandle">
UPDATE Z_CALL_ITEM SET CALL_STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime}
WHERE HANDLE IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item}
</foreach>
</update>
<update id="updateCallItemStatusByCallItemNo"> <update id="updateCallItemStatusByCallItemNo">
UPDATE Z_CALL_ITEM SET STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime} UPDATE Z_CALL_ITEM SET STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime}
WHERE STATUS != '804' AND CALL_ITEM_NO IN WHERE STATUS != '804' AND CALL_ITEM_NO IN
@ -971,10 +979,10 @@
</select> </select>
<select id="findCallItemInfoList" resultMap="FullResultMap"> <select id="findCallItemInfoList" resultMap="FullResultMap">
SELECT CI.RESRCE ,CF.VALUE SHOP_ORDER ,CI.REQUIRED_QTY , CI.STATUS AS CALL_STATUS, SELECT CI.HANDLE ,CI.RESRCE ,CF.VALUE SHOP_ORDER ,CI.REQUIRED_QTY , CI.CALL_STATUS,
B.BOM AS ITEM, B.DESCRIPTION ITEM_DESCRIPTION , B.BOM AS ITEM, B.DESCRIPTION ITEM_DESCRIPTION ,
SD.WORK_CENTER , WCT.DESCRIPTION AS WORK_CENTER_DESCRIPTION, SD.BLANKING_SIZE, SD.REMARK, SD.PLANNED_START_DATE, SD.WORK_CENTER , WCT.DESCRIPTION AS WORK_CENTER_DESCRIPTION, SD.BLANKING_SIZE, SD.REMARK, SD.PLANNED_START_DATE,
I.ITEM AS ITEM_NO ,IT.DESCRIPTION AS COMPONENT_DESCRIPTION I.ITEM AS COMPONENT ,IT.DESCRIPTION AS COMPONENT_DESCRIPTION
FROM Z_CALL_ITEM CI FROM Z_CALL_ITEM CI
LEFT JOIN SHOP_ORDER SO ON CI.SHOP_ORDER = SO.SHOP_ORDER LEFT JOIN SHOP_ORDER SO ON CI.SHOP_ORDER = SO.SHOP_ORDER
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = SO.HANDLE AND CF."ATTRIBUTE" = 'WORK_ORDER' LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = SO.HANDLE AND CF."ATTRIBUTE" = 'WORK_ORDER'
@ -985,7 +993,7 @@
LEFT JOIN WORK_CENTER_T WCT ON WC.HANDLE = WCT.WORK_CENTER_BO LEFT JOIN WORK_CENTER_T WCT ON WC.HANDLE = WCT.WORK_CENTER_BO
LEFT JOIN ITEM I ON CI.COMPONENT_BO = I.HANDLE LEFT JOIN ITEM I ON CI.COMPONENT_BO = I.HANDLE
LEFT JOIN ITEM_T IT ON I.HANDLE = IT.ITEM_BO LEFT JOIN ITEM_T IT ON I.HANDLE = IT.ITEM_BO
WHERE CI.SITE = #{site} WHERE CI.SITE = #{site} AND WCT.LOCALE = 'zh'
<if test="workCenter != null and workCenter != ''"> <if test="workCenter != null and workCenter != ''">
AND SD.WORK_CENTER = #{workCenter} AND SD.WORK_CENTER = #{workCenter}
</if> </if>
@ -998,13 +1006,28 @@
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND CI.STATUS = #{status} AND CI.STATUS = #{status}
</if> </if>
<if test="startFromDate_S != null"> <if test="startFromDate != null">
AND SD.PLANNED_START_DATE >= #{startFromDate_S} AND SD.PLANNED_START_DATE >= #{startFromDate}
</if> </if>
<if test="startToDate_S != null"> <if test="startToDate != null">
AND SD.PLANNED_START_DATE &lt;= #{startToDate_S} AND SD.PLANNED_START_DATE &lt;= #{startToDate}
</if> </if>
ORDER BY CF.VALUE ,CI.RESRCE, I.ITEM ORDER BY CF.VALUE ,CI.RESRCE, I.ITEM
</select> </select>
<select id="findRefreshCallItemPda" resultMap="FullResultMap">
SELECT CI.HANDLE ,CI.SFC ,CI.COMPONENT_BO ,BC.QTY REQUIRED_QTY, CF.VALUE STEP_ID
--BC.BOM_BO , CI.STEP_ID ,
FROM Z_CALL_ITEM CI
LEFT JOIN SFC S ON S.SFC = CI.SFC
LEFT JOIN SFC_BOM SB ON SB.SFC_BO = S.HANDLE
LEFT JOIN BOM_COMPONENT BC ON BC.BOM_BO = SB.BOM_BO AND BC.COMPONENT_GBO = CI.COMPONENT_BO
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = BC.HANDLE AND CF."ATTRIBUTE" = 'STEP_ID' AND CF.VALUE = CI.STEP_ID
WHERE HANDLE IN
(
<foreach item="item" index="index" collection="coll" separator=",">
#{item}
</foreach>
)
</select>
</mapper> </mapper>

@ -36,11 +36,11 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.foreverwin.mesnac</groupId> <groupId>com.foreverwin.mesnac</groupId>
<artifactId>dispatch</artifactId> <artifactId>common</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.foreverwin.mesnac</groupId> <groupId>com.foreverwin.mesnac</groupId>
<artifactId>common</artifactId> <artifactId>dispatch</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

@ -1,130 +0,0 @@
package com.foreverwin.mesnac.meapi.controller;
import com.foreverwin.modular.core.util.R;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.CommonMethods;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.foreverwin.mesnac.meapi.service.PrinterService;
import com.foreverwin.mesnac.meapi.model.Printer;
import java.util.List;
/**
*
* @author Leon.L
* @since 2021-07-22
*/
@RestController
@RequestMapping("/PRINTER")
public class PrinterController {
@Autowired
public PrinterService printerService;
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getPrinterById(@PathVariable String id) {
return R.ok( printerService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getPrinterList(Printer printer){
List<Printer> result;
try {
String site = CommonMethods.getSite();
printer.setSite(site);
QueryWrapper<Printer> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(printer);
result = printerService.list(queryWrapper);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<Printer> frontPage, Printer printer){
IPage result;
QueryWrapper<Printer> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(printer);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(Printer::getHandle, frontPage.getGlobalQuery())
.or().like(Printer::getSite, frontPage.getGlobalQuery())
.or().like(Printer::getPrinter, frontPage.getGlobalQuery())
.or().like(Printer::getDescription, frontPage.getGlobalQuery())
.or().like(Printer::getEnabled, frontPage.getGlobalQuery())
);
}
result = printerService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param printer
* @return null
*/
@PostMapping
public R save(@RequestBody Printer printer) {
return R.ok(printerService.save(printer));
}
/**
*
* @param printer
* @return null
*/
@PutMapping
public R updateById(@RequestBody Printer printer) {
return R.ok(printerService.updateById(printer));
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(printerService.removeById(id));
}
/**
*
* @param ids ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.POST, value = "/delete-batch")
public R removeByIds(List<String> ids){
return R.ok(printerService.removeByIds(ids));
}
}
Loading…
Cancel
Save