Merge remote-tracking branch 'origin/master'

master
zpl 4 years ago
commit 638c30b210

@ -0,0 +1,130 @@
package com.foreverwin.mesnac.anomaly.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.anomaly.service.AbnormalPlanService;
import com.foreverwin.mesnac.anomaly.model.AbnormalPlan;
import java.util.List;
/**
*
* @author zjw
* @since 2021-08-07
*/
@RestController
@RequestMapping("/Z-ABNORMAL-PLAN")
public class AbnormalPlanController {
@Autowired
public AbnormalPlanService abnormalPlanService;
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getAbnormalPlanById(@PathVariable String id) {
return R.ok( abnormalPlanService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getAbnormalPlanList(AbnormalPlan abnormalPlan){
List<AbnormalPlan> result;
QueryWrapper<AbnormalPlan> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(abnormalPlan);
result = abnormalPlanService.list(queryWrapper);
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<AbnormalPlan> frontPage, AbnormalPlan abnormalPlan){
IPage result;
QueryWrapper<AbnormalPlan> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(abnormalPlan);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(AbnormalPlan::getHandle, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getSite, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getAbnormalBillBo, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getStatus, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getWorkCenter, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getAbnormalMethod, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getShopOrder, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getResrce, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getItemBo, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getProcessor, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getClosedUser, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getCreatedUser, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getModifiedUser, frontPage.getGlobalQuery())
);
}
result = abnormalPlanService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param abnormalPlan
* @return null
*/
@PostMapping
public R save(@RequestBody AbnormalPlan abnormalPlan) {
return R.ok(abnormalPlanService.save(abnormalPlan));
}
/**
*
* @param abnormalPlan
* @return null
*/
@PutMapping
public R updateById(@RequestBody AbnormalPlan abnormalPlan) {
return R.ok(abnormalPlanService.updateById(abnormalPlan));
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(abnormalPlanService.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(abnormalPlanService.removeByIds(ids));
}
}

@ -0,0 +1,18 @@
package com.foreverwin.mesnac.anomaly.mapper;
import com.foreverwin.mesnac.anomaly.model.AbnormalPlan;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper
* </p>
*
* @author zjw
* @since 2021-08-07
*/
@Repository
public interface AbnormalPlanMapper extends BaseMapper<AbnormalPlan> {
}

@ -0,0 +1,329 @@
package com.foreverwin.mesnac.anomaly.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
/**
* <p>
*
* </p>
*
* @author zjw
* @since 2021-08-07
*/
@TableName("Z_ABNORMAL_PLAN")
public class AbnormalPlan extends Model<AbnormalPlan> {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "HANDLE", type = IdType.INPUT)
private String handle;
/**
*
*/
@TableField("SITE")
private String site;
/**
*
*/
@TableField("ABNORMAL_BILL_BO")
private String abnormalBillBo;
/**
*
*/
@TableField("STATUS")
private String status;
/**
*
*/
@TableField("WORK_CENTER")
private String workCenter;
/**
*
*/
@TableField("ABNORMAL_METHOD")
private String abnormalMethod;
/**
*
*/
@TableField("SHOP_ORDER")
private String shopOrder;
/**
*
*/
@TableField("RESRCE")
private String resrce;
/**
*
*/
@TableField("ITEM_BO")
private String itemBo;
/**
*
*/
@TableField("QTY")
private Long qty;
/**
*
*/
@TableField("PROCESSOR")
private String processor;
/**
*
*/
@TableField("PROCESS_DATE_TIME")
private LocalDateTime processDateTime;
/**
*
*/
@TableField("CLOSED_USER")
private String closedUser;
/**
*
*/
@TableField("CLOSED_DATE_TIME")
private LocalDateTime closedDateTime;
/**
*
*/
@TableField("CREATED_USER")
private String createdUser;
/**
*
*/
@TableField("CREATED_DATE_TIME")
private LocalDateTime createdDateTime;
/**
*
*/
@TableField("MODIFIED_USER")
private String modifiedUser;
/**
*
*/
@TableField("MODIFIED_DATE_TIME")
private LocalDateTime modifiedDateTime;
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 getAbnormalBillBo() {
return abnormalBillBo;
}
public void setAbnormalBillBo(String abnormalBillBo) {
this.abnormalBillBo = abnormalBillBo;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getWorkCenter() {
return workCenter;
}
public void setWorkCenter(String workCenter) {
this.workCenter = workCenter;
}
public String getAbnormalMethod() {
return abnormalMethod;
}
public void setAbnormalMethod(String abnormalMethod) {
this.abnormalMethod = abnormalMethod;
}
public String getShopOrder() {
return shopOrder;
}
public void setShopOrder(String shopOrder) {
this.shopOrder = shopOrder;
}
public String getResrce() {
return resrce;
}
public void setResrce(String resrce) {
this.resrce = resrce;
}
public String getItemBo() {
return itemBo;
}
public void setItemBo(String itemBo) {
this.itemBo = itemBo;
}
public Long getQty() {
return qty;
}
public void setQty(Long qty) {
this.qty = qty;
}
public String getProcessor() {
return processor;
}
public void setProcessor(String processor) {
this.processor = processor;
}
public LocalDateTime getProcessDateTime() {
return processDateTime;
}
public void setProcessDateTime(LocalDateTime processDateTime) {
this.processDateTime = processDateTime;
}
public String getClosedUser() {
return closedUser;
}
public void setClosedUser(String closedUser) {
this.closedUser = closedUser;
}
public LocalDateTime getClosedDateTime() {
return closedDateTime;
}
public void setClosedDateTime(LocalDateTime closedDateTime) {
this.closedDateTime = closedDateTime;
}
public String getCreatedUser() {
return createdUser;
}
public void setCreatedUser(String createdUser) {
this.createdUser = createdUser;
}
public LocalDateTime getCreatedDateTime() {
return createdDateTime;
}
public void setCreatedDateTime(LocalDateTime createdDateTime) {
this.createdDateTime = createdDateTime;
}
public String getModifiedUser() {
return modifiedUser;
}
public void setModifiedUser(String modifiedUser) {
this.modifiedUser = modifiedUser;
}
public LocalDateTime getModifiedDateTime() {
return modifiedDateTime;
}
public void setModifiedDateTime(LocalDateTime modifiedDateTime) {
this.modifiedDateTime = modifiedDateTime;
}
public static final String HANDLE = "HANDLE";
public static final String SITE = "SITE";
public static final String ABNORMAL_BILL_BO = "ABNORMAL_BILL_BO";
public static final String STATUS = "STATUS";
public static final String WORK_CENTER = "WORK_CENTER";
public static final String ABNORMAL_METHOD = "ABNORMAL_METHOD";
public static final String SHOP_ORDER = "SHOP_ORDER";
public static final String RESRCE = "RESRCE";
public static final String ITEM_BO = "ITEM_BO";
public static final String QTY = "QTY";
public static final String PROCESSOR = "PROCESSOR";
public static final String PROCESS_DATE_TIME = "PROCESS_DATE_TIME";
public static final String CLOSED_USER = "CLOSED_USER";
public static final String CLOSED_DATE_TIME = "CLOSED_DATE_TIME";
public static final String CREATED_USER = "CREATED_USER";
public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME";
public static final String MODIFIED_USER = "MODIFIED_USER";
public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
@Override
protected Serializable pkVal() {
return this.handle;
}
@Override
public String toString() {
return "AbnormalPlan{" +
"handle = " + handle +
", site = " + site +
", abnormalBillBo = " + abnormalBillBo +
", status = " + status +
", workCenter = " + workCenter +
", abnormalMethod = " + abnormalMethod +
", shopOrder = " + shopOrder +
", resrce = " + resrce +
", itemBo = " + itemBo +
", qty = " + qty +
", processor = " + processor +
", processDateTime = " + processDateTime +
", closedUser = " + closedUser +
", closedDateTime = " + closedDateTime +
", createdUser = " + createdUser +
", createdDateTime = " + createdDateTime +
", modifiedUser = " + modifiedUser +
", modifiedDateTime = " + modifiedDateTime +
"}";
}
}

@ -0,0 +1,32 @@
package com.foreverwin.mesnac.anomaly.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDisposeDto;
import com.foreverwin.mesnac.anomaly.model.AbnormalPlan;
import com.foreverwin.modular.core.util.FrontPage;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author zjw
* @since 2021-08-07
*/
public interface AbnormalPlanService extends IService<AbnormalPlan> {
/**
*
* @param frontPage
* @return
*/
IPage<AbnormalPlan> selectPage(FrontPage<AbnormalPlan> frontPage, AbnormalPlan abnormalPlan);
List<AbnormalPlan> selectList(AbnormalPlan abnormalPlan);
void saveAbnormalPlan(AbnormalBillDisposeDto abnormalBillDisposeDto, LocalDateTime now);
}

@ -142,6 +142,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Autowired
private SfcScrapMapper sfcScrapMapper;
@Autowired
private AbnormalPlanService abnormalPlanService;
@Override
public IPage<AbnormalBill> selectPage(FrontPage<AbnormalBill> frontPage, AbnormalBill abnormalBill) {
@ -359,7 +362,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
LocalDateTime now = LocalDateTime.now();
abnormalBillDispose.setHandle(HandleEnum.Z_ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
if(!StringUtil.isBlank(abnormalBillDispose.getRouterBo())){
//分割该工艺路线
@ -408,7 +411,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
LocalDateTime now = LocalDateTime.now();
abnormalBillDispose.setHandle(HandleEnum.Z_ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
//判断判责提交是否已经填写
//AbnormalBillDispose abnormalBillDispose1 = abnormalBillDisposeMapper.selectById(abnormalBillDispose.getHandle());
@ -432,7 +435,8 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
LocalDateTime now = LocalDateTime.now();
abnormalBillDispose.setHandle(HandleEnum.Z_ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
String local = LocaleContextHolder.getLocale().getLanguage();
abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
//判断判责提交是否还没有进行填写
AbnormalBillDispose abnormalBillDispose1 = abnormalBillDisposeMapper.selectById(abnormalBillDispose.getHandle());
@ -441,14 +445,19 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
throw BusinessException.build("该异常单还没有进行判责提交");
}
}
abnormalBill.setStatus(Constants.SHUT_DOWN);
abnormalBillDispose.setClosedUser(user);
abnormalBillDispose.setClosedDateTime(now);
// this.anomalyCreatedAndSendMessage(abnormalBill,abnormalBillDispose);
//保存到异常计划表
AbnormalBillDisposeDto abnormalBillDisposeDto = abnormalBillDisposeMapper.findAllByAbnormalNo(abnormalBill, local);
abnormalPlanService.saveAbnormalPlan(abnormalBillDisposeDto,now);
this.saveOrUpdate(abnormalBill);
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
}
@ -464,7 +473,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
throw BusinessException.build("异常单号不存在");
}
//设置异常单的handle
abnormalBill.setHandle(HandleEnum.Z_ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo()));
abnormalBill.setHandle(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo()));
if(abnormalBillMapper.selectById(abnormalBill.getHandle()) != null &&
!Constants.SHUT_DOWN.equals(abnormalBill.getStatus())){
throw BusinessException.build("该异常单已经提交,请清空后提交");
@ -486,7 +495,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
// abnormalBillDispose.setClosedUser(null);
//设置异常单详细表的handle和abnormalBillBo
abnormalBillDispose.setAbnormalBillBo(abnormalBill.getHandle());
abnormalBillDispose.setHandle(HandleEnum.Z_ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
//设置责任划分填报人和填报时间
abnormalBillDispose.setDutyUser(user);
@ -741,11 +750,11 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
throw BusinessException.build("转维修时方案分类必须填写");
}
abnormalBill.setHandle(HandleEnum.Z_ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo()));
abnormalBill.setHandle(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo()));
abnormalBill.setStatus(Constants.SHUT_DOWN);
abnormalBillDispose.setResolveUser(user);
abnormalBillDispose.setResolveDateTime(now);
abnormalBillDispose.setHandle(HandleEnum.Z_ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
this.saveOrUpdate(abnormalBill);
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
HashMap<String, Object> hashMap = new HashMap<>();
@ -776,7 +785,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalBill.setSite(site);
abnormalBill.setAbnormalNo(abnormalNo);
abnormalBill.setHandle(HandleEnum.Z_ABNORMAL_BILL.getHandle(site,abnormalNo));
abnormalBill.setHandle(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalNo));
abnormalBill.setStatus(Constants.NEW);
abnormalBill.setSfc(sfc);
abnormalBill.setShopOrder(shopOrder);

@ -0,0 +1,77 @@
package com.foreverwin.mesnac.anomaly.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.foreverwin.mesnac.anomaly.dto.AbnormalBillDisposeDto;
import com.foreverwin.mesnac.anomaly.mapper.AbnormalPlanMapper;
import com.foreverwin.mesnac.anomaly.model.AbnormalPlan;
import com.foreverwin.mesnac.anomaly.service.AbnormalPlanService;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author zjw
* @since 2021-08-07
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class AbnormalPlanServiceImpl extends ServiceImpl<AbnormalPlanMapper, AbnormalPlan> implements AbnormalPlanService {
@Autowired
private AbnormalPlanMapper abnormalPlanMapper;
@Override
public IPage<AbnormalPlan> selectPage(FrontPage<AbnormalPlan> frontPage, AbnormalPlan abnormalPlan) {
QueryWrapper<AbnormalPlan> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(abnormalPlan);
return super.page(frontPage.getPagePlus(), queryWrapper);
}
@Override
public List<AbnormalPlan> selectList(AbnormalPlan abnormalPlan) {
QueryWrapper<AbnormalPlan> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(abnormalPlan);
return super.list(queryWrapper);
}
@Override
public void saveAbnormalPlan(AbnormalBillDisposeDto abnormalBillDisposeDto,LocalDateTime now) {
String site = CommonMethods.getSite();
AbnormalPlan abnormalPlan = new AbnormalPlan();
String user = CommonMethods.getUser();
//设置主键
abnormalPlan.setHandle(HandleEnum.ABNORMAL_PLAN.getHandle(site,abnormalBillDisposeDto.getAbnormalNo()));
abnormalPlan.setSite(site);
abnormalPlan.setAbnormalBillBo(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalBillDisposeDto.getAbnormalNo()));
abnormalPlan.setStatus(Constants.UNTREATED);//未处理
abnormalPlan.setWorkCenter(abnormalBillDisposeDto.getWorkCenter());
abnormalPlan.setAbnormalMethod(abnormalBillDisposeDto.getAbnormalMethod());
abnormalPlan.setShopOrder(abnormalBillDisposeDto.getShopOrder());
abnormalPlan.setResrce(abnormalBillDisposeDto.getResrce());
abnormalPlan.setItemBo(abnormalBillDisposeDto.getItemBo());
abnormalPlan.setQty(Long.parseLong(abnormalBillDisposeDto.getNcQty()));
//没有处理人和处理时间
// abnormalPlan.setProcessor();
abnormalPlan.setClosedUser(user);
abnormalPlan.setClosedDateTime(now);
abnormalPlan.setCreatedUser(user);
abnormalPlan.setCreatedDateTime(now);
abnormalPlan.setModifiedUser(user);
abnormalPlan.setModifiedDateTime(now);
this.saveOrUpdate(abnormalPlan);
}
}

