员工资源导入+产品报废

master
赵嘉伟 4 years ago
parent b81b0fa1d5
commit 895046da7d

@ -7,7 +7,6 @@ import com.foreverwin.mesnac.anomaly.model.AbnormalBill;
import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose;
import com.foreverwin.mesnac.anomaly.service.AbnormalBillService;
import com.foreverwin.mesnac.anomaly.service.FileUploadedService;
import com.foreverwin.mesnac.anomaly.service.ProductionScrap;
import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
import com.foreverwin.mesnac.meapi.service.NcCodeService;
@ -39,8 +38,7 @@ public class AbnormalBillController {
@Autowired
private FileUploadedService fileUploadedService;
@Autowired
private ProductionScrap productionScrap;
@Autowired
private NcCodeService ncCodeService;
@ -342,16 +340,6 @@ public class AbnormalBillController {
return R.ok(abnormalBillService.anomalyReveseRepair(abnormalBill,abnormalBillDispose));
}
/**
*
* @param site
* @param sfc
* @return
*/
@GetMapping("/getScrapDtoBysfc")
public R getScrapDtoBysfc(String site,String sfc){
return R.ok(productionScrap.getScrapDtoBysfc(site,sfc));
}
@GetMapping("/findNcCodeDescriptionByNcCode")

@ -2,8 +2,8 @@ package com.foreverwin.mesnac.anomaly.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDto;
import com.foreverwin.mesnac.anomaly.dto.ScrapDto;
import com.foreverwin.mesnac.anomaly.model.AbnormalBill;
import com.foreverwin.mesnac.common.dto.ScrapDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@ -34,5 +34,5 @@ public interface AbnormalBillMapper extends BaseMapper<AbnormalBill> {
Integer findAbnormalMethodBySFC(@Param("site")String site,@Param("sfc")String sfc);
List<ScrapDto> findScrapDtoBySfc(@Param("site")String site,@Param("sfc")String sfc);
List<ScrapDto> findScrapDtoBySfc(@Param("site")String site, @Param("sfc")String sfc);
}

@ -1,24 +1,10 @@
package com.foreverwin.mesnac.anomaly.service;
import com.foreverwin.mesnac.anomaly.dto.ScrapDto;
import java.util.List;
/**
* @Description TODO
* @Author zhaojiawei
* @Since 2021-07-28
*/
public interface ProductionScrap {
/**
*
* @param sfc
* @return
*/
boolean jgProductionIsScrap(String site,String sfc);
/**
*
*/
List<ScrapDto> getScrapDtoBysfc(String site,String sfc);
}

@ -13,6 +13,7 @@ import com.foreverwin.mesnac.anomaly.model.*;
import com.foreverwin.mesnac.anomaly.service.*;
import com.foreverwin.mesnac.anomaly.util.ActiveMQUtil;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.dto.ScrapDto;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.helper.NextNumberHelper;
import com.foreverwin.mesnac.common.service.AnomalyService;
@ -22,6 +23,7 @@ import com.foreverwin.mesnac.meapi.mapper.*;
import com.foreverwin.mesnac.meapi.model.*;
import com.foreverwin.mesnac.meapi.service.*;
import com.foreverwin.mesnac.meapi.util.StringUtils;
import com.foreverwin.mesnac.production.mapper.SfcScrapMapper;
import com.foreverwin.mesnac.quality.service.SelfReportService;
import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.exception.BusinessException;
@ -135,6 +137,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Autowired
private SelfReportService selfReportService;
@Autowired
private SfcScrapMapper sfcScrapMapper;
@Override
public IPage<AbnormalBill> selectPage(FrontPage<AbnormalBill> frontPage, AbnormalBill abnormalBill) {
@ -290,7 +295,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
nwaUser.setSite(site);
nwaUser.setUserName(CommonMethods.getUser());
List<NwaUser> nwaUsers = nwaUserService.selectList(nwaUser);
if(nwaUsers != null){
if(nwaUsers != null && nwaUsers.size() > 0){
hashMap.put("currentUser",nwaUsers.get(0).getFullName());
}
//初始化异常单号
@ -1011,4 +1016,29 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Override
public boolean jgProductionIsScrap(String site,String sfc) {
//查询该sfc在质量异常异常方案是否是报废,如果是则大于1
Integer num = abnormalBillMapper.findAbnormalMethodBySFC(site, sfc);
return num <= 0;
}
@Override
public List<ScrapDto> getScrapDtoBysfc(String site, String sfc) {
//判断该产品条码是否已经报废
if(sfcScrapMapper.selectById(HandleEnum.SFC_SCRAP.getHandle(site,sfc)) != null){
throw new BaseException("该产品条码已经报废");
}
if(this.jgProductionIsScrap(site,sfc)){
throw new BaseException("该产品条码的异常方案不是报废");
}
return abnormalBillMapper.findScrapDtoBySfc(site, sfc);
}
}

@ -1,16 +1,9 @@
package com.foreverwin.mesnac.anomaly.service.impl;
import com.foreverwin.mesnac.anomaly.dto.ScrapDto;
import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillMapper;
import com.foreverwin.mesnac.anomaly.service.AbnormalBillService;
import com.foreverwin.mesnac.anomaly.service.ProductionScrap;
import com.foreverwin.modular.core.exception.BaseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @Description TODO
* @Author zhaojiawei
@ -20,24 +13,4 @@ import java.util.List;
@Transactional(rollbackFor = Exception.class)
public class ProductionScrapImpl implements ProductionScrap {
@Autowired
private AbnormalBillService abnormalBillService;
@Autowired
private AbnormalBillMapper abnormalBillMapper;
@Override
public boolean jgProductionIsScrap(String site,String sfc) {
//查询该sfc在质量异常异常方案是否是报废,如果是则大于1
Integer num = abnormalBillMapper.findAbnormalMethodBySFC(site, sfc);
return num <= 0;
}
@Override
public List<ScrapDto> getScrapDtoBysfc(String site,String sfc) {
if(this.jgProductionIsScrap(site,sfc)){
throw new BaseException("该产品条码的异常方案不是报废");
}
return abnormalBillMapper.findScrapDtoBySfc(site, sfc);
}
}

@ -641,7 +641,7 @@
LEFT JOIN CUSTOM_FIELDS "MAP" ON "MAP".HANDLE = SO.HANDLE AND "MAP"."ATTRIBUTE" = 'MAP'
LEFT JOIN Z_ABNORMAL_NC_CODE ZANC ON ZAB.HANDLE = ZANC.ABNORMAL_BILL_BO
LEFT JOIN NC_CODE_T NCT ON ('NCCodeBO:' || ZAB.SITE || ',' || ZANC.NC_CODE) = NCT.NC_CODE_BO AND NCT.LOCALE = #{language}
INNER JOIN Z_NWA_USER NWA ON NWA.USER_NAME = ZAB.PB_USER AND NWA.SITE = ZAB.SITE
LEFT JOIN Z_NWA_USER NWA ON NWA.USER_NAME = ZAB.PB_USER AND NWA.SITE = ZAB.SITE
LEFT JOIN NC_GROUP NG ON NG.NC_GROUP = ZANC.NC_CODE_GROUP AND NG.SITE = ZAB.SITE
LEFT JOIN ROUTER R ON SUBSTR(R.HANDLE,1,INSTR(R.HANDLE,',',-1)-1) = SUBSTR(ZABD.ROUTER_BO,1,INSTR(ZABD.ROUTER_BO,',',-1)-1) AND R.CURRENT_REVISION = 'true'
<where>

@ -58,7 +58,7 @@
<result column="REPORT_SEND_USER_GROUP" property="reportSendUserGroup"/>
</resultMap>
<resultMap id="scrapDto" type="com.foreverwin.mesnac.anomaly.dto.ScrapDto" >
<resultMap id="scrapDto" type="com.foreverwin.mesnac.common.dto.ScrapDto" >
<result column="SFC" property="sfc"/>
<result column="STATUS" property="status"/>
<result column="OPERATION" property="operation"/>

@ -1,4 +1,4 @@
package com.foreverwin.mesnac.anomaly.dto;
package com.foreverwin.mesnac.common.dto;
/**
* @Description TODO
@ -6,7 +6,6 @@ package com.foreverwin.mesnac.anomaly.dto;
* @Since 2021-07-28
*/
public class ScrapDto {
private String sfc;
private String status;

@ -136,7 +136,11 @@ public enum HandleEnum {
/**用户**/
USR("UserBO","UserBO:{0},{1}"),
TOOL("ToolBO","ToolBO:{0},{1}");
TOOL("ToolBO","ToolBO:{0},{1}"),
USER_RESOURCE("UserResourceBo","UserResourceBo:{0},{1},{2}"),
SFC_SCRAP("SfcScrapBo","SfcScrapBo:{0},{1}");
private String prefix;
private String pattern;

@ -1,5 +1,9 @@
package com.foreverwin.mesnac.common.service;
import com.foreverwin.mesnac.common.dto.ScrapDto;
import java.util.List;
/**
* @Description TODO
* @Author zhaojiawei
@ -20,4 +24,16 @@ public interface AnomalyService {
void createAnomalyTask(String category, String resource, String shopOrder,
String sfc, String ncCodes,String position,String ncQty,
String ncDescription,String userGroup);
/**
*
* @param sfc
* @return
*/
boolean jgProductionIsScrap(String site,String sfc);
/**
*
*/
List<ScrapDto> getScrapDtoBysfc(String site, String sfc);
}

@ -67,5 +67,9 @@
<groupId>com.foreverwin.mesnac</groupId>
<artifactId>meapi</artifactId>
</dependency>
<dependency>
<groupId>com.foreverwin.mesnac</groupId>
<artifactId>dispatch</artifactId>
</dependency>
</dependencies>
</project>

@ -0,0 +1,185 @@
package com.foreverwin.mesnac.dataimport.handler;
import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.dataimport.handler.base.BaseHandler;
import com.foreverwin.mesnac.dataimport.reader.FileReader;
import com.foreverwin.mesnac.dataimport.reader.FileReaderBuilder;
import com.foreverwin.mesnac.dataimport.reader.RowVisitor;
import com.foreverwin.mesnac.dataimport.service.MasterObjectDefine;
import com.foreverwin.mesnac.dataimport.util.AppUtil;
import com.foreverwin.mesnac.dispatch.mapper.UserResourceMapper;
import com.foreverwin.mesnac.dispatch.model.UserResource;
import com.foreverwin.mesnac.dispatch.service.UserResourceService;
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;
import java.io.InputStream;
import java.time.LocalDateTime;
import java.util.Map;
/**
* @Description TODO
* @Author zhaojiawei
* @Since 2021-07-29
*/
public class UserResourceHandler extends BaseHandler {
@Autowired
private UserResourceMapper userResourceMapper;
@Autowired
private UserResourceService userResourceService;
@Override
public String importFile(String site, InputStream inputStream, String fileType, String mode) throws Exception {
int row = 0;
StringBuffer buffer = new StringBuffer();
Integer[] failedNumber = new Integer[]{0};
try {
FileReader fileReader = new FileReaderBuilder().build(fileType);
RowVisitor<JSONObject> visitor = getRowVisitor(site, mode, buffer, failedNumber);
row = fileReader.visitor(visitor).read(inputStream, getHeaders());
} catch (Exception e) {
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());
}
buffer.insert(0, I18nUtil.getI18nText("MaterData.import.Summary", new Object[]{row + failedNumber[0], row, failedNumber[0]}) + "\n");
return buffer.toString();
}
@Override
public Map<String, String> getHeaders() {
return MasterObjectDefine.getHeadsMapping("USER_RESOURCE");
}
public RowVisitor<JSONObject> getRowVisitor(String site, String mode, StringBuffer buffer, Integer[] failedNumber) {
return new RowVisitor<JSONObject>() {
@Override
public int visit(long index, JSONObject jsonObject) {
LocalDateTime now = LocalDateTime.now();
String user = CommonMethods.getUser();
String resrce = StringUtil.toString(jsonObject.getString(jsonObject.getString("resrce")));
String resrceDescription = StringUtil.toString(jsonObject.getString(jsonObject.getString("resrceDescription")));
String userId = StringUtil.toString(jsonObject.getString(jsonObject.getString("userId")));
String userDescription = StringUtil.toString(jsonObject.getString(jsonObject.getString("userDescription")));
String temporaryUser = StringUtil.toString(jsonObject.getString(jsonObject.getString("temporaryUser")));
String status = StringUtil.toString(jsonObject.getString(jsonObject.getString("status")));
UserResource userResource = new UserResource();
userResource.setHandle(HandleEnum.USER_RESOURCE.getHandle(site, resrce, userId));
userResource.setSite(site);
userResource.setResourceBo(HandleEnum.RESOURCE.getHandle(site,resrce));
userResource.setResrce(resrce);
userResource.setResrceDescription(resrceDescription);
userResource.setUserId(userId);
userResource.setUserDescription(userDescription);
if("Y".equals(temporaryUser)){
userResource.setTemporaryUser("true");
}else {
userResource.setTemporaryUser("false");
}
if("Y".equals(status)){
userResource.setStatus("true");
}else {
userResource.setStatus("false");
}
UserResource result = userResourceMapper.selectById(userResource.getHandle());
if(result == null){
userResource.setCreatedUser(user);
userResource.setCreatedDateTime(now);
}
userResource.setModifiedUser(user);
userResource.setModifiedDateTime(now);
Object[] params = new Object[10];
//错误信息提示
params[0] = index;
params[1] = resrce;
boolean insert = false;
try {
//如果资源为空或者员工编号为空,则直接跳过
if (StringUtil.notEmpty(resrce) && StringUtil.notEmpty(userId)) {
//站点
jsonObject.put("site", site);
//错误提示信息
boolean resultMessage = false;
// WorkCenterFullConfiguration result = WorkCenterWSClient.find(jsonObject);
if (result != null) {
if (AppUtil.canUpdate(mode)) {
resultMessage = this.update(userResource);
if (resultMessage) {
return 1;
}
}else{
throw BusinessException.build("第"+index+"行的数据不存在,不能更新,应该选更新插入");
}
} else {
if (AppUtil.canInsert(mode)) {
insert = true;
// resultMessage = WorkCenterWSClient.insert(userResource);
// if (resultMessage == null) {
// return 1;
// }
} else if (AppUtil.canUpdate(mode)) {
//resultMessage = "第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.upDateObjectNotExist") + "\n";
}
}
// if (resultMessage != null) {
// params[2] = resultMessage;
// failedNumber[0]++;
// if (insert) {
// buffer.append("第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.insertfail.workcenter", params) + "\n");
// } else {
// buffer.append("第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.updatefail.workcenter", params) + "\n");
// }
// }
}
return 0;
} catch (Exception e) {
params[2] = e.getMessage();
failedNumber[0]++;
if (insert) {
buffer.append("第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.insertfail.workcenter", new Object[]{e.getMessage()}) + "\n");
} else {
buffer.append("第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.updatefail.workcenter", new Object[]{e.getMessage()}) + "\n");
}
}
return 0;
}
@Override
public String[] getHeader() {
return null;
}
boolean update(UserResource userResource){
return false;
}
};
}
}

