diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalPlanController.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalPlanController.java new file mode 100644 index 00000000..b9a683ba --- /dev/null +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalPlanController.java @@ -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 result; + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(abnormalPlan); + result = abnormalPlanService.list(queryWrapper); + return R.ok(result); + } + + /** + * 分页查询数据 + * + * @param frontPage 分页信息 + * @return + */ + @ResponseBody + @GetMapping("/page") + public R page(FrontPage frontPage, AbnormalPlan abnormalPlan){ + IPage result; + QueryWrapper 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 ids){ + return R.ok(abnormalPlanService.removeByIds(ids)); + } +} \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalPlanMapper.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalPlanMapper.java new file mode 100644 index 00000000..503ae4d3 --- /dev/null +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalPlanMapper.java @@ -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; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zjw + * @since 2021-08-07 + */ +@Repository +public interface AbnormalPlanMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalPlan.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalPlan.java new file mode 100644 index 00000000..d718d623 --- /dev/null +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalPlan.java @@ -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; + +/** + *

+ * + *

+ * + * @author zjw + * @since 2021-08-07 + */ + +@TableName("Z_ABNORMAL_PLAN") + +public class AbnormalPlan extends Model { + + 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 + + "}"; + } +} \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalPlanService.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalPlanService.java new file mode 100644 index 00000000..401eff8b --- /dev/null +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalPlanService.java @@ -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; + +/** + *

+ * 服务类 + *

+ * + * @author zjw + * @since 2021-08-07 + */ +public interface AbnormalPlanService extends IService { + + /** + * 分页查询 + * @param frontPage + * @return + */ + IPage selectPage(FrontPage frontPage, AbnormalPlan abnormalPlan); + + List selectList(AbnormalPlan abnormalPlan); + + void saveAbnormalPlan(AbnormalBillDisposeDto abnormalBillDisposeDto, LocalDateTime now); +} \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java index 8978e5da..f06e58e2 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java @@ -142,6 +142,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl selectPage(FrontPage frontPage, AbnormalBill abnormalBill) { @@ -359,7 +362,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl hashMap = new HashMap<>(); @@ -776,7 +785,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl + * 服务实现类 + *

+ * + * @author zjw + * @since 2021-08-07 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class AbnormalPlanServiceImpl extends ServiceImpl implements AbnormalPlanService { + + + @Autowired + private AbnormalPlanMapper abnormalPlanMapper; + + @Override + public IPage selectPage(FrontPage frontPage, AbnormalPlan abnormalPlan) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(abnormalPlan); + return super.page(frontPage.getPagePlus(), queryWrapper); + } + + @Override + public List selectList(AbnormalPlan abnormalPlan) { + QueryWrapper 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); + } + +} \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AnomalyJobServiceImpl.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AnomalyJobServiceImpl.java index 38e29b7d..72df1bc8 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AnomalyJobServiceImpl.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AnomalyJobServiceImpl.java @@ -129,7 +129,7 @@ public class AnomalyJobServiceImpl implements AnomalyJobService { activeMQUtil.wechatSendMessage(sendUsers.toString(),abnormalMessage.getContent()); // } messageService.saveOrUpdate(abnormalMessage); - messageService.saveOrUpdate(_abnormalMessage); + // messageService.saveOrUpdate(_abnormalMessage); } } } diff --git a/anomaly/src/main/resources/mapper/AbnormalPlanMapper.xml b/anomaly/src/main/resources/mapper/AbnormalPlanMapper.xml new file mode 100644 index 00000000..40c3bd1b --- /dev/null +++ b/anomaly/src/main/resources/mapper/AbnormalPlanMapper.xml @@ -0,0 +1,530 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO Z_ABNORMAL_PLAN + + 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, + VALUES + + #{handle}, + #{site}, + #{abnormalBillBo}, + #{status}, + #{workCenter}, + #{abnormalMethod}, + #{shopOrder}, + #{resrce}, + #{itemBo}, + #{qty}, + #{processor}, + #{processDateTime}, + #{closedUser}, + #{closedDateTime}, + #{createdUser}, + #{createdDateTime}, + #{modifiedUser}, + #{modifiedDateTime}, + + + + + INSERT INTO Z_ABNORMAL_PLAN + + + VALUES + + #{handle}, + #{site}, + #{abnormalBillBo}, + #{status}, + #{workCenter}, + #{abnormalMethod}, + #{shopOrder}, + #{resrce}, + #{itemBo}, + #{qty}, + #{processor}, + #{processDateTime}, + #{closedUser}, + #{closedDateTime}, + #{createdUser}, + #{createdDateTime}, + #{modifiedUser}, + #{modifiedDateTime}, + + + + + + UPDATE Z_ABNORMAL_PLAN + 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}, + WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL} + + + + + UPDATE Z_ABNORMAL_PLAN + 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}, + WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL} + + + + + UPDATE Z_ABNORMAL_PLAN + 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}, + + + + + HANDLE=#{ew.entity.handle} + AND SITE=#{ew.entity.site} + AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo} + AND STATUS=#{ew.entity.status} + AND WORK_CENTER=#{ew.entity.workCenter} + AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod} + AND SHOP_ORDER=#{ew.entity.shopOrder} + AND RESRCE=#{ew.entity.resrce} + AND ITEM_BO=#{ew.entity.itemBo} + AND QTY=#{ew.entity.qty} + AND PROCESSOR=#{ew.entity.processor} + AND PROCESS_DATE_TIME=#{ew.entity.processDateTime} + AND CLOSED_USER=#{ew.entity.closedUser} + AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime} + AND CREATED_USER=#{ew.entity.createdUser} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND MODIFIED_USER=#{ew.entity.modifiedUser} + AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + DELETE FROM Z_ABNORMAL_PLAN WHERE HANDLE=#{handle} + + + + DELETE FROM Z_ABNORMAL_PLAN + + + + + ${k} = #{cm[${k}]} + + + + + + + + DELETE FROM Z_ABNORMAL_PLAN + + + + + HANDLE=#{ew.entity.handle} + + AND SITE=#{ew.entity.site} + AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo} + AND STATUS=#{ew.entity.status} + AND WORK_CENTER=#{ew.entity.workCenter} + AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod} + AND SHOP_ORDER=#{ew.entity.shopOrder} + AND RESRCE=#{ew.entity.resrce} + AND ITEM_BO=#{ew.entity.itemBo} + AND QTY=#{ew.entity.qty} + AND PROCESSOR=#{ew.entity.processor} + AND PROCESS_DATE_TIME=#{ew.entity.processDateTime} + AND CLOSED_USER=#{ew.entity.closedUser} + AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime} + AND CREATED_USER=#{ew.entity.createdUser} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND MODIFIED_USER=#{ew.entity.modifiedUser} + AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + DELETE FROM Z_ABNORMAL_PLAN WHERE HANDLE IN ( + #{item} + ) + + + + diff --git a/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java b/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java index 31e2ec81..a31535a0 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java @@ -167,5 +167,11 @@ public interface Constants { String TOOL_STATUS_Y = "Y"; String TOOL_STATUS_N = "N"; + /** + * 异常计划表的状态 + */ + String UNTREATED = "UNTREATED"; //未处理 + String PROCESSED = "PROCESSED"; //已处理 + } diff --git a/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java b/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java index 43d119fc..7a72e34a 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java @@ -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; diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/UserResourceHandler.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/UserResourceHandler.java index 7e52648c..65043a50 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/UserResourceHandler.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/UserResourceHandler.java @@ -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; } }