@ -129,7 +129,7 @@ public class AnomalyJobServiceImpl implements AnomalyJobService {
activeMQUtil.wechatSendMessage(sendUsers.toString(),abnormalMessage.getContent());
// }
messageService.saveOrUpdate(abnormalMessage);
messageService.saveOrUpdate(_abnormalMessage);
// messageService.saveOrUpdate(_abnormalMessage);
}
}
}

@ -0,0 +1,530 @@
<?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.mesnac.anomaly.mapper.AbnormalPlanMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.anomaly.model.AbnormalPlan">
<id column="HANDLE" property="handle" />
<result column="SITE" property="site" />
<result column="ABNORMAL_BILL_BO" property="abnormalBillBo" />
<result column="STATUS" property="status" />
<result column="WORK_CENTER" property="workCenter" />
<result column="ABNORMAL_METHOD" property="abnormalMethod" />
<result column="SHOP_ORDER" property="shopOrder" />
<result column="RESRCE" property="resrce" />
<result column="ITEM_BO" property="itemBo" />
<result column="QTY" property="qty" />
<result column="PROCESSOR" property="processor" />
<result column="PROCESS_DATE_TIME" property="processDateTime" />
<result column="CLOSED_USER" property="closedUser" />
<result column="CLOSED_DATE_TIME" property="closedDateTime" />
<result column="CREATED_USER" property="createdUser" />
<result column="CREATED_DATE_TIME" property="createdDateTime" />
<result column="MODIFIED_USER" property="modifiedUser" />
<result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, ABNORMAL_BILL_BO, STATUS, WORK_CENTER, ABNORMAL_METHOD, SHOP_ORDER, RESRCE, ITEM_BO, QTY, PROCESSOR, PROCESS_DATE_TIME, CLOSED_USER, CLOSED_DATE_TIME, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_ABNORMAL_PLAN WHERE HANDLE=#{handle}
</select>
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_ABNORMAL_PLAN
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</select>
<select id="selectBatchIds" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_ABNORMAL_PLAN WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</select>
<select id="selectOne" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_ABNORMAL_PLAN
<where>
<if test="ew.entity.handle!=null">
HANDLE=#{ew.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</where>
</select>
<select id="selectCount" resultType="Integer">
SELECT COUNT(1) FROM Z_ABNORMAL_PLAN
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<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 Z_ABNORMAL_PLAN
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<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 Z_ABNORMAL_PLAN
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<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 Z_ABNORMAL_PLAN
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<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 Z_ABNORMAL_PLAN
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<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 Z_ABNORMAL_PLAN
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<insert id="insert" parameterType="com.foreverwin.mesnac.anomaly.model.AbnormalPlan">
INSERT INTO Z_ABNORMAL_PLAN
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="site!=null">SITE,</if>
<if test="abnormalBillBo!=null">ABNORMAL_BILL_BO,</if>
<if test="status!=null">STATUS,</if>
<if test="workCenter!=null">WORK_CENTER,</if>
<if test="abnormalMethod!=null">ABNORMAL_METHOD,</if>
<if test="shopOrder!=null">SHOP_ORDER,</if>
<if test="resrce!=null">RESRCE,</if>
<if test="itemBo!=null">ITEM_BO,</if>
<if test="qty!=null">QTY,</if>
<if test="processor!=null">PROCESSOR,</if>
<if test="processDateTime!=null">PROCESS_DATE_TIME,</if>
<if test="closedUser!=null">CLOSED_USER,</if>
<if test="closedDateTime!=null">CLOSED_DATE_TIME,</if>
<if test="createdUser!=null">CREATED_USER,</if>
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
<if test="modifiedUser!=null">MODIFIED_USER,</if>
<if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="site!=null">#{site},</if>
<if test="abnormalBillBo!=null">#{abnormalBillBo},</if>
<if test="status!=null">#{status},</if>
<if test="workCenter!=null">#{workCenter},</if>
<if test="abnormalMethod!=null">#{abnormalMethod},</if>
<if test="shopOrder!=null">#{shopOrder},</if>
<if test="resrce!=null">#{resrce},</if>
<if test="itemBo!=null">#{itemBo},</if>
<if test="qty!=null">#{qty},</if>
<if test="processor!=null">#{processor},</if>
<if test="processDateTime!=null">#{processDateTime},</if>
<if test="closedUser!=null">#{closedUser},</if>
<if test="closedDateTime!=null">#{closedDateTime},</if>
<if test="createdUser!=null">#{createdUser},</if>
<if test="createdDateTime!=null">#{createdDateTime},</if>
<if test="modifiedUser!=null">#{modifiedUser},</if>
<if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.anomaly.model.AbnormalPlan">
INSERT INTO Z_ABNORMAL_PLAN
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{site},
#{abnormalBillBo},
#{status},
#{workCenter},
#{abnormalMethod},
#{shopOrder},
#{resrce},
#{itemBo},
#{qty},
#{processor},
#{processDateTime},
#{closedUser},
#{closedDateTime},
#{createdUser},
#{createdDateTime},
#{modifiedUser},
#{modifiedDateTime},
</trim>
</insert>
<update id="updateById">
UPDATE Z_ABNORMAL_PLAN <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.abnormalBillBo!=null">ABNORMAL_BILL_BO=#{et.abnormalBillBo},</if>
<if test="et.status!=null">STATUS=#{et.status},</if>
<if test="et.workCenter!=null">WORK_CENTER=#{et.workCenter},</if>
<if test="et.abnormalMethod!=null">ABNORMAL_METHOD=#{et.abnormalMethod},</if>
<if test="et.shopOrder!=null">SHOP_ORDER=#{et.shopOrder},</if>
<if test="et.resrce!=null">RESRCE=#{et.resrce},</if>
<if test="et.itemBo!=null">ITEM_BO=#{et.itemBo},</if>
<if test="et.qty!=null">QTY=#{et.qty},</if>
<if test="et.processor!=null">PROCESSOR=#{et.processor},</if>
<if test="et.processDateTime!=null">PROCESS_DATE_TIME=#{et.processDateTime},</if>
<if test="et.closedUser!=null">CLOSED_USER=#{et.closedUser},</if>
<if test="et.closedDateTime!=null">CLOSED_DATE_TIME=#{et.closedDateTime},</if>
<if test="et.createdUser!=null">CREATED_USER=#{et.createdUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.modifiedUser!=null">MODIFIED_USER=#{et.modifiedUser},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update>
<update id="updateAllColumnById">
UPDATE Z_ABNORMAL_PLAN <trim prefix="SET" suffixOverrides=",">
SITE=#{et.site},
ABNORMAL_BILL_BO=#{et.abnormalBillBo},
STATUS=#{et.status},
WORK_CENTER=#{et.workCenter},
ABNORMAL_METHOD=#{et.abnormalMethod},
SHOP_ORDER=#{et.shopOrder},
RESRCE=#{et.resrce},
ITEM_BO=#{et.itemBo},
QTY=#{et.qty},
PROCESSOR=#{et.processor},
PROCESS_DATE_TIME=#{et.processDateTime},
CLOSED_USER=#{et.closedUser},
CLOSED_DATE_TIME=#{et.closedDateTime},
CREATED_USER=#{et.createdUser},
CREATED_DATE_TIME=#{et.createdDateTime},
MODIFIED_USER=#{et.modifiedUser},
MODIFIED_DATE_TIME=#{et.modifiedDateTime},
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update>
<update id="update">
UPDATE Z_ABNORMAL_PLAN <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.abnormalBillBo!=null">ABNORMAL_BILL_BO=#{et.abnormalBillBo},</if>
<if test="et.status!=null">STATUS=#{et.status},</if>
<if test="et.workCenter!=null">WORK_CENTER=#{et.workCenter},</if>
<if test="et.abnormalMethod!=null">ABNORMAL_METHOD=#{et.abnormalMethod},</if>
<if test="et.shopOrder!=null">SHOP_ORDER=#{et.shopOrder},</if>
<if test="et.resrce!=null">RESRCE=#{et.resrce},</if>
<if test="et.itemBo!=null">ITEM_BO=#{et.itemBo},</if>
<if test="et.qty!=null">QTY=#{et.qty},</if>
<if test="et.processor!=null">PROCESSOR=#{et.processor},</if>
<if test="et.processDateTime!=null">PROCESS_DATE_TIME=#{et.processDateTime},</if>
<if test="et.closedUser!=null">CLOSED_USER=#{et.closedUser},</if>
<if test="et.closedDateTime!=null">CLOSED_DATE_TIME=#{et.closedDateTime},</if>
<if test="et.createdUser!=null">CREATED_USER=#{et.createdUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.modifiedUser!=null">MODIFIED_USER=#{et.modifiedUser},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
</trim>
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
HANDLE=#{ew.entity.handle}
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</update>
<delete id="deleteById">
DELETE FROM Z_ABNORMAL_PLAN WHERE HANDLE=#{handle}
</delete>
<delete id="deleteByMap">
DELETE FROM Z_ABNORMAL_PLAN
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</delete>
<delete id="delete">
DELETE FROM Z_ABNORMAL_PLAN
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</delete>
<delete id="deleteBatchIds">
DELETE FROM Z_ABNORMAL_PLAN WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
</mapper>

@ -169,5 +169,11 @@ public interface Constants {
String TOOL_STATUS_Y = "Y";
String TOOL_STATUS_N = "N";
/**
*
*/
String UNTREATED = "UNTREATED"; //未处理
String PROCESSED = "PROCESSED"; //已处理
}