@ -176,6 +176,15 @@ public class MasterObjectDefine {
cvsHeadsMapping.put("remark","备注");
break;
case "USER_RESOURCE":
cvsHeadsMapping.put("resrce","资源编码");
cvsHeadsMapping.put("resrceDescription","资源描述");
cvsHeadsMapping.put("userId","员工编号");
cvsHeadsMapping.put("userDescription","员工姓名");
cvsHeadsMapping.put("temporaryUser","是否临时员工");
cvsHeadsMapping.put("status","是否有效");
break;
default:
break;
}

@ -0,0 +1,153 @@
package com.foreverwin.mesnac.production.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.common.service.AnomalyService;
import com.foreverwin.mesnac.production.model.SfcScrap;
import com.foreverwin.mesnac.production.service.SfcScrapService;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
/**
*
* @author zjw
* @since 2021-07-30
*/
@RestController
@RequestMapping("/Z-SFC-SCRAP")
public class SfcScrapController {
@Autowired
public SfcScrapService sfcScrapService;
@Autowired
private AnomalyService anomalyService;
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getSfcScrapById(@PathVariable String id) {
return R.ok( sfcScrapService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getSfcScrapList(SfcScrap sfcScrap){
List<SfcScrap> result;
QueryWrapper<SfcScrap> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(sfcScrap);
result = sfcScrapService.list(queryWrapper);
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<SfcScrap> frontPage, SfcScrap sfcScrap){
IPage result;
QueryWrapper<SfcScrap> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(sfcScrap);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(SfcScrap::getHandle, frontPage.getGlobalQuery())
.or().like(SfcScrap::getSite, frontPage.getGlobalQuery())
.or().like(SfcScrap::getSfc, frontPage.getGlobalQuery())
.or().like(SfcScrap::getOperation, frontPage.getGlobalQuery())
.or().like(SfcScrap::getStepId, frontPage.getGlobalQuery())
.or().like(SfcScrap::getType, frontPage.getGlobalQuery())
.or().like(SfcScrap::getReason, frontPage.getGlobalQuery())
.or().like(SfcScrap::getCreatedUser, frontPage.getGlobalQuery())
.or().like(SfcScrap::getModifiedUser, frontPage.getGlobalQuery())
);
}
result = sfcScrapService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param sfcScrap
* @return null
*/
@PostMapping
public R save(@RequestBody SfcScrap sfcScrap) {
return R.ok(sfcScrapService.save(sfcScrap));
}
/**
*
* @param sfcScrap
* @return null
*/
@PutMapping
public R updateById(@RequestBody SfcScrap sfcScrap) {
return R.ok(sfcScrapService.updateById(sfcScrap));
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(sfcScrapService.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(sfcScrapService.removeByIds(ids));
}
/**
*
* @param site
* @param sfc
* @return
*/
@GetMapping("/getScrapDtoBysfc")
public R getScrapDtoBysfc(String site,String sfc){
return R.ok(anomalyService.getScrapDtoBysfc(site,sfc));
}
/**
*
* @param sfcScrap
* @return
*/
@PostMapping("/scrap")
public R scrap(@RequestBody HashMap<String,Object> param){
return R.ok(sfcScrapService.scrap(param));
}
}

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

@ -0,0 +1,232 @@
package com.foreverwin.mesnac.production.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author zjw
* @since 2021-07-30
*/
@TableName("Z_SFC_SCRAP")
public class SfcScrap extends Model<SfcScrap> {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "HANDLE", type = IdType.INPUT)
private String handle;
/**
*
*/
@TableField("SITE")
private String site;
/**
*
*/
@TableField("SFC")
private String sfc;
/**
*
*/
@TableField("OPERATION")
private String operation;
/**
*
*/
@TableField("STEP_ID")
private String stepId;
/**
*
*/
@TableField("QTY")
private Double qty;
/**
*
*/
@TableField("TYPE")
private String type;
/**
*
*/
@TableField("REASON")
private String reason;
/**
*
*/
@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 getSfc() {
return sfc;
}
public void setSfc(String sfc) {
this.sfc = sfc;
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
public String getStepId() {
return stepId;
}
public void setStepId(String stepId) {
this.stepId = stepId;
}
public Double getQty() {
return qty;
}
public void setQty(Double qty) {
this.qty = qty;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
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 SFC = "SFC";
public static final String OPERATION = "OPERATION";
public static final String STEP_ID = "STEP_ID";
public static final String QTY = "QTY";
public static final String TYPE = "TYPE";
public static final String REASON = "REASON";
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 "SfcScrap{" +
"handle = " + handle +
", site = " + site +
", sfc = " + sfc +
", operation = " + operation +
", stepId = " + stepId +
", qty = " + qty +
", type = " + type +
", reason = " + reason +
", createdUser = " + createdUser +
", createdDateTime = " + createdDateTime +
", modifiedUser = " + modifiedUser +
", modifiedDateTime = " + modifiedDateTime +
"}";
}
}

@ -0,0 +1,32 @@
package com.foreverwin.mesnac.production.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.mesnac.production.model.SfcScrap;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.HashMap;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author zjw
* @since 2021-07-30
*/
public interface SfcScrapService extends IService<SfcScrap> {
/**
*
* @param frontPage
* @return
*/
IPage<SfcScrap> selectPage(FrontPage<SfcScrap> frontPage, SfcScrap sfcScrap);
List<SfcScrap> selectList(SfcScrap sfcScrap);
List<SfcScrap> scrap(HashMap<String,Object> param) ;
}

@ -0,0 +1,148 @@
package com.foreverwin.mesnac.production.service.impl;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray;
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.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.mapper.SfcMapper;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.foreverwin.mesnac.production.mapper.SfcScrapMapper;
import com.foreverwin.mesnac.production.model.SfcScrap;
import com.foreverwin.mesnac.production.service.PodTemplateService;
import com.foreverwin.mesnac.production.service.SfcScrapService;
import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.meext.MEServices;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import com.sap.me.production.ScrapDeleteServiceInterface;
import com.sap.me.production.ScrapSfcRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author zjw
* @since 2021-07-30
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class SfcScrapServiceImpl extends ServiceImpl<SfcScrapMapper, SfcScrap> implements SfcScrapService {
@Autowired
private SfcScrapMapper sfcScrapMapper;
@Autowired
private SfcMapper sfcMapper;
@Autowired
private PodTemplateService podTemplateService;
@Override
public IPage<SfcScrap> selectPage(FrontPage<SfcScrap> frontPage, SfcScrap sfcScrap) {
QueryWrapper<SfcScrap> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(sfcScrap);
return super.page(frontPage.getPagePlus(), queryWrapper);
}
@Override
public List<SfcScrap> selectList(SfcScrap sfcScrap) {
QueryWrapper<SfcScrap> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(sfcScrap);
return super.list(queryWrapper);
}
@Override
public List<SfcScrap> scrap(HashMap<String,Object> param) {
String user = CommonMethods.getUser();
LocalDateTime now = LocalDateTime.now();
String reason = (String)param.get("reason");
String site = (String)param.get("site");
//类型
List<String> _type = (List<String>)param.get("type");
StringBuilder type = new StringBuilder();
for (int i = 0; i < _type.size(); i++) {
if(i == _type.size() - 1){
type.append(_type.get(i));
}else{
type.append(_type.get(i)).append(",");
}
}
String str = JSONUtil.toJsonStr(param.get("sfcScrap"));
List<SfcScrap> _sfcScrapList = JSONArray.parseArray(str, SfcScrap.class);
List<SfcScrap> sfcScrapsList = new ArrayList<>();
ScrapDeleteServiceInterface scrapDeleteServiceInterface = null;
//mes的公共接口
try{
scrapDeleteServiceInterface = MEServices.create("com.sap.me.production", "ScrapDeleteService", CommonMethods.getSite());
}catch (Exception e){
throw new BaseException("调用mes公共接口失败"+e.getMessage());
}
for (SfcScrap sfcScraps :
_sfcScrapList) {
SfcScrap sfcScrap = new SfcScrap();
sfcScrap.setHandle(HandleEnum.SFC_SCRAP.getHandle(site,sfcScraps.getSfc()));
sfcScrap.setSite(site);
sfcScrap.setSfc(sfcScraps.getSfc());
//设置数量用,并判断该sfc是否有效
Sfc sfc = sfcMapper.selectById(HandleEnum.SFC.getHandle(site,sfcScrap.getSfc()));
if(sfc == null){
throw new BaseException("该sfc不存在不能报废");
}
if(!StringUtil.isBlank(sfcScraps.getOperation())){
String[] split = sfcScraps.getOperation().split("/");
sfcScrap.setOperation(split[0]);
sfcScrap.setStepId(split[1]);
}
sfcScrap.setType(type.toString());
sfcScrap.setReason(reason);
sfcScrap.setQty(sfc.getQty());
sfcScrap.setCreatedUser(user);
sfcScrap.setCreatedDateTime(now);
sfcScrap.setModifiedUser(user);
sfcScrap.setModifiedDateTime(now);
//向生产派工那边发送数据
// podTemplateService.sendErp(sfcScrap.getSfc(),sfcScrap.getStepId(),BigDecimal.valueOf(0L),BigDecimal.valueOf(sfcScrap.getQty()));
try{
//调用mes公共接口报废
ScrapSfcRequest scrapSfcRequest = new ScrapSfcRequest();
scrapSfcRequest.setSfcRef(sfc.getHandle());
scrapSfcRequest.setQuantity(BigDecimal.valueOf(sfcScrap.getQty()));
scrapDeleteServiceInterface.scrapSfc(scrapSfcRequest);
}catch (Exception e){
throw new BaseException("调用mes公共接口失败"+e.getMessage());
}
sfcScrapsList.add(sfcScrap);
}
//保存
this.saveBatch(sfcScrapsList);
return sfcScrapsList;
}
}

@ -0,0 +1,434 @@
<?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.production.mapper.SfcScrapMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.production.model.SfcScrap">
<id column="HANDLE" property="handle" />
<result column="SITE" property="site" />
<result column="SFC" property="sfc" />
<result column="OPERATION" property="operation" />
<result column="STEP_ID" property="stepId" />
<result column="QTY" property="qty" />
<result column="TYPE" property="type" />
<result column="REASON" property="reason" />
<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, SFC, OPERATION, STEP_ID, QTY, TYPE, REASON, 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_SFC_SCRAP WHERE HANDLE=#{handle}
</select>
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_SFC_SCRAP
<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_SFC_SCRAP 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_SFC_SCRAP
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</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_SFC_SCRAP
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</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_SFC_SCRAP
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</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_SFC_SCRAP
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</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_SFC_SCRAP
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</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_SFC_SCRAP
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</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_SFC_SCRAP
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</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.production.model.SfcScrap">
INSERT INTO Z_SFC_SCRAP
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="site!=null">SITE,</if>
<if test="sfc!=null">SFC,</if>
<if test="operation!=null">OPERATION,</if>
<if test="stepId!=null">STEP_ID,</if>
<if test="qty!=null">QTY,</if>
<if test="type!=null">TYPE,</if>
<if test="reason!=null">REASON,</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="sfc!=null">#{sfc},</if>
<if test="operation!=null">#{operation},</if>
<if test="stepId!=null">#{stepId},</if>
<if test="qty!=null">#{qty},</if>
<if test="type!=null">#{type},</if>
<if test="reason!=null">#{reason},</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.production.model.SfcScrap">
INSERT INTO Z_SFC_SCRAP
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{site},
#{sfc},
#{operation},
#{stepId},
#{qty},
#{type},
#{reason},
#{createdUser},
#{createdDateTime},
#{modifiedUser},
#{modifiedDateTime},
</trim>
</insert>
<update id="updateById">
UPDATE Z_SFC_SCRAP <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
<if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
<if test="et.qty!=null">QTY=#{et.qty},</if>
<if test="et.type!=null">TYPE=#{et.type},</if>
<if test="et.reason!=null">REASON=#{et.reason},</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_SFC_SCRAP <trim prefix="SET" suffixOverrides=",">
SITE=#{et.site},
SFC=#{et.sfc},
OPERATION=#{et.operation},
STEP_ID=#{et.stepId},
QTY=#{et.qty},
TYPE=#{et.type},
REASON=#{et.reason},
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_SFC_SCRAP <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
<if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
<if test="et.qty!=null">QTY=#{et.qty},</if>
<if test="et.type!=null">TYPE=#{et.type},</if>
<if test="et.reason!=null">REASON=#{et.reason},</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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</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_SFC_SCRAP WHERE HANDLE=#{handle}
</delete>
<delete id="deleteByMap">
DELETE FROM Z_SFC_SCRAP
<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_SFC_SCRAP
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</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_SFC_SCRAP WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
</mapper>
Loading…
Cancel
Save