@ -131,7 +131,7 @@ public class SfcDispatchDto implements Serializable{
/**
*
*/
@ExcelColumn("备注")
@ExcelColumn("备注信息")
private String remark;
/**
*
@ -174,7 +174,6 @@ public class SfcDispatchDto implements Serializable{
private String componentDescription;
private String isCompleted;
private BigDecimal completedQty;
private String userName;
private String resourceWorkCenter;
private String status;
@ -578,14 +577,6 @@ public class SfcDispatchDto implements Serializable{
this.completedQty = completedQty;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getResourceWorkCenter() {
return resourceWorkCenter;
}

@ -106,10 +106,10 @@ public enum HandleEnum {
RESOURCE_INSPECT_TASK_PARAM("ResourceInspectTaskParamBo","ResourceInspectTaskParamBo:{0},{1}"),
/**异常单**/
Z_ABNORMAL_BILL("AbnormalBillBo","AbnormalBillBo:{0},{1}"),
ABNORMAL_BILL("AbnormalBillBo","AbnormalBillBo:{0},{1}"),
/**异常单详细表**/
Z_ABNORMAL_BILL_DISPOSE("AbnormalBillDisposeBo","AbnormalBillDisposeBo:{0},{1}"),
ABNORMAL_BILL_DISPOSE("AbnormalBillDisposeBo","AbnormalBillDisposeBo:{0},{1}"),
/**不良代码**/
NC_CODE("NCCodeBO","NCCodeBO:{0},{1}"),
@ -140,7 +140,9 @@ public enum HandleEnum {
USER_RESOURCE("UserResourceBo","UserResourceBo:{0},{1},{2}"),
SFC_SCRAP("SfcScrapBo","SfcScrapBo:{0},{1}");
SFC_SCRAP("SfcScrapBo","SfcScrapBo:{0},{1}"),
ABNORMAL_PLAN("AbnormalPlanBo","AbnormalPlanBo:{0},{1}");
private String prefix;
private String pattern;

@ -5,6 +5,7 @@ import com.foreverwin.mesnac.common.model.ProdReadyTask;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@ -26,4 +27,6 @@ public interface ProdReadyTaskMapper extends BaseMapper<ProdReadyTask> {
List<Map<String, Object>> getItemDetail(@Param("site")String site, @Param("locale")String locale, @Param("dispatchNo")String dispatchNo);
List<Map<String, Object>> getToolDetail(@Param("site")String site, @Param("locale")String locale, @Param("dispatchNo")String dispatchNo);
List<ProdReadyTask> getUnreadyTasks(@Param("site")String site, @Param("startTime")LocalDateTime now, @Param("endTime")LocalDateTime endTime);
}

@ -34,4 +34,6 @@ public interface InspectionTaskService extends IService<InspectionTask> {
Map<String, Object> createTask(Map<String, Object> paramMap);
InspectionTask isCreateTask(String site, String category, String sfc, String operation, String stepId);
void createCompleteTask(Map<String, Object> paramMap);
}

@ -39,4 +39,6 @@ public interface ProdReadyTaskService extends IService<ProdReadyTask> {
boolean saveResult(ProdReadyTask prodReadyTask);
void doPrint(ProdReadyTask prodReadyTask);
void sendMsgJob(String site);
}

@ -102,10 +102,10 @@ public class InspectionItemServiceImpl extends ServiceImpl<InspectionItemMapper,
public InspectionItem saveAll(InspectionItem inspectionItem) {
String site = CommonMethods.getSite();
boolean b = false;
if(StringUtil.isEmpty(inspectionItem.getInspectionItemNo())&&inspectionItem.getInspectionItemAdditionList()==null){
if(StringUtil.isEmpty(inspectionItem.getInspectionItemNo())&&inspectionItem.getInspectionItemAdditionList().isEmpty()){
throw new BaseException("检验项目编号不能为空");
}
if (StringUtil.isEmpty(inspectionItem.getInspectionItemNo())) {
if (StringUtil.isBlank(inspectionItem.getInspectionItemNo())) {
b = true;
inspectionItem.setInspectionItemNo(inspectItemNoGenerationRules(inspectionItem));
}
@ -261,9 +261,6 @@ public class InspectionItemServiceImpl extends ServiceImpl<InspectionItemMapper,
}
String item = jsonObject.getString("item");
String operation = jsonObject.getString("operation");
if (StringUtil.isBlank(operation)){
throw new BaseException("工序不能为空");
}
String resrceType = jsonObject.getString("resrceType");
String paramNo = jsonObject.getString("paramNo");
if (StringUtil.isBlank(paramNo)){

@ -260,5 +260,48 @@ public class InspectionTaskServiceImpl extends ServiceImpl<InspectionTaskMapper,
return null;
}
@Override
public void createCompleteTask(Map<String, Object> paramMap) {
String site = CommonMethods.getSite();
String category = (String) paramMap.get("CATEGORY");
String sfc = (String) paramMap.get("SFC");
String shopOrder = (String) paramMap.get("SHOP_ORDER");
String operation = (String) paramMap.get("OPERATION");
String stepId = (String) paramMap.get("STEP_ID");
String itemNumber = (String) paramMap.get("ITEM_NUMBER");
String handle = "InspectionTaskBO:" + site + "," + UUID.randomUUID().toString();
Date date = new Date(System.currentTimeMillis());
SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyyMMddHHmmss");
String taskNo = "";
if (StringUtil.isBlank(itemNumber)) {
taskNo = "P_" + dateFormat1.format(date);
} else {
taskNo = "P_" + itemNumber + "_" + dateFormat1.format(date);
}
InspectionTask task = new InspectionTask();
task.setHandle(handle);
task.setSite(site);
task.setCategory(category);
task.setTaskNo(taskNo);
task.setStatus(Constants.INSPECTION_TASK_STATUS_COMPLETE);
task.setResrce(Constants.RSESULT_OK);
task.setDescription("专检检验任务");
task.setInspectionItemBo( null);
task.setShopOrder(shopOrder);
task.setWorkCenter((String) paramMap.get("WORK_CENTER"));
task.setSfc(sfc);
task.setOperation(operation);
task.setStepId(stepId);
task.setResrce((String) paramMap.get("RESRCE"));
task.setCreateUser(CommonMethods.getUser());
task.setCreatedDateTime(LocalDateTime.now());
task.setModifyUser(CommonMethods.getUser());
task.setModifiedDateTime(LocalDateTime.now());
task.setSfcDispatchBo((String) paramMap.get("SFC_DISPATCH_DETAIL_BO"));
task.setSfc(sfc);
save(task);
}
}

@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.common.constant.Constants;
@ -15,25 +14,25 @@ import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
import com.foreverwin.mesnac.common.enums.DispatchStatusEnum;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.mapper.ProdReadyTaskMapper;
import com.foreverwin.mesnac.common.model.Message;
import com.foreverwin.mesnac.common.model.PrintLog;
import com.foreverwin.mesnac.common.model.ProdReadyTask;
import com.foreverwin.mesnac.common.model.ProdReadyTaskDetail;
import com.foreverwin.mesnac.common.service.PrintLogService;
import com.foreverwin.mesnac.common.service.ProdReadyTaskDetailService;
import com.foreverwin.mesnac.common.service.ProdReadyTaskService;
import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
import com.foreverwin.mesnac.common.service.*;
import com.foreverwin.mesnac.common.util.ActiveMQUtil;
import com.foreverwin.mesnac.common.util.DateUtil;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.dto.BomComponentDto;
import com.foreverwin.mesnac.meapi.model.Item;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.foreverwin.mesnac.meapi.model.ShopOrder;
import com.foreverwin.mesnac.meapi.model.WorkCenter;
import com.foreverwin.mesnac.meapi.mapper.WorkCenterMapper;
import com.foreverwin.mesnac.meapi.model.*;
import com.foreverwin.mesnac.meapi.service.*;
import com.foreverwin.mesnac.meapi.util.StringUtils;
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.sap.me.messaging.MessageTypeBOHandle;
import com.sap.me.user.UserGroupBOHandle;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -68,27 +67,44 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
public static final String STATUS_DOING = "DOING";
public static final String STATUS_FINISH = "FINISH";
public static final String STATUS_CANCEL = "CANCEL";
public static final String MESSAGE_TYPE_WLZB = "WLZB";
@Value("${spring.activemq.brokerUrl}")
String brokerURL;
@Value("${print.server}")
private String printServer;
@Autowired
private MessageTypeUserGroupService messageTypeUserGroupService;
@Autowired
private ProdReadyTaskMapper prodReadyTaskMapper;
@Autowired
private ResrceService resrceService;
@Autowired
private ProdReadyTaskDetailService prodReadyTaskDetailService;
@Autowired
private SfcDispatchCommonService sfcDispatchCommonService;
@Autowired
private BomComponentService bomComponentService;
@Autowired
private WorkCenterMapper workCenterMapper;
@Autowired
private CustomFieldsService customFieldsService;
@Autowired
private MessageTypeService messageTypeService;
@Autowired
private ShopOrderService shopOrderService;
@Autowired
private WorkCenterService workCenterService;
@Autowired
private PrintLogService printLogService;
@Autowired
private ActiveMQUtil activeMQUtil;
@Autowired
private MessageService messageService;
@Autowired
private NwaUserService nwaUserService;
@Autowired
private ItemService itemService;
@Autowired
private SfcService sfcService;
@ -223,18 +239,19 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
lambdaQueryWrapper.eq(ProdReadyTask::getSfcDispatchBo, sfcDispatchBO);
lambdaQueryWrapper.orderByDesc(ProdReadyTask::getCreatedDateTime);
List<ProdReadyTask> list = list(lambdaQueryWrapper);
if (list.size() < 1) {
throw new BaseException("根据派工主键未找到产前准备任务");
}
if (list.get(0).getStatus().equals(STATUS_CANCEL)) {
throw new BaseException("产前准备任务任务已取消");
if (list.size() > 0) {
ProdReadyTask prodReadyTask = list.get(0);
if (prodReadyTask.getStatus().equals(STATUS_CANCEL)) {
throw new BaseException("产前准备任务任务已取消");
}
prodReadyTask.setStatus(STATUS_CANCEL);
LocalDateTime now = LocalDateTime.now();
prodReadyTask.setCancelDateTime(now);
prodReadyTask.setModifiedDateTime(now);
prodReadyTask.setCancelUser(user);
prodReadyTask.setModifyUser(user);
updateById(prodReadyTask);
}
LambdaUpdateWrapper<ProdReadyTask> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(ProdReadyTask::getStatus, STATUS_CANCEL);
updateWrapper.set(ProdReadyTask::getCancelUser, user);
updateWrapper.set(ProdReadyTask::getCancelDateTime, LocalDateTime.now());
updateWrapper.eq(ProdReadyTask::getSfcDispatchBo, sfcDispatchBO);
update(updateWrapper);
}
}
}
@ -282,17 +299,17 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
returnMap = prodReadyTaskMapper.getToolDetail(site, LocaleContextHolder.getLocale().getLanguage(), dispatchNo);
} else {
//通过加工的零件号、设备类型、设备获取发布状态的工控程序
SfcDispatchDto sfcdispatch=new SfcDispatchDto();
sfcdispatch.setHandle(HandleEnum.SFC_DISPATCH.getHandle(site,dispatchNo));
SfcDispatchDto sfcdispatch = new SfcDispatchDto();
sfcdispatch.setHandle(HandleEnum.SFC_DISPATCH.getHandle(site, dispatchNo));
sfcdispatch = sfcDispatchCommonService.findSfcDispatchBySfc(sfcdispatch);
Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(site, sfcdispatch.getSfc()));
String itemBo = sfcServiceById.getItemBo();
JSONObject jsonObject = sendToDnc(StringUtil.trimHandle(itemBo), sfcdispatch.getResrce(), sfcdispatch.getResourceType());
Map<String, Object> map=new HashMap<>();
map.put("RESOURCE",sfcdispatch.getResrce());
map.put("RESOURCE_TYPE",sfcdispatch.getResourceType());
map.put("RESULT",jsonObject.get("RESULT"));
map.put("MESSAGE",jsonObject.get("MESSAGE"));
Map<String, Object> map = new HashMap<>();
map.put("RESOURCE", sfcdispatch.getResrce());
map.put("RESOURCE_TYPE", sfcdispatch.getResourceType());
map.put("RESULT", jsonObject.get("RESULT"));
map.put("MESSAGE", jsonObject.get("MESSAGE"));
returnMap.add(map);
}
return returnMap;
@ -422,10 +439,112 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
}
@Override
public void sendMsgJob(String site) {
LocalDateTime now = LocalDateTime.now();
LocalDateTime endTime = now.plusMinutes(30);
//查找当前派工单的计划开始时间30分钟内的未准备完成的任务
List<ProdReadyTask> prodReadyTasks = prodReadyTaskMapper.getUnreadyTasks(site, now, endTime);
for (ProdReadyTask prodReadyTask : prodReadyTasks) {
QueryWrapper<Message> messageQueryWrapper = new QueryWrapper<>();
messageQueryWrapper.eq(Message.OBJECT_BO, prodReadyTask.getHandle());
List<Message> list = messageService.list(messageQueryWrapper);
if (!list.isEmpty()) {
continue;
}
LambdaQueryWrapper<ProdReadyTaskDetail> lambdaQuery = new LambdaQueryWrapper<>();
lambdaQuery.eq(ProdReadyTaskDetail::getProdReadyTaskBo, prodReadyTask.getHandle());
List<ProdReadyTaskDetail> readyTaskDetails = prodReadyTaskDetailService.list(lambdaQuery);
for (ProdReadyTaskDetail prodReadyTaskDetail : readyTaskDetails) {
if (prodReadyTaskDetail.getInspectionItem().equals(P01)) {
Message message = new Message();
String uuid = UUID.randomUUID().toString();
message.setHandle(uuid);
message.setSite(site);
message.setObjectBo(prodReadyTask.getHandle());
message.setType("C");
message.setMessageType(MESSAGE_TYPE_WLZB);
//查询消息类型关联的用户组
String workCenter = prodReadyTask.getWorkCenter();
String userGroup = workCenter + "-" + MESSAGE_TYPE_WLZB;
QueryWrapper<MessageTypeUserGroup> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(MessageTypeUserGroup.MESSAGE_TYPE_BO, new MessageTypeBOHandle(site, MESSAGE_TYPE_WLZB).getValue());
queryWrapper.eq(MessageTypeUserGroup.USER_GROUP_BO, new UserGroupBOHandle(site, userGroup).getValue());
List<MessageTypeUserGroup> messageTypeUserGroupList = messageTypeUserGroupService.list(queryWrapper);
if (messageTypeUserGroupList.isEmpty()) {
continue;
}
message.setSendUserGroup(userGroup);
message.setSendUser("JOB");
String sendMessage = this.formatMessage(prodReadyTask, MESSAGE_TYPE_WLZB, site);
message.setContent(sendMessage);
message.setUpUserGroup(null);
message.setUpUser(null);
message.setUpMessageType(null);
message.setUpDateTime(null);
message.setGrade(null);
message.setResponseDateTime(null);
message.setNode(null);
message.setStatus(Constants.STATUS_Y);
message.setCreatedUser("JOB");
message.setCreatedDateTime(LocalDateTime.now());
message.setModifiedUser("JOB");
message.setModifiedDateTime(LocalDateTime.now());
List<NwaUser> nwaUsers = nwaUserService.checkUserGroup(site, userGroup);
StringBuilder sendUsers = new StringBuilder();
for (int i = 0; i < nwaUsers.size(); i++) {
if (i == (nwaUsers.size() - 1)) {
sendUsers.append(nwaUsers.get(i));
} else {
sendUsers.append(nwaUsers.get(i)).append("|");
}
}
messageService.save(message);
activeMQUtil.wechatSendMessage(sendUsers.toString(),sendMessage);
}
}
}
}
public String formatMessage(ProdReadyTask prodReadyTask, String messageType, String site) {
//找到消息内容
String locale = LocaleContextHolder.getLocale().getLanguage();
MessageType messageTypeEntity = new MessageType();
messageTypeEntity.setSite(site);
messageTypeEntity.setMessageType(messageType);
QueryWrapper<MessageType> messageTypeQueryWrapper = new QueryWrapper<MessageType>();
messageTypeQueryWrapper.setEntity(messageTypeEntity);
MessageType sendMessageType = messageTypeService.getOne(messageTypeQueryWrapper);
if (sendMessageType == null) {
throw new BaseException("异常提报时找不到要发送的消息类型");
}
//格式化消息
String body = sendMessageType.getBody();
//替换消息类型中的参数
Map<String, String> messageMap = new HashMap<>();
//根据车间找到对应车间的描述
WorkCenter workCenter = workCenterMapper.findWorkCenterDescriptionByWorkCenter(site, prodReadyTask.getWorkCenter(), locale);
//根据资源找到对应的产线的描述
Resrce byResrce = resrceService.findByResrce(prodReadyTask.getResrce());
Item selectCurrent = itemService.selectCurrent(site, prodReadyTask.getItem());
//项目号
String item = selectCurrent.getItem() + "/" + selectCurrent.getDescription();
messageMap.put("WORKCENTER", workCenter.getDescription());
messageMap.put("RESOURCE", byResrce + "/" + byResrce.getDescription());
messageMap.put("ITEM", item);
messageMap.put("SHOPORDER", prodReadyTask.getShopOrder());
messageMap.put("SFC", prodReadyTask.getSfc());
//格式化之后的消息
return StringUtils.format(body, messageMap);
}
public JSONObject sendToDnc(String item, String resource, String resourceType) {
String site = CommonMethods.getSite();
String queue="resource.check.process";
JSONObject messageObject=new JSONObject();
String queue = "resource.check.process";
JSONObject messageObject = new JSONObject();
String tranid = UUID.randomUUID().toString();
messageObject.put("TRANID", tranid);
String dateTime = DateUtil.formatDate(new Date());

@ -700,4 +700,11 @@
AND BO.OPERATION_BO = 'OperationBO:'||S.SITE||','||zsd.OPERATION||',#'
WHERE ZSD.SITE=#{site} AND ZSD.DISPATCH_NO=#{dispatchNo}
</select>
<select id="getUnreadyTasks" resultMap="BaseResultMap">
SELECT * FROM Z_PROD_READY_TASK zprt
JOIN Z_SFC_DISPATCH ZSD ON zsd.HANDLE=ZPRT.SFC_DISPATCH_BO
WHERE (zprt."RESULT" IS NULL OR zprt."RESULT" !='OK') AND ZPRT.SITE=#{site} AND zsd.DISPATCH_STATUS='RELEASE'
AND ZSD.PLANNED_START_DATE>#{startTime} AND ZSD.PLANNED_START_DATE &lt;= #{endTime}
</select>
</mapper>

@ -1,6 +1,7 @@
#Spring
spring:
datasource:
hikari:
dynamic:
primary: wip #设置默认的数据源或者数据源组,默认值即为master
datasource:
@ -9,8 +10,35 @@ spring:
username: wip
password: wip
driver-class-name: oracle.jdbc.OracleDriver
druid:
filters: stat,wall,log4j2
initial-size: 5
max-active: 50
min-idle: 5
max-wait: 60000
validation-query: SELECT 'x' FROM DUAL
test-on-borrow: true
test-on-return: true
test-while-idle: true
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
remove-abandoned: true
remove-abandoned-timeout: 1800
log-abandoned: true
web-stat-filter:
enabled: true
url-pattern: /*
exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
stat-view-servlet:
enabled: true
url-pattern: /druid/*
reset-enable: false
stat:
log-slow-sql: true
merge-sql: true
slow-sql-millis: 100
activemq:
enabled: true
enabled: false
brokerUrl: tcp://121.36.58.109:61616?wireFormat.maxInactivityDuration=0
password: admin
user: admin

@ -15,7 +15,6 @@ import com.foreverwin.mesnac.meapi.mapper.NwaUserMapper;
import com.foreverwin.mesnac.meapi.mapper.ResrceMapper;
import com.foreverwin.mesnac.meapi.model.NwaUser;
import com.foreverwin.mesnac.meapi.model.Resrce;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.I18nUtil;
import org.springframework.beans.factory.annotation.Autowired;
@ -58,10 +57,10 @@ public class UserResourceHandler extends BaseHandler {
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());
}
// 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();
@ -126,15 +125,13 @@ public class UserResourceHandler extends BaseHandler {
//站点
jsonObject.put("site", site);
//不管用户选啥模式,都是更新和插入
resultMessage = this.updateAndInsert(userResource,index);
resultMessage = updateAndInsert(userResource,index);
if (resultMessage != null) {
params[2] = resultMessage;
failedNumber[0]++;
buffer.append("第" + index + "行:" + I18nUtil.getI18nText("MaterData.import.update.fail", params) + "\n");
return 0;
}
userResourceService.saveOrUpdate(userResource);
return 1;
}
return 0;
@ -144,30 +141,29 @@ public class UserResourceHandler extends BaseHandler {
public String[] getHeader() {
return null;
}
String updateAndInsert(UserResource userResource,Long index){
//判断资源是否存在
Resrce resrce = resrceMapper.selectById(userResource.getResourceBo());
if(resrce == null){
return "第"+index+"行的资源不存在";
}
//设置资源描述
userResource.setResrceDescription(resrce.getDescription());
//设置员工描述
NwaUser nwaUser = nwaUserMapper.selectById(HandleEnum.USER.getHandle(userResource.getSite(), userResource.getUserId()));
if(nwaUser != null){
userResource.setUserDescription(nwaUser.getFullName());
}else if("true".equals(userResource.getTemporaryUser())){
//不做任何操作
}else{
return "第"+index+"行的用户不存在,必须为临时员工";
}
return null;
}
};
}
String updateAndInsert(UserResource userResource,Long index){
//判断资源是否存在
Resrce resrce = resrceMapper.selectById(userResource.getResourceBo());
if(resrce == null){
return "第"+index+"行的资源不存在";
}
//设置资源描述
userResource.setResrceDescription(resrce.getDescription());
//设置员工描述
NwaUser nwaUser = nwaUserMapper.selectById(HandleEnum.USER.getHandle(userResource.getSite(), userResource.getUserId()));
if(nwaUser != null){
userResource.setUserDescription(nwaUser.getFullName());
}else if("true".equals(userResource.getTemporaryUser())){
//不做任何操作
}else{
return "第"+index+"行的用户不存在,必须为临时员工";
}
userResourceService.saveOrUpdate(userResource);
return null;
}
}

@ -147,7 +147,7 @@ public class CallItemController {
@ResponseBody
@PostMapping("/cancelCallItem")
public R cancelCallItem(@RequestBody List<String> callItemNoList) {
public R cancelCallItem(@RequestBody List<CallItem> callItemNoList) {
try {
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
@ -162,6 +162,23 @@ public class CallItemController {
return R.ok("取消叫料成功");
}
@ResponseBody
@PostMapping("/refreshCallItem")
public R refreshCallItem(@RequestBody List<CallItem> callItemList) {
try {
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
if (callItemList == null || callItemList.size() <= 0) {
throw BusinessException.build("请至少选择一笔记录");
}
callItemService.refreshCallItem(site, user, callItemList);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok("刷新叫料明细成功");
}
@ResponseBody
@PostMapping("/refreshRequiredTime")
public R refreshRequiredTime(@RequestBody List<String> callItemNoList) {

@ -72,38 +72,38 @@ public class SfcDispatchController {
public R getSfcDispatch(String workCenter, String dispatchStatus, String item, String itemNumber, String workOrder, String shopOrder,
String resrce, String resourceType, String operation, String sfc, String component, String componentDescription, String turnOperation,
String isDispatch, String startFromDate_S, String startToDate_S, String completeFromDate_S, String completeToDate_S) {
List<ShopOrderRelease> list;
List<SfcDispatchDto> list;
try {
ShopOrderRelease shopOrderRelease = new ShopOrderRelease();
shopOrderRelease.setSite(CommonMethods.getSite());
shopOrderRelease.setWorkCenter(workCenter);
shopOrderRelease.setDispatchStatus(dispatchStatus);
shopOrderRelease.setItem(item);
shopOrderRelease.setItemNumber(itemNumber);
shopOrderRelease.setWorkOrder(workOrder);
shopOrderRelease.setShopOrder(shopOrder);
shopOrderRelease.setResrce(resrce);
shopOrderRelease.setResourceType(resourceType);
shopOrderRelease.setOperation(operation);
shopOrderRelease.setSfc(sfc);
shopOrderRelease.setComponent(component);
shopOrderRelease.setComponentDescription(componentDescription);
shopOrderRelease.setTurnOperation(turnOperation);
shopOrderRelease.setIsDispatch(isDispatch);
SfcDispatchDto sfcDispatchDto = new SfcDispatchDto();
sfcDispatchDto.setSite(CommonMethods.getSite());
sfcDispatchDto.setWorkCenter(workCenter);
sfcDispatchDto.setDispatchStatus(dispatchStatus);
sfcDispatchDto.setItem(item);
sfcDispatchDto.setItemNumber(itemNumber);
sfcDispatchDto.setWorkOrder(workOrder);
sfcDispatchDto.setShopOrder(shopOrder);
sfcDispatchDto.setResrce(resrce);
sfcDispatchDto.setResourceType(resourceType);
sfcDispatchDto.setOperation(operation);
sfcDispatchDto.setSfc(sfc);
sfcDispatchDto.setComponent(component);
sfcDispatchDto.setComponentDescription(componentDescription);
sfcDispatchDto.setTurnOperation(turnOperation);
sfcDispatchDto.setIsDispatch(isDispatch);
if (startFromDate_S != null) {
shopOrderRelease.setStartFromDate(DateUtil.parse(startFromDate_S));
sfcDispatchDto.setStartFromDate(DateUtil.parse(startFromDate_S));
}
if (startToDate_S != null) {
shopOrderRelease.setStartToDate(DateUtil.parse(startToDate_S));
sfcDispatchDto.setStartToDate(DateUtil.parse(startToDate_S));
}
if (completeFromDate_S != null) {
shopOrderRelease.setCompleteFromDate(DateUtil.parse(completeFromDate_S));
sfcDispatchDto.setCompleteFromDate(DateUtil.parse(completeFromDate_S));
}
if (completeToDate_S != null) {
shopOrderRelease.setCompleteToDate(DateUtil.parse(completeToDate_S));
sfcDispatchDto.setCompleteToDate(DateUtil.parse(completeToDate_S));
}
list = sfcDispatchService.findSfcDispatchList(shopOrderRelease);
list = sfcDispatchService.findSfcDispatchList(sfcDispatchDto);
} catch (Exception e) {
return R.failed(e.getMessage());
}
@ -114,29 +114,29 @@ public class SfcDispatchController {
/**
*
*
* @param shopOrderRelease
* @param sfcDispatchDto
* @return
*/
@ResponseBody
@PostMapping("findSfcDispatch")
public R findSfcDispatch(@RequestBody ShopOrderRelease shopOrderRelease) {
List<ShopOrderRelease> list;
public R findSfcDispatch(@RequestBody SfcDispatchDto sfcDispatchDto) {
List<SfcDispatchDto> list;
try {
shopOrderRelease.setSite(CommonMethods.getSite());
if (shopOrderRelease.getStartFromDate_S() != null) {
shopOrderRelease.setStartFromDate(DateUtil.parse(shopOrderRelease.getStartFromDate_S()));
sfcDispatchDto.setSite(CommonMethods.getSite());
if (sfcDispatchDto.getStartFromDate_S() != null) {
sfcDispatchDto.setStartFromDate(DateUtil.parse(sfcDispatchDto.getStartFromDate_S()));
}
if (shopOrderRelease.getStartToDate_S() != null) {
shopOrderRelease.setStartToDate(DateUtil.parse(shopOrderRelease.getStartToDate_S()));
if (sfcDispatchDto.getStartToDate_S() != null) {
sfcDispatchDto.setStartToDate(DateUtil.parse(sfcDispatchDto.getStartToDate_S()));
}
if (shopOrderRelease.getCompleteFromDate_S() != null) {
shopOrderRelease.setCompleteFromDate(DateUtil.parse(shopOrderRelease.getCompleteFromDate_S()));
if (sfcDispatchDto.getCompleteFromDate_S() != null) {
sfcDispatchDto.setCompleteFromDate(DateUtil.parse(sfcDispatchDto.getCompleteFromDate_S()));
}
if (shopOrderRelease.getCompleteToDate_S() != null) {
shopOrderRelease.setCompleteToDate(DateUtil.parse(shopOrderRelease.getCompleteToDate_S()));
if (sfcDispatchDto.getCompleteToDate_S() != null) {
sfcDispatchDto.setCompleteToDate(DateUtil.parse(sfcDispatchDto.getCompleteToDate_S()));
}
list = sfcDispatchService.findSfcDispatchList(shopOrderRelease);
list = sfcDispatchService.findSfcDispatchList(sfcDispatchDto);
} catch (Exception e) {
return R.failed(e.getMessage());
}
@ -330,24 +330,24 @@ public class SfcDispatchController {
@PostMapping("/gantt-list")
public R ganttList(@RequestBody ShopOrderRelease shopOrderRelease) {
public R ganttList(@RequestBody SfcDispatchDto sfcDispatchDto) {
Map<String, Object> result = new HashMap<>();
try {
String site = CommonMethods.getSite();
if (StringUtil.isBlank(shopOrderRelease.getStartFromDate_S())) {
if (StringUtil.isBlank(sfcDispatchDto.getStartFromDate_S())) {
throw BusinessException.build("派工开始时间不能为空!");
}
if (StringUtil.isBlank(shopOrderRelease.getStartToDate_S())) {
if (StringUtil.isBlank(sfcDispatchDto.getStartToDate_S())) {
throw BusinessException.build("派工开始时间不能为空!");
}
shopOrderRelease.setSite(site);
shopOrderRelease.setDispatchStatus(DispatchStatusEnum.RELEASE.getCode());
shopOrderRelease.setStartFromDate(DateUtil.parseDate(shopOrderRelease.getStartFromDate_S()));
shopOrderRelease.setStartToDate(DateUtil.parseDate(shopOrderRelease.getStartToDate_S()));
sfcDispatchDto.setSite(site);
sfcDispatchDto.setDispatchStatus(DispatchStatusEnum.RELEASE.getCode());
sfcDispatchDto.setStartFromDate(DateUtil.parseDate(sfcDispatchDto.getStartFromDate_S()));
sfcDispatchDto.setStartToDate(DateUtil.parseDate(sfcDispatchDto.getStartToDate_S()));
result = sfcDispatchService.ganttList(site, shopOrderRelease);
result = sfcDispatchService.ganttList(site, sfcDispatchDto);
} catch (Exception e) {
return R.failed(e.getMessage());
}

@ -7,6 +7,7 @@ public class IssueItemDto implements Serializable {
private String site;
private String item;
private String workOrder;
private String resource;
private String workCenter;
private String shopOrder;
@ -31,6 +32,14 @@ public class IssueItemDto implements Serializable {
this.item = item;
}
public String getWorkOrder() {
return workOrder;
}
public void setWorkOrder(String workOrder) {
this.workOrder = workOrder;
}
public String getResource() {
return resource;
}

@ -36,7 +36,7 @@ public interface CallItemMapper extends BaseMapper<CallItem> {
List<CallItem> findCallItemDetailListByDispatchBo(@Param("site") String site, @Param("list") List<String> list);
void updateCallItemStatusByDispatchBo(@Param("status") String status, @Param("user") String user, @Param("dateTime") LocalDateTime dateTime, @Param("list") List<CallItem> list);
void updateCallItemStatusByDispatchBo(@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);

@ -27,10 +27,10 @@ public interface SfcDispatchMapper extends BaseMapper<SfcDispatch> {
/**
*
*
* @param shopOrderRelease
* @param sfcDispatchDto
* @return
*/
List<ShopOrderRelease> findSfcDispatchList(ShopOrderRelease shopOrderRelease);
List<SfcDispatchDto> findSfcDispatchList(SfcDispatchDto sfcDispatchDto);
/**
*

@ -138,6 +138,8 @@ public class CallItem extends Model<CallItem> {
@TableField(exist = false)
private String item;
@TableField(exist = false)
private String itemGroup;
@TableField(exist = false)
private String component;
@TableField(exist = false)
private String itemDescription;
@ -170,6 +172,10 @@ public class CallItem extends Model<CallItem> {
@TableField(exist = false)
private String remark;
@TableField(exist = false)
private BigDecimal sizeReqQty;
@TableField(exist = false)
private BigDecimal compReqQty;
@TableField(exist = false)
private String startFromDate_S;
@TableField(exist = false)
private String startToDate_S;
@ -362,6 +368,14 @@ public class CallItem extends Model<CallItem> {
this.item = item;
}
public String getItemGroup() {
return itemGroup;
}
public void setItemGroup(String itemGroup) {
this.itemGroup = itemGroup;
}
public String getComponent() {
return component;
}
@ -490,6 +504,22 @@ public class CallItem extends Model<CallItem> {
this.remark = remark;
}
public BigDecimal getSizeReqQty() {
return sizeReqQty;
}
public void setSizeReqQty(BigDecimal sizeReqQty) {
this.sizeReqQty = sizeReqQty;
}
public BigDecimal getCompReqQty() {
return compReqQty;
}
public void setCompReqQty(BigDecimal compReqQty) {
this.compReqQty = compReqQty;
}
public String getStartFromDate_S() {
return startFromDate_S;
}

@ -61,7 +61,6 @@ public class ShopOrderRelease extends SfcDispatch {
private String operationDescription;
private String isCompleted;
private BigDecimal completedQty;
private String userName;
private String resourceWorkCenter;
private LocalDateTime dispatchCompleteDate;
@ -231,14 +230,6 @@ public class ShopOrderRelease extends SfcDispatch {
this.resourceWorkCenter = resourceWorkCenter;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public LocalDateTime getDispatchCompleteDate() {
return dispatchCompleteDate;
}

@ -85,7 +85,16 @@ public interface CallItemService extends IService<CallItem> {
* @param user
* @param callItemNoList
*/
void cancelCallItem(String site, String user, List<String> callItemNoList);
void cancelCallItem(String site, String user, List<CallItem> callItemNoList);
/**
*
*
* @param site
* @param user
* @param callItemList
*/
void refreshCallItem(String site, String user, List<CallItem> callItemList);
/**
*
@ -96,6 +105,14 @@ public interface CallItemService extends IService<CallItem> {
*/
void refreshRequiredTime(String site, String user, List<String> callItemNoList);
/**
*
*
* @param user
* @param status
* @param list
*/
void updateCallItemStatusByDispatchBo(String status, String user, List<String> list);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**

@ -28,4 +28,7 @@ public interface ItemBatchService extends IService<ItemBatch> {
* @return
*/
List<ItemBatch> findItemBatch(String site, String item, String batch);
List<ItemBatch> findItemLabel(String site, String item, String label);
}

@ -34,10 +34,10 @@ public interface SfcDispatchService extends IService<SfcDispatch> {
/**
*
*
* @param shopOrderRelease
* @param sfcDispatchDto
* @return
*/
List<ShopOrderRelease> findSfcDispatchList(ShopOrderRelease shopOrderRelease);
List<SfcDispatchDto> findSfcDispatchList(SfcDispatchDto sfcDispatchDto);
/**
*
@ -106,8 +106,8 @@ public interface SfcDispatchService extends IService<SfcDispatch> {
*
*
* @param site
* @param shopOrderRelease
* @param sfcDispatchDto
* @return
*/
Map<String, Object> ganttList(String site, ShopOrderRelease shopOrderRelease);
Map<String, Object> ganttList(String site, SfcDispatchDto sfcDispatchDto);
}

@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
@ -80,8 +81,6 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
callItem.setRequiredQty(sfcDispatchDto.getDispatchQty());
callItem.setRequiredDateTime(sfcDispatchDto.getPlannedStartDate());
callItem.setStatus(Constants.CALL_ITEM_STATUS_NEW);
callItem.setCallStatus(Constants.CALL_ITEM_STATUS_NEW);
callItem.setIssueStatus(Constants.CALL_ITEM_STATUS_NEW);
callItem.setCreateUser(user);
callItem.setCreatedDateTime(nowDate);
callItem.setModifyUser(user);
@ -101,8 +100,6 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
callItem.setHandle(HandleEnum.CALL_ITEM.getHandle(site, callItemNo));
callItem.setCallType(Constants.CALL_TYPE_MATERIAL);
callItem.setStatus(Constants.CALL_ITEM_STATUS_NEW);
callItem.setCallStatus(Constants.CALL_ITEM_STATUS_NEW);
callItem.setIssueStatus(Constants.CALL_ITEM_STATUS_NEW);
callItem.setCreateUser(user);
callItem.setCreatedDateTime(nowDate);
callItem.setModifyUser(user);
@ -143,8 +140,13 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
return;
}
LocalDateTime dateTime = LocalDateTime.now();
callItemMapper.updateCallItemStatusByDispatchBo(Constants.CALL_ITEM_STATUS_CALLED, user, dateTime, callItemList);
//派工单号集合
List<String> dispatchBoList = new ArrayList<>();
for (CallItem callItem : callItemList) {
dispatchBoList.add(callItem.getSfcDispatchBo());
}
this.updateCallItemStatusByDispatchBo(Constants.CALL_ITEM_STATUS_CALLED, user, dispatchBoList);
}
@Override
@ -153,6 +155,8 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
return;
}
//派工单号集合
List<String> dispatchBoList = new ArrayList<>();
for (CallItem callItem : callItemList) {
String sfcDispatchBo = callItem.getSfcDispatchBo();
List<CallItem> list = callItemMapper.selectCallItemAndType(sfcDispatchBo);
@ -167,20 +171,87 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
throw BusinessException.build("勾选的派工单包含原材料组件,不能触发确认到料");
}
}
dispatchBoList.add(sfcDispatchBo);
}
LocalDateTime dateTime = LocalDateTime.now();
callItemMapper.updateCallItemStatusByDispatchBo(Constants.CALL_ITEM_STATUS_ISSUED, user, dateTime, callItemList);
this.updateCallItemStatusByDispatchBo(Constants.CALL_ITEM_STATUS_ISSUED, user, dispatchBoList);
}
@Override
public void cancelCallItem(String site, String user, List<String> callItemNoList) {
public void cancelCallItem(String site, String user, List<CallItem> callItemNoList) {
if (callItemNoList == null || callItemNoList.size() <= 0) {
return;
}
List<String> callItemList = new ArrayList<>();
for (CallItem callItem: callItemNoList) {
String status = callItem.getStatus();
if (Constants.CALL_ITEM_STATUS_ISSUED.equals(status)) {
throw BusinessException.build("领料单号【" +callItem.getCallItemNo()+ "】已发料,不允许取消!");
}
callItemList.add(callItem.getCallItemNo());
}
LocalDateTime dateTime = LocalDateTime.now();
callItemMapper.updateCallItemStatusByCallItemNo(Constants.CALL_ITEM_STATUS_CANCELED, user, dateTime, callItemNoList);
callItemMapper.updateCallItemStatusByCallItemNo(Constants.CALL_ITEM_STATUS_CANCELED, user, dateTime, callItemList);
}
@Override
public void refreshCallItem(String site, String user, List<CallItem> callItemList) {
if (callItemList == null || callItemList.size() <= 0) {
return;
}
List<SfcDispatchDto> sfcDispatchList = new ArrayList<>();
for (CallItem callItem: callItemList) {
SfcDispatchDto sfcDispatchDto = new SfcDispatchDto();
sfcDispatchDto.setHandle(callItem.getSfcDispatchBo());
sfcDispatchList.add(sfcDispatchDto);
}
List<CallItem> list = callItemMapper.selectDispatchCallItem(sfcDispatchList);
if (list == null || list.size() <= 0) {
return;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LocalDateTime nowDate = LocalDateTime.now();
List<CallItem> addList = new ArrayList<>();
List<CallItem> modList = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
CallItem callItem = list.get(i);
String handle = callItem.getHandle();
BigDecimal reqQty = callItem.getRequiredQty();
if (reqQty.compareTo(BigDecimal.ZERO) == 1) {
if (StringUtil.isBlank(handle)) {
String component = StringUtil.trimHandle(callItem.getComponentBo());
String callItemNo = callItem.getSfc() + callItem.getStepId() + component;
callItem.setCallItemNo(callItemNo);
callItem.setHandle(HandleEnum.CALL_ITEM.getHandle(site, callItemNo));
callItem.setCallType(Constants.CALL_TYPE_MATERIAL);
callItem.setStatus(Constants.CALL_ITEM_STATUS_NEW);
callItem.setCreateUser(user);
callItem.setCreatedDateTime(nowDate);
callItem.setModifyUser(user);
callItem.setModifiedDateTime(nowDate);
addList.add(callItem);
} else {
callItem.setRequiredQty(callItem.getIssueQty());
callItem.setModifyUser(user);
callItem.setModifiedDateTime(nowDate);
modList.add(callItem);
}
}
}
if (addList != null && addList.size() > 0) {
this.saveBatch(addList);
}
if (modList != null && modList.size() > 0) {
this.updateBatchById(modList);
}
}
@Override
@ -194,6 +265,12 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
callItemMapper.refreshRequiredTime(user, dateTime, callItemNoList);
}
@Override
public void updateCallItemStatusByDispatchBo(String status, String user, List<String> list) {
LocalDateTime dateTime = LocalDateTime.now();
callItemMapper.updateCallItemStatusByDispatchBo(status, user, dateTime, list);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@Override
@ -203,10 +280,64 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
@Override
public List<CallItem> findIssueItemList(IssueItemDto issueItemDto) {
List<CallItem> list;
if (issueItemDto.getMatchResource()) {
return callItemMapper.finsIssueItemListToResource(issueItemDto);
list = callItemMapper.finsIssueItemListToResource(issueItemDto);
} else {
return callItemMapper.finsIssueItemListNoResource(issueItemDto);
list = callItemMapper.finsIssueItemListNoResource(issueItemDto);
}
if (list == null || list.size() <= 0) {
return list;
}
//计算合计(按下料尺寸)
//物料组为GB(钢板):合计=下料尺寸*号最后两位相乘*需求数量
//其他物料: 合计:下料尺寸*号最后一位*需求数量
Map<String, BigDecimal> compQtyMap = new HashMap<>();
for (CallItem callItem: list) {
String component = callItem.getItem();
String itemGroup = callItem.getItemGroup();
BigDecimal reqQty = callItem.getRequiredQty();
String blankingSize = callItem.getBlankingSize();
//工序叫料不需要计算数量
if (Constants.CALL_TYPE_OPERATION.equals(callItem.getCallType())) {
callItem.setSizeReqQty(BigDecimal.ONE);
compQtyMap.put(component, BigDecimal.ONE);
continue;
}
if ("GB".equals(itemGroup) && blankingSize.contains("*")) {
String []size = blankingSize.split("/*");
if (size != null && size.length >= 2) {
int sizeLength = size.length;
BigDecimal length = new BigDecimal(size[sizeLength-1]);
BigDecimal width = new BigDecimal(size[sizeLength-2]);
BigDecimal sizeReqQty = length.multiply(width).multiply(reqQty);
callItem.setSizeReqQty(sizeReqQty);
//按物料汇总需求数量
compQtyMap.put(component, (compQtyMap.get(component) != null ? compQtyMap.get(component).add(sizeReqQty) : sizeReqQty));
}
} else {
String []size = blankingSize.split("/*");
if (size != null && size.length >= 1) {
int sizeLength = size.length;
BigDecimal length = new BigDecimal(size[sizeLength-1]);
BigDecimal sizeReqQty = length.multiply(reqQty);
callItem.setSizeReqQty(sizeReqQty);
//按物料汇总需求数量
compQtyMap.put(component, (compQtyMap.get(component) != null ? compQtyMap.get(component).add(sizeReqQty) : sizeReqQty));
}
}
}
//计算总数量(按数量汇总)
for (CallItem callItem : list) {
callItem.setCompReqQty(compQtyMap.get(callItem.getItem()));
}
return list;
}
}

@ -89,7 +89,7 @@ public class IssueItemServiceImpl extends ServiceImpl<IssueItemMapper, IssueItem
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (MaterialType.RAW.value().equals(materialType)){
//原材料
List<ItemBatch> itemBatchList = itemBatchService.findItemBatch(site, item, inventory);
List<ItemBatch> itemBatchList = itemBatchService.findItemLabel(site, item, inventory);
if (itemBatchList == null || itemBatchList.size() <= 0) {
throw BusinessException.build("扫描的物料条码【 "+ inventory +" 】不存在!");
}
@ -178,10 +178,12 @@ public class IssueItemServiceImpl extends ServiceImpl<IssueItemMapper, IssueItem
if (MaterialType.RAW.value().equals(materialType)) {
//原材料
List<ItemBatch> itemBatchList = itemBatchService.findItemBatch(site, item, inventory);
List<ItemBatch> itemBatchList = itemBatchService.findItemLabel(site, item, inventory);
if (itemBatchList == null || itemBatchList.size() <= 0) {
throw BusinessException.build("扫描的物料条码【 " + inventory + " 】不存在!");
}
String batch = itemBatchList.get(0).getBatch();
String supplier = itemBatchList.get(0).getSupplier();
try {
//查询库存是否存在
@ -195,6 +197,20 @@ public class IssueItemServiceImpl extends ServiceImpl<IssueItemMapper, IssueItem
request.setItemRef(itemBo);
request.setInventoryId(inventory);
request.setQuantityOnHand(issueInvQty);
//库存自定义字段
List<InventoryDataField> inventoryDataFieldList = new ArrayList<>();
InventoryDataField dataField = new InventoryDataField();
dataField.setAttribute("BATCH_NUMBER");
dataField.setValue(batch);
inventoryDataFieldList.add(dataField);
dataField = new InventoryDataField();
dataField.setAttribute("VENDOR_NAME");
dataField.setValue(supplier);
inventoryDataFieldList.add(dataField);
request.setAssemblyDataList(inventoryDataFieldList);
meInventoryService.validateAndAdd(request);
} else {
issueInvQty = issueInvQty.add(inventoryModel.getQtyOnHand());

@ -41,7 +41,19 @@ public class ItemBatchServiceImpl extends ServiceImpl<ItemBatchMapper, ItemBatch
queryMap.put(ItemBatch.SITE, site);
queryMap.put(ItemBatch.ITEM, item);
if (StringUtil.notBlank(batch)) {
queryMap.put(ItemBatch.LABEL, batch);
queryMap.put(ItemBatch.BATCH, batch);
}
return itemBatchMapper.selectByMap(queryMap);
}
@Override
public List<ItemBatch> findItemLabel(String site, String item, String label) {
Map<String, Object> queryMap = new HashMap<>();
queryMap.put(ItemBatch.SITE, site);
queryMap.put(ItemBatch.ITEM, item);
if (StringUtil.notBlank(label)) {
queryMap.put(ItemBatch.LABEL, label);
}
return itemBatchMapper.selectByMap(queryMap);

@ -85,8 +85,8 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
}
@Override
public List<ShopOrderRelease> findSfcDispatchList(ShopOrderRelease shopOrderRelease) {
return sfcDispatchMapper.findSfcDispatchList(shopOrderRelease);
public List<SfcDispatchDto> findSfcDispatchList(SfcDispatchDto sfcDispatchDto) {
return sfcDispatchMapper.findSfcDispatchList(sfcDispatchDto);
}
@Override
@ -184,6 +184,7 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
LocalDateTime nowDate = LocalDateTime.now();
SfcDispatch sfcDispatch = null;
List<SfcDispatch> list = new ArrayList<>();
List<String> dispatchBoList = new ArrayList<>();
for (SfcDispatchDto sfcDispatchDto : sfcDispatchList) {
String sfcDispatchBo = sfcDispatchDto.getHandle();
String shopOrder = sfcDispatchDto.getShopOrder();
@ -209,12 +210,17 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
sfcDispatchDto.setDispatchStatus(DispatchStatusEnum.CANCEL.getCode());
dispatchBoList.add(sfcDispatchBo);
}
if (list != null && list.size() > 0) {
this.updateBatchById(list);
}
//取消叫料数据
callItemService.updateCallItemStatusByDispatchBo(Constants.CALL_ITEM_STATUS_CANCELED, user, dispatchBoList);
//取消产前准备任务
prodReadyTaskService.createTask(sfcDispatchList);
}
@ -242,11 +248,11 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
}
@Override
public Map<String, Object> ganttList(String site, ShopOrderRelease shopOrderRelease) {
public Map<String, Object> ganttList(String site, SfcDispatchDto sfcDispatchDto) {
Map<String, Object> map = new HashMap<>();
//查询派工数据
List<ShopOrderRelease> scheduleList = this.findSfcDispatchList(shopOrderRelease);
List<SfcDispatchDto> scheduleList = this.findSfcDispatchList(sfcDispatchDto);
if (scheduleList == null || scheduleList.size() <= 0) {
return map;
}
@ -259,7 +265,7 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
}
});
Map<String, Map<String, List<WorkCenterWorkTimeDTO>>> processedMap = this.processWorkCenterWorkTimes(site, workCenterList, shopOrderRelease.getStartFromDate(), shopOrderRelease.getStartToDate());
Map<String, Map<String, List<WorkCenterWorkTimeDTO>>> processedMap = this.processWorkCenterWorkTimes(site, workCenterList, sfcDispatchDto.getStartFromDate(), sfcDispatchDto.getStartToDate());
map.put("workCenterWorkTimes", processedMap);
return map;
@ -428,7 +434,7 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
}
//校验操作者与资源是否匹配
String employees = sfcDispatchDto.getUserName();
String employees = sfcDispatchDto.getEmployee();
if (StringUtil.notBlank(employees)) {
//资源、计划时间必输
if (StringUtils.isBlank(resource)) {
@ -439,7 +445,7 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
}
//派工人员为多个
String [] employeeArray = new String[]{};
String [] employeeArray = new String[1];
if (!employees.contains(",")) {
employeeArray[0] = employees;
} else {

@ -28,6 +28,7 @@
<resultMap id="FullResultMap" type="com.foreverwin.mesnac.dispatch.model.CallItem" extends="BaseResultMap">
<result column="ITEM" property="item" />
<result column="ITEM_GROUP" property="itemGroup" />
<result column="COMPONENT" property="component" />
<result column="ITEM_DESCRIPTION" property="itemDescription" />
<result column="MATERIAL_TYPE" property="materialType" />
@ -595,7 +596,7 @@
<select id="selectEffectedCallItemByDispatchBo" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM Z_CALL_ITEM
WHERE SFC_DISPATCH_BO = #{sfcDispatchBo}
WHERE SFC_DISPATCH_BO = #{sfcDispatchBo} AND STATUS IN ('802','803')
</select>
<delete id="deleteDispatchCallItem">
@ -607,7 +608,7 @@
<select id="selectDispatchCallItem" resultMap="BaseResultMap">
SELECT ZSD.HANDLE SFC_DISPATCH_BO, ZSD.SITE, ZSD.SHOP_ORDER, ZSD.SFC, ZSD.DISPATCH_NO, ZSD.OPERATION, ZSD.STEP_ID, ZSD.RESRCE, BC.COMPONENT_GBO COMPONENT_BO,
SC.QTY*BC.QTY REQUIRED_QTY, ZSD.PLANNED_START_DATE REQUIRED_DATE_TIME
SC.QTY*BC.QTY ISSUE_QTY, SC.QTY*BC.QTY-NVL(ZCI.REQUIRED_QTY,0) REQUIRED_QTY, ZSD.PLANNED_START_DATE REQUIRED_DATE_TIME, ZCI.HANDLE, ZCI.CALL_TYPE
FROM Z_SFC_DISPATCH ZSD
INNER JOIN SFC SC ON SC.SITE = ZSD.SITE AND SC.SFC = ZSD.SFC
INNER JOIN SFC_BOM SB ON SB.SFC_BO = SC.HANDLE
@ -615,10 +616,12 @@
INNER JOIN ITEM CP ON CP.HANDLE = BC.COMPONENT_GBO
INNER JOIN BOM_OPERATION BO ON BO.BOM_COMPONENT_BO = BC.HANDLE AND BO.OPERATION_BO = 'OperationBO:'||SC.SITE||','||ZSD.OPERATION||',#'
INNER JOIN CUSTOM_FIELDS CF ON CF.HANDLE = BC.HANDLE AND CF."ATTRIBUTE" = 'STEP_ID' AND CF.VALUE = ZSD.STEP_ID
LEFT JOIN Z_CALL_ITEM ZCI ON ZCI.SFC_DISPATCH_BO = ZSD.HANDLE AND ZCI.COMPONENT_BO = CP.HANDLE AND ZCI.STEP_ID = ZSD.STEP_ID
WHERE ZSD.HANDLE IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item.handle}
</foreach>
ORDER BY TO_NUMBER(CF.VALUE)
</select>
<select id="selectCallItemAndType" resultMap="FullResultMap">
@ -734,7 +737,7 @@
GROUP BY SITE, SFC
) ZS ON ZS.SITE = SC.SITE AND ZS.SFC = SC.SFC
WHERE IV.QTY_ON_HAND > 0
) VS ON VS.SITE = ZCI.SITE AND VS.ITEM_BO = ZCI.COMPONENT_BO
) VS ON VS.SITE = ZCI.SITE AND ZCI.SFC = VS.SFC AND VS.ITEM_BO = ZCI.COMPONENT_BO
LEFT JOIN Z_SFC_DISPATCH ZSH ON ZSH.SITE = VS.SITE AND ZSH.SFC = VS.SFC AND ZSH.DISPATCH_SEQ = VS.DISPATCH_SEQ
WHERE ZCI.SITE = #{site}
<if test="workCenter != null and workCenter != ''" >
@ -826,7 +829,7 @@
UPDATE Z_CALL_ITEM SET STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime}
WHERE STATUS != '804' AND SFC_DISPATCH_BO IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item.sfcDispatchBo}
#{item}
</foreach>
</update>
@ -872,13 +875,15 @@
</select>
<select id="finsIssueItemListToResource" resultMap="FullResultMap">
SELECT VIP.SITE, VIP.WORK_ORDER, VIP.ITEM_BO, VIP.ITEM, VIP.ITEM_DESCRIPTION, VIP.REQUIRED_QTY, VIP.BLANKING_SIZE, VIP.RESRCE, SIP.SOURCE_RESOURCE
SELECT VIP.SITE, VIP.WORK_ORDER, VIP.CALL_TYPE, VIP.ITEM_GROUP, VIP.ITEM_BO, VIP.ITEM, VIP.ITEM_DESCRIPTION, VIP.REQUIRED_QTY, VIP.BLANKING_SIZE, VIP.RESRCE, SIP.SOURCE_RESOURCE
FROM (
SELECT L.SITE, CF.VALUE WORK_ORDER, CP.HANDLE ITEM_BO, CP.ITEM, CT.DESCRIPTION ITEM_DESCRIPTION, SUM(L.REQUIRED_QTY)-SUM(NVL(L.ISSUE_QTY,0)) REQUIRED_QTY, W.BLANKING_SIZE, W.RESRCE
SELECT L.SITE, CF.VALUE WORK_ORDER, L.CALL_TYPE, IG.ITEM_GROUP, CP.HANDLE ITEM_BO, CP.ITEM, CT.DESCRIPTION ITEM_DESCRIPTION, SUM(L.REQUIRED_QTY)-SUM(NVL(L.ISSUE_QTY,0)) REQUIRED_QTY, W.BLANKING_SIZE, W.RESRCE
FROM Z_CALL_ITEM L
INNER JOIN Z_SFC_DISPATCH W ON L.SFC_DISPATCH_BO = W.HANDLE
INNER JOIN ITEM CP ON CP.HANDLE = L.COMPONENT_BO
LEFT JOIN ITEM_T CT ON CT.ITEM_BO = CP.HANDLE AND CT.LOCALE = 'zh'
LEFT JOIN ITEM_GROUP_MEMBER IGM ON IGM.ITEM_BO = CP.HANDLE
LEFT JOIN ITEM_GROUP IG ON IG.HANDLE = IGM.ITEM_GROUP_BO
INNER JOIN SHOP_ORDER SO ON SO.SITE = L.SITE AND SO.SHOP_ORDER = L.SHOP_ORDER
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = SO.HANDLE AND CF."ATTRIBUTE" = 'WORK_ORDER'
WHERE L.SITE = #{site} AND L.STATUS = '802'
@ -891,8 +896,8 @@
<if test="shopOrder != null and shopOrder != ''">
AND SO.SHOP_ORDER = #{shopOrder}
</if>
<if test="dispatchNo != null and dispatchNo != ''">
AND W.DISPATCH_NO = #{dispatchNo}
<if test="workOrder != null and workOrder != ''">
AND CF.VALUE = #{workOrder}
</if>
<if test="requiredFromDT != null">
AND L.REQUIRED_DATE_TIME >= #{requiredFromDT}
@ -900,7 +905,7 @@
<if test="requiredToDT != null">
AND L.REQUIRED_DATE_TIME &lt;= #{requiredToDT}
</if>
GROUP BY L.SITE, CF.VALUE, CP.HANDLE, CP.ITEM, CT.DESCRIPTION, W.BLANKING_SIZE, W.RESRCE
GROUP BY L.SITE, CF.VALUE, L.CALL_TYPE, IG.ITEM_GROUP, CP.HANDLE, CP.ITEM, CT.DESCRIPTION, W.BLANKING_SIZE, W.RESRCE
) VIP
LEFT JOIN (
SELECT L.SITE, L.ITEM_BO, ZD.RESRCE SOURCE_RESOURCE
@ -914,16 +919,19 @@
WHERE W.QTY_ON_HAND > 0
) SIP
ON VIP.SITE = SIP.SITE AND VIP.ITEM_BO = SIP.ITEM_BO AND VIP.REQUIRED_QTY > 0
ORDER BY VIP.WORK_ORDER, VIP.ITEM
</select>
<select id="finsIssueItemListNoResource" resultMap="FullResultMap">
SELECT VIP.SITE, VIP.WORK_ORDER, VIP.ITEM_BO, VIP.ITEM, VIP.ITEM_DESCRIPTION, VIP.REQUIRED_QTY, VIP.BLANKING_SIZE, SIP.SOURCE_RESOURCE
SELECT VIP.SITE, VIP.WORK_ORDER, VIP.CALL_TYPE, VIP.ITEM_GROUP, VIP.ITEM_BO, VIP.ITEM, VIP.ITEM_DESCRIPTION, VIP.REQUIRED_QTY, VIP.BLANKING_SIZE, SIP.SOURCE_RESOURCE
FROM (
SELECT L.SITE, CF.VALUE WORK_ORDER, CP.HANDLE ITEM_BO, CP.ITEM, CT.DESCRIPTION ITEM_DESCRIPTION, SUM(L.REQUIRED_QTY)-SUM(NVL(L.ISSUE_QTY,0)) REQUIRED_QTY, W.BLANKING_SIZE
SELECT L.SITE, CF.VALUE WORK_ORDER, L.CALL_TYPE, IG.ITEM_GROUP, CP.HANDLE ITEM_BO, CP.ITEM, CT.DESCRIPTION ITEM_DESCRIPTION, SUM(L.REQUIRED_QTY)-SUM(NVL(L.ISSUE_QTY,0)) REQUIRED_QTY, W.BLANKING_SIZE
FROM Z_CALL_ITEM L
INNER JOIN Z_SFC_DISPATCH W ON L.SFC_DISPATCH_BO = W.HANDLE
INNER JOIN ITEM CP ON CP.HANDLE = L.COMPONENT_BO
LEFT JOIN ITEM_T CT ON CT.ITEM_BO = CP.HANDLE AND CT.LOCALE = 'zh'
LEFT JOIN ITEM_GROUP_MEMBER IGM ON IGM.ITEM_BO = CP.HANDLE
LEFT JOIN ITEM_GROUP IG ON IG.HANDLE = IGM.ITEM_GROUP_BO
INNER JOIN SHOP_ORDER SO ON SO.SITE = L.SITE AND SO.SHOP_ORDER = L.SHOP_ORDER
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = SO.HANDLE AND CF."ATTRIBUTE" = 'WORK_ORDER'
WHERE L.SITE = #{site} AND L.STATUS = '802'
@ -936,8 +944,8 @@
<if test="shopOrder != null and shopOrder != ''">
AND SO.SHOP_ORDER = #{shopOrder}
</if>
<if test="dispatchNo != null and dispatchNo != ''">
AND W.DISPATCH_NO = #{dispatchNo}
<if test="workOrder != null and workOrder != ''">
AND CF.VALUE = #{workOrder}
</if>
<if test="requiredFromDT != null">
AND L.REQUIRED_DATE_TIME >= #{requiredFromDT}
@ -945,7 +953,7 @@
<if test="requiredToDT != null">
AND L.REQUIRED_DATE_TIME &lt;= #{requiredToDT}
</if>
GROUP BY L.SITE, CF.VALUE, CP.HANDLE, CP.ITEM, CT.DESCRIPTION, W.BLANKING_SIZE
GROUP BY L.SITE, CF.VALUE, L.CALL_TYPE, IG.ITEM_GROUP, CP.HANDLE, CP.ITEM, CT.DESCRIPTION, W.BLANKING_SIZE
) VIP
LEFT JOIN (
SELECT L.SITE, L.ITEM_BO, ZD.RESRCE SOURCE_RESOURCE
@ -959,5 +967,6 @@
WHERE W.QTY_ON_HAND > 0
) SIP
ON VIP.SITE = SIP.SITE AND VIP.ITEM_BO = SIP.ITEM_BO AND VIP.REQUIRED_QTY > 0
ORDER BY VIP.WORK_ORDER, VIP.ITEM
</select>
</mapper>

@ -51,7 +51,7 @@
<result column="OTHER_5" property="other5" />
</resultMap>
<resultMap id="FullResultMap" type="com.foreverwin.mesnac.dispatch.model.ShopOrderRelease">
<resultMap id="FullResultMap" type="com.foreverwin.mesnac.common.dto.SfcDispatchDto">
<result column="IS_COMPLETED" property="isCompleted" />
<result column="ITEM_BO" property="itemBo" />
<result column="ITEM" property="item" />
@ -63,7 +63,6 @@
<result column="ITEM_DESCRIPTION" property="itemDescription" />
<result column="COMPONENT" property="component" />
<result column="COMPLETED_QTY" property="completedQty" />
<result column="USER_NAME" property="userName" />
<result column="COMPONENT_DESCRIPTION" property="componentDescription" />
<result column="OPERATION_DESCRIPTION" property="operationDescription" />
<result column="RESOURCE_WORK_CENTER" property="resourceWorkCenter" />

@ -1,8 +1,10 @@
package com.foreverwin.mesnac.integration.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.constant.CustomFieldConstant;
import com.foreverwin.mesnac.common.dto.LabelPrintDto;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.model.PrintLog;
import com.foreverwin.mesnac.common.service.PrintLogService;
@ -431,6 +433,9 @@ public class InterfaceServiceImpl implements InterfaceService {
* 3.MES=MES
*/
String erpWorkCenter = componentDto.getOPERATION();
if (StringUtil.isBlank(erpWorkCenter)) {
throw BusinessException.build("BOM节点下字段【OPERATION】不能为空");
}
Operation operationModel = operationService.queryOperationByErpWorkCenter(site, erpWorkCenter);
if (operationModel == null) {
throw BusinessException.build("ERP工作中心【" +erpWorkCenter+"】对应的MES工序未维护");
@ -517,7 +522,7 @@ public class InterfaceServiceImpl implements InterfaceService {
String stepId = routerStepDto.getSTEP_ID();
String erpWorkCenter = routerStepDto.getOPERATION().trim();
if (StringUtil.isBlank(erpWorkCenter)) {
throw BusinessException.build("步骤标识【" +stepId+ "】下ERP工作中心不能为空");
continue;
}
if (StringUtil.isBlank(entryRouterStep)) {
@ -835,21 +840,25 @@ public class InterfaceServiceImpl implements InterfaceService {
}
//打印模板参数
JSONObject jsonObject = new JSONObject();
jsonObject.put("ITEM", item);
jsonObject.put("ITEM_DESC", itemModel.getDescription());
jsonObject.put("SUPPLIER", supplier);
jsonObject.put("INVENTORY", inventory);
List<LabelPrintDto> labelPrintDtoList = new ArrayList<>();
LabelPrintDto labelPrintDto = new LabelPrintDto();
labelPrintDto.setSite(site);
labelPrintDto.setPrintTemplate(Constants.PRINT_TYPE_INV);
labelPrintDto.setItem(item);
labelPrintDto.setItemDescription(itemModel.getDescription());
labelPrintDto.setSupplier(supplier);
labelPrintDto.setBatch(inventory);
labelPrintDtoList.add(labelPrintDto);
//记录打印数据
PrintLog printLog = new PrintLog();
printLog.setHandle(UUID.randomUUID().toString());
printLog.setSite(site);
printLog.setCategory("INV");
printLog.setCategory(Constants.PRINT_TYPE_INV);
printLog.setPrintName("");
printLog.setPrintTemplate("INV_LABEL");
printLog.setPrintParam(jsonObject.toJSONString());
printLog.setPrintTemplate(Constants.PRINT_TYPE_INV);
printLog.setPrintParam(JSON.toJSONString(labelPrintDtoList));
printLog.setInventory(inventory);
printLog.setItemBo(itemModel.getHandle());
printLog.setIsPrint("false");

@ -0,0 +1,120 @@
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.MessageTypeUserGroupService;
import com.foreverwin.mesnac.meapi.model.MessageTypeUserGroup;
import java.util.List;
/**
*
* @author Philip
* @since 2021-08-07
*/
@RestController
@RequestMapping("/MESSAGE-TYPE-USER-GROUP")
public class MessageTypeUserGroupController {
@Autowired
public MessageTypeUserGroupService messageTypeUserGroupService;
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getMessageTypeUserGroupById(@PathVariable String id) {
return R.ok( messageTypeUserGroupService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getMessageTypeUserGroupList(MessageTypeUserGroup messageTypeUserGroup){
List<MessageTypeUserGroup> result;
QueryWrapper<MessageTypeUserGroup> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(messageTypeUserGroup);
result = messageTypeUserGroupService.list(queryWrapper);
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<MessageTypeUserGroup> frontPage, MessageTypeUserGroup messageTypeUserGroup){
IPage result;
QueryWrapper<MessageTypeUserGroup> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(messageTypeUserGroup);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(MessageTypeUserGroup::getHandle, frontPage.getGlobalQuery())
.or().like(MessageTypeUserGroup::getMessageTypeBo, frontPage.getGlobalQuery())
.or().like(MessageTypeUserGroup::getUserGroupBo, frontPage.getGlobalQuery())
);
}
result = messageTypeUserGroupService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param messageTypeUserGroup
* @return null
*/
@PostMapping
public R save(@RequestBody MessageTypeUserGroup messageTypeUserGroup) {
return R.ok(messageTypeUserGroupService.save(messageTypeUserGroup));
}
/**
*
* @param messageTypeUserGroup
* @return null
*/
@PutMapping
public R updateById(@RequestBody MessageTypeUserGroup messageTypeUserGroup) {
return R.ok(messageTypeUserGroupService.updateById(messageTypeUserGroup));
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(messageTypeUserGroupService.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(messageTypeUserGroupService.removeByIds(ids));
}
}

@ -183,7 +183,7 @@ public class ResrceController {
List<Resrce> result;
try {
String site = CommonMethods.getSite();
String [] userArray = new String[]{};
String [] userArray = new String[1];
if (StringUtils.notBlank(user)) {
if (user.contains(",")) {
userArray = user.split(",");

@ -0,0 +1,18 @@
package com.foreverwin.mesnac.meapi.mapper;
import com.foreverwin.mesnac.meapi.model.MessageTypeUserGroup;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper
* </p>
*
* @author Philip
* @since 2021-08-07
*/
@Repository
public interface MessageTypeUserGroupMapper extends BaseMapper<MessageTypeUserGroup> {
}

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.time.LocalDateTime;
/**
* <p>
@ -23,8 +23,9 @@ import java.util.List;
public interface SfcMapper extends BaseMapper<Sfc> {
/**
* sfc
* @return
*/
List<Sfc> getSfcListByResrceBO(String resrceBO);
LocalDateTime getSfcStartTime(@Param("sfcBO")String sfcBO);
SfcDto findSfcData(@Param("site") String site, @Param("sfc") String sfc);

@ -0,0 +1,76 @@
package com.foreverwin.mesnac.meapi.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author Philip
* @since 2021-08-07
*/
@TableName("MESSAGE_TYPE_USER_GROUP")
public class MessageTypeUserGroup extends Model<MessageTypeUserGroup> {
private static final long serialVersionUID = 1L;
@TableField("HANDLE")
private String handle;
@TableField("MESSAGE_TYPE_BO")
private String messageTypeBo;
@TableField("USER_GROUP_BO")
private String userGroupBo;
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getMessageTypeBo() {
return messageTypeBo;
}
public void setMessageTypeBo(String messageTypeBo) {
this.messageTypeBo = messageTypeBo;
}
public String getUserGroupBo() {
return userGroupBo;
}
public void setUserGroupBo(String userGroupBo) {
this.userGroupBo = userGroupBo;
}
public static final String HANDLE = "HANDLE";
public static final String MESSAGE_TYPE_BO = "MESSAGE_TYPE_BO";
public static final String USER_GROUP_BO = "USER_GROUP_BO";
@Override
protected Serializable pkVal() {
return this.handle;
}
@Override
public String toString() {
return "MessageTypeUserGroup{" +
"handle = " + handle +
", messageTypeBo = " + messageTypeBo +
", userGroupBo = " + userGroupBo +
"}";
}
}

@ -0,0 +1,28 @@
package com.foreverwin.mesnac.meapi.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.model.MessageTypeUserGroup;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author Philip
* @since 2021-08-07
*/
public interface MessageTypeUserGroupService extends IService<MessageTypeUserGroup> {
/**
*
* @param frontPage
* @return
*/
IPage<MessageTypeUserGroup> selectPage(FrontPage<MessageTypeUserGroup> frontPage, MessageTypeUserGroup messageTypeUserGroup);
List<MessageTypeUserGroup> selectList(MessageTypeUserGroup messageTypeUserGroup);
}

@ -8,6 +8,7 @@ import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.foreverwin.modular.core.util.FrontPage;
import java.time.LocalDateTime;
import java.util.List;
/**
@ -36,9 +37,9 @@ public interface SfcService extends IService<Sfc> {
List<Sfc> getSfcListByShopOrderBo(String shopOrderBo);
/**
* sfc
* sfc
*/
List<Sfc> getSfcListByResrceBO(String resrceBO);
LocalDateTime getSfcStartTime(String sfcBO);
/**
*

@ -0,0 +1,46 @@
package com.foreverwin.mesnac.meapi.service.impl;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.model.MessageTypeUserGroup;
import com.foreverwin.mesnac.meapi.mapper.MessageTypeUserGroupMapper;
import com.foreverwin.mesnac.meapi.service.MessageTypeUserGroupService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author Philip
* @since 2021-08-07
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class MessageTypeUserGroupServiceImpl extends ServiceImpl<MessageTypeUserGroupMapper, MessageTypeUserGroup> implements MessageTypeUserGroupService {
@Autowired
private MessageTypeUserGroupMapper messageTypeUserGroupMapper;
@Override
public IPage<MessageTypeUserGroup> selectPage(FrontPage<MessageTypeUserGroup> frontPage, MessageTypeUserGroup messageTypeUserGroup) {
QueryWrapper<MessageTypeUserGroup> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(messageTypeUserGroup);
return super.page(frontPage.getPagePlus(), queryWrapper);
}
@Override
public List<MessageTypeUserGroup> selectList(MessageTypeUserGroup messageTypeUserGroup) {
QueryWrapper<MessageTypeUserGroup> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(messageTypeUserGroup);
return super.list(queryWrapper);
}
}

@ -15,6 +15,7 @@ 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;
/**
* <p>
@ -61,9 +62,9 @@ public class SfcServiceImpl extends ServiceImpl<SfcMapper, Sfc> implements SfcSe
}
@Override
public List<Sfc> getSfcListByResrceBO(String resrceBO) {
List<Sfc> sfc=sfcMapper.getSfcListByResrceBO(resrceBO);
return sfc;
public LocalDateTime getSfcStartTime(String sfcBO) {
LocalDateTime startTime=sfcMapper.getSfcStartTime(sfcBO);
return startTime;
}

@ -0,0 +1,262 @@
<?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.mesnac.meapi.mapper.MessageTypeUserGroupMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.meapi.model.MessageTypeUserGroup">
<result column="HANDLE" property="handle" />
<result column="MESSAGE_TYPE_BO" property="messageTypeBo" />
<result column="USER_GROUP_BO" property="userGroupBo" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, MESSAGE_TYPE_BO, USER_GROUP_BO
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM MESSAGE_TYPE_USER_GROUP
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</select>
<select id="selectOne" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew.entity.handle!=null">
HANDLE=#{ew.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</where>
</select>
<select id="selectCount" resultType="Integer">
SELECT COUNT(1) FROM MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<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 MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<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 MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<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 MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<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 MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<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 MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<insert id="insert" parameterType="com.foreverwin.mesnac.meapi.model.MessageTypeUserGroup">
INSERT INTO MESSAGE_TYPE_USER_GROUP
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="messageTypeBo!=null">MESSAGE_TYPE_BO,</if>
<if test="userGroupBo!=null">USER_GROUP_BO,</if>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="messageTypeBo!=null">#{messageTypeBo},</if>
<if test="userGroupBo!=null">#{userGroupBo},</if>
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.meapi.model.MessageTypeUserGroup">
INSERT INTO MESSAGE_TYPE_USER_GROUP
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{messageTypeBo},
#{userGroupBo},
</trim>
</insert>
<update id="update">
UPDATE MESSAGE_TYPE_USER_GROUP <trim prefix="SET" suffixOverrides=",">
<if test="et.handle!=null">HANDLE=#{et.handle},</if>
<if test="et.messageTypeBo!=null">MESSAGE_TYPE_BO=#{et.messageTypeBo},</if>
<if test="et.userGroupBo!=null">USER_GROUP_BO=#{et.userGroupBo},</if>
</trim>
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
HANDLE=#{ew.entity.handle}
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</update>
<delete id="deleteByMap">
DELETE FROM MESSAGE_TYPE_USER_GROUP
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</delete>
<delete id="delete">
DELETE FROM MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
</mapper>

@ -599,7 +599,7 @@
</select>
<select id="selectResourceListByUT" resultMap="BaseResultMap">
SELECT DISTINCT RS.HANDLE, RS.SITE, RS.RESRCE, RS.DESCRIPTION, RS.STATUS_BO, RS.PROCESS_RESOURCE, RS.OPERATION_BO, RS.VALID_FROM, RS.VALID_TO, RS.SETUP_STATE, RS.SETUP_DESCRIPTION, RS.CNC_MACHINE, RS.PENDING_STATUS_BO, RS.PENDING_REASON_CODE_BO, RS.PENDING_RESOURCE_RC_BO, RS.PENDING_COMMENTS, RS.CREATED_DATE_TIME, RS.MODIFIED_DATE_TIME, RS.ERP_PLANT_MAINT_ORDER, RS.ERP_EQUIPMENT_NUMBER, RS.ERP_INTERNAL_ID, RS.ERP_CAPACITY_CATEGORY
SELECT RS.HANDLE, RS.SITE, RS.RESRCE, RS.DESCRIPTION, RS.STATUS_BO, RS.PROCESS_RESOURCE, RS.OPERATION_BO, RS.VALID_FROM, RS.VALID_TO, RS.SETUP_STATE, RS.CREATED_DATE_TIME, RS.MODIFIED_DATE_TIME
FROM RESRCE RS
INNER JOIN RESOURCE_TYPE_RESOURCE RTR ON RTR.RESOURCE_BO = RS.HANDLE
INNER JOIN RESOURCE_TYPE RT ON RT.HANDLE = RTR.RESOURCE_TYPE_BO
@ -609,5 +609,6 @@
<foreach collection="userList" item="item" open="(" close=")" separator="," >
#{item}
</foreach>
GROUP BY RS.HANDLE, RS.SITE, RS.RESRCE, RS.DESCRIPTION, RS.STATUS_BO, RS.PROCESS_RESOURCE, RS.OPERATION_BO, RS.VALID_FROM, RS.VALID_TO, RS.SETUP_STATE, RS.CREATED_DATE_TIME, RS.MODIFIED_DATE_TIME
</select>
</mapper>

@ -632,17 +632,15 @@
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="getSfcListByResrceBO" resultMap="BaseResultMap">
SELECT S.SFC
FROM RESRCE RES
INNER JOIN SFC_IN_WORK IW ON IW.RESOURCE_BO = RES.HANDLE
INNER JOIN SFC_STEP SS ON SS.HANDLE = IW.SFC_STEP_BO
INNER JOIN SFC_ROUTER SRO ON SS.SFC_ROUTER_BO = SRO.HANDLE
INNER JOIN SFC_ROUTING SR ON SRO.SFC_ROUTING_BO = SR.HANDLE
INNER JOIN SFC S ON SR.SFC_BO = S.HANDLE
<select id="getSfcStartTime" resultType="java.time.LocalDateTime">
SELECT IW.DATE_STARTED
FROM SFC S
INNER JOIN SFC_ROUTING SR ON SR.SFC_BO = S.HANDLE
INNER JOIN SFC_ROUTER SRO ON SRO.SFC_ROUTING_BO = SR.HANDLE
INNER JOIN SFC_STEP SS ON SS.SFC_ROUTER_BO = SRO.HANDLE
INNER JOIN SFC_IN_WORK IW ON SS.HANDLE = IW.SFC_STEP_BO
INNER JOIN STATUS ST ON ST.HANDLE = S.STATUS_BO AND ST.STATUS ='403'
WHERE RES.HANDLE = #{resrceBO}
ORDER BY IW.DATE_STARTED DESC
WHERE s.HANDLE=#{sfcBO}
</select>

@ -4,7 +4,7 @@ import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.dto.WorkCenterDto;
import com.foreverwin.mesnac.meapi.model.Sfc;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
public interface PodTemplateService {
@ -18,7 +18,7 @@ public interface PodTemplateService {
void sfcComplete(Map<String, Object> map);
void sendErp(String sfc, String stepId, BigDecimal qty, BigDecimal scrapQty);
void sendErp(List<Map<String,Object>> mapList);
SfcDto getInfoBySfc(Sfc sfc);

@ -46,7 +46,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.rmi.RemoteException;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.*;
@ -217,6 +219,16 @@ public class PodTemplateServiceImpl implements PodTemplateService {
throw new BaseException("互检任务不合格,不能开始请检查");
}
}
//是否完成专检
QueryWrapper<InspectionTask> queryWrapper=new QueryWrapper<>();
queryWrapper.eq(InspectionTask.CATEGORY,Constants.INSPECTION_TYPE_P);
queryWrapper.eq(InspectionTask.SFC,sfc);
queryWrapper.ne(InspectionTask.STATUS,Constants.INSPECTION_TASK_STATUS_COMPLETE);
queryWrapper.ne(InspectionTask.RESULT,Constants.RSESULT_OK);
List<InspectionTask> list = inspectionTaskService.list(queryWrapper);
if (!list.isEmpty()) {
throw new BaseException("请完成专检检验任务");
}
try {
sfcCrossService.startAction(site, currentRevisionRef.getHandle(), resrce, sfcServiceById.getHandle(), qty);
} catch (Exception e) {
@ -232,8 +244,8 @@ public class PodTemplateServiceImpl implements PodTemplateService {
public void sfcComplete(Map<String, Object> map) {
List<SfcDto> sfcDtoList = (List<SfcDto>) map.get("sfcDtoList");
ObjectMapper mapper = new ObjectMapper();
sfcDtoList = mapper.convertValue(sfcDtoList, new TypeReference<List<SfcDto>>() {
});
sfcDtoList = mapper.convertValue(sfcDtoList, new TypeReference<List<SfcDto>>() {});
List<Map<String,Object>> postMapList=new ArrayList<>();
String resrce = (String) map.get("resrce");
if (sfcDtoList == null || sfcDtoList.size() < 1) {
throw new BaseException("作业列表不能为空");
@ -242,6 +254,7 @@ public class PodTemplateServiceImpl implements PodTemplateService {
throw new BaseException("资源不能为空");
}
for (SfcDto sfcDto:sfcDtoList){
Map<String,Object> postMap=new HashMap<>();
String site = CommonMethods.getSite();
String operation = sfcDto.getOperation();
Operation currentRevisionRef = operationService.getCurrentRevisionRef(site, operation);
@ -291,6 +304,9 @@ public class PodTemplateServiceImpl implements PodTemplateService {
if (inspectionItemDetails.size() > 0 && inspectionItemDetails.get(0) != null) {
paramMap.put("CATEGORY",Constants.INSPECTION_TYPE_P);
inspectionTaskService.createTask(paramMap);
}else {
paramMap.put("CATEGORY",Constants.INSPECTION_TYPE_P);
inspectionTaskService.createCompleteTask(paramMap);
}
//首件创建
inspectionItemDetails = inspectionItemService.selectQualityInspection(sfc,operation, stepId, Constants.INSPECTION_TYPE_S);
@ -298,15 +314,26 @@ public class PodTemplateServiceImpl implements PodTemplateService {
paramMap.put("CATEGORY",Constants.INSPECTION_TYPE_S);
inspectionTaskService.createTask(paramMap);
}
//计算工时
LocalDateTime startTime = sfcService.getSfcStartTime(HandleEnum.SFC.getHandle(site, sfc));
long workHourSeconds = Duration.between(startTime, LocalDateTime.now()).getSeconds();
BigDecimal workHour = new BigDecimal(workHourSeconds).divide(BigDecimal.valueOf(3600), 2, RoundingMode.HALF_UP);
postMap.put("sfc",sfc);
postMap.put("stepId",stepId);
postMap.put("qty",qty);
postMap.put("scrapQty",BigDecimal.ZERO);
postMap.put("workHour",workHour);
postMapList.add(postMap);
sfcCrossService.completeAction(site, currentRevisionRef.getHandle(), resrce, sfcServiceById.getHandle(), qty);
//更改派工单状态
sfcDispatchCommonService.updateSfcDispatchStatus(site, CommonMethods.getUser(), dispatchNo, DispatchStatusEnum.COMPLETE.getCode());
//报工
//sendErp(sfc, stepId, qty,BigDecimal.ZERO);
} catch (Exception e) {
ExceptionUtil.throwException(e);
}
}
//报工
//sendErp(postMapList);
}
public void materialConsumption(String site, String operation, String sfcBo, String stepId, String resource) {
@ -399,40 +426,48 @@ public class PodTemplateServiceImpl implements PodTemplateService {
}
@Override
public void sendErp(String sfc, String stepId, BigDecimal qty, BigDecimal scrapQty) {
Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(CommonMethods.getSite(),sfc));
String shopOrderBo = sfcServiceById.getShopOrderBo();
String shopOrder = StringUtil.trimHandle(shopOrderBo);
public void sendErp(List<Map<String,Object>> postMapList) {
//请求参数
ZprodordconfStruIn[] ins = new ZprodordconfStruIn[1];
for (int i=0;i<postMapList.size();i++){
Map<String, Object> map = postMapList.get(i);
String sfc = (String)map.get("sfc");
Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(CommonMethods.getSite(),sfc));
String shopOrderBo = sfcServiceById.getShopOrderBo();
String shopOrder = StringUtil.trimHandle(shopOrderBo);
String stepId = (String)map.get("stepId");
BigDecimal qty = (BigDecimal) map.get("qty");
BigDecimal scrapQty = (BigDecimal)map.get("scrapQty");
BigDecimal workHour = (BigDecimal)map.get("workHour");
ZprodordconfStruIn struIn = new ZprodordconfStruIn();
//生产订单
struIn.setAufnr(shopOrder);
//步骤标示
struIn.setVornr(stepId);
struIn.setAueru("1");
//良品数量
struIn.setLmnga(qty);
//报废数量
struIn.setXmnga(scrapQty);
//机器工时
struIn.setIsm01(workHour);
//人工工时
struIn.setIsm02(workHour);
struIn.setIsm03(BigDecimal.ZERO);
struIn.setIsm04(BigDecimal.ZERO);
struIn.setIsm05(BigDecimal.ZERO);
struIn.setIsm06(BigDecimal.ZERO);
ins[i] = struIn;
}
ZprodordconfStruIn struIn = new ZprodordconfStruIn();
//生产订单
struIn.setAufnr(shopOrder);
//步骤标示
struIn.setVornr(stepId);
struIn.setAueru("1");
//良品数量
struIn.setLmnga(qty);
//报废数量
struIn.setXmnga(scrapQty);
//机器工时
struIn.setIsm01(BigDecimal.ZERO);
//人工工时
struIn.setIsm02(BigDecimal.ZERO);
struIn.setIsm03(BigDecimal.ZERO);
struIn.setIsm04(BigDecimal.ZERO);
struIn.setIsm05(BigDecimal.ZERO);
struIn.setIsm06(BigDecimal.ZERO);
ins[0] = struIn;
TableOfZprodordconfStruInHolder inHolder = new TableOfZprodordconfStruInHolder(ins);
//返回对象
ZprodordconfStruOut[] outs = new ZprodordconfStruOut[1];
ZprodordconfStruOut struOut = new ZprodordconfStruOut();
struOut.setAufnr(shopOrder);
struOut.setVornr(stepId);
struOut.setAufnr("");
struOut.setVornr("");
struOut.setAueru("1");
struOut.setLmnga(new BigDecimal(1));
struOut.setRet("");
@ -455,10 +490,10 @@ public class PodTemplateServiceImpl implements PodTemplateService {
log.setHandle(UUID.randomUUID().toString());
log.setSite(CommonMethods.getSite());
log.setIntegrationType(IntegrationTypeConstant.ROUTER);
log.setCategory("SEND");
log.setCategory("REQUEST");
log.setIntegrationWay("ERP");
log.setIntegrationMethod("erpWebService.zmesProdordconf");
log.setParam(struIn.toString());
log.setParam(ins.toString());
log.setStatus(outHolder.value[1].getRet());
log.setResultMessage(outHolder.value[1].getMsg());
log.setTransactionId("");

@ -82,6 +82,9 @@ public class SelfReportServiceImpl extends ServiceImpl<SelfReportMapper, SelfRep
String sfc = (String)map.get("sfc");
String resrce = (String)map.get("resrce");
String ncQty = (String)map.get("ncQty");
if (StringUtil.isBlank(ncQty)){
throw new BaseException("不良件数不能为空");
}
String comments = (String)map.get("comments");
String location=(String)map.get("location");
String userGroup=(String)map.get("userGroup");
@ -95,6 +98,10 @@ public class SelfReportServiceImpl extends ServiceImpl<SelfReportMapper, SelfRep
if (sfcData == null) {
throw new BaseException("根据当前资源未找到条码[" + sfc + "]的基本信息!");
}
BigDecimal sfcQty = (BigDecimal) sfcData.get("SFC_QTY");
if (new BigDecimal(ncQty).compareTo(sfcQty)>0 ){
throw new BaseException("不良总数超过产品批次数量");
}
String operationStep = (String)sfcData.get("OPERATION_STEP");
String shopOrder = (String)sfcData.get("SHOP_ORDER");
String item = (String)sfcData.get("ITEM");

@ -0,0 +1,43 @@
package com.foreverwin.mesnac.quartz.job;
import com.foreverwin.mesnac.common.service.ProdReadyTaskService;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.modular.core.exception.BaseException;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description TODO
* @Author Philip
* @Since 2021-08-06
*/
@DisallowConcurrentExecution
public class ProdUnReadySendMsgJob implements Job {
private static final String SITE_UPPERCASE = "SITE";
private static final String SITE_LOWERCASE = "site";
@Autowired
private ProdReadyTaskService prodReadyTaskService;
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
//获取站点,若站点为空则抛出异常
String site = getSite(context);
if (StringUtil.isBlank(site)) {
throw new BaseException("anomaly.quartz.task.not.site", null);
}
prodReadyTaskService.sendMsgJob(site);
}
private String getSite(JobExecutionContext context) {
String site = context.getJobDetail().getJobDataMap().getString(SITE_LOWERCASE);
if (StringUtil.isBlank(site)) {
site = context.getJobDetail().getJobDataMap().getString(SITE_UPPERCASE);
}
return site;
}
}
Loading…
Cancel
Save