Leon 4 years ago
commit 17630619e7

@ -21,15 +21,15 @@ import java.util.List;
/**
*
* @author robert
* @since 2021-07-05
* @author
* @since 2021-07-14
*/
@RestController
@RequestMapping("/Z-ABNORMAL-BILL")
public class AbnormalBillController {
@Autowired
private AbnormalBillService abnormalBillService;
public AbnormalBillService abnormalBillService;
@Autowired
private SfcDispatchCommonService sfcDispatchCommonService;
@ -41,10 +41,6 @@ public class AbnormalBillController {
public AnomalyService anomalyService;
/**
* id
*
@ -94,6 +90,7 @@ public class AbnormalBillController {
.or().like(AbnormalBill::getType, frontPage.getGlobalQuery())
.or().like(AbnormalBill::getItemBo, frontPage.getGlobalQuery())
.or().like(AbnormalBill::getSfc, frontPage.getGlobalQuery())
.or().like(AbnormalBill::getOperation, frontPage.getGlobalQuery())
.or().like(AbnormalBill::getWorkCenter, frontPage.getGlobalQuery())
.or().like(AbnormalBill::getShopOrder, frontPage.getGlobalQuery())
.or().like(AbnormalBill::getMessageType, frontPage.getGlobalQuery())
@ -176,10 +173,6 @@ public class AbnormalBillController {
return R.ok(abnormalBillService.init(messageType,type));
}
// @GetMapping("/findAllUserByUserGroup")
// public R findAllUserByUserGroup(String site, String userGroups){
// return R.ok();
// }
/**
*
@ -313,7 +306,9 @@ public class AbnormalBillController {
@PostMapping("/delete")
public R delete(String ftpPath,String fileName){
return R.ok(fileUploadedService.deleteFile(ftpPath,fileName));
fileUploadedService.deleteFile(ftpPath,fileName);
// abnormalBillService.deleteFileInDatabase(ftpPath,fileName);
return R.ok();
}
@GetMapping("/findUploadPictureByAbnormalBo")
@ -326,14 +321,10 @@ public class AbnormalBillController {
return R.ok(abnormalBillService.getNextNumber(type));
}
// @GetMapping("/test")
// public R test(String category, String resource, String shopOrder, String sfc, String ncCodes ){
// anomalyService.createAnomalyTask(category,resource,shopOrder,sfc,ncCodes);
// return R.ok();
// }
@GetMapping("/anomalyReveseRepair")
public R anomalyReveseRepair(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose){
public R anomalyReveseRepair(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose){
return R.ok(abnormalBillService.anomalyReveseRepair(abnormalBill,abnormalBillDispose));
}
}

@ -154,6 +154,17 @@ public class AbnormalBillDisposeDto extends AbnormalBillDispose {
*/
private String fullName;
/**
*
*/
private String operation;
/**
*
* @return
*/
private String ncCodeDescription;
public String getAbnormalNo() {
return abnormalNo;
}
@ -385,4 +396,20 @@ public class AbnormalBillDisposeDto extends AbnormalBillDispose {
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getNcCodeDescription() {
return ncCodeDescription;
}
public void setNcCodeDescription(String ncCodeDescription) {
this.ncCodeDescription = ncCodeDescription;
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
}

@ -2,7 +2,6 @@ package com.foreverwin.mesnac.anomaly.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDisposeDto;
import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDto;
import com.foreverwin.mesnac.anomaly.model.AbnormalBill;
import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose;
import org.apache.ibatis.annotations.Param;

@ -10,14 +10,16 @@ import java.util.List;
/**
* <p>
* Mapper
* Mapper
* </p>
*
* @author robert
* @since 2021-07-05
* @author
* @since 2021-07-14
*/
@Repository
public interface AbnormalBillMapper extends BaseMapper<AbnormalBill> {
List<AbnormalBillDto> backLog(@Param("abnormalBill")AbnormalBillDto abnormalBillDto, @Param("language")String language);
/**
@ -30,4 +32,5 @@ public interface AbnormalBillMapper extends BaseMapper<AbnormalBill> {
List<AbnormalBill> findCountBySfc(@Param("site")String site,@Param("type")String type,@Param("sfc")String sfc,@Param("status")List<String> status);
}

@ -11,11 +11,11 @@ import java.time.LocalDateTime;
/**
* <p>
*
*
* </p>
*
* @author robert
* @since 2021-07-05
* @author
* @since 2021-07-14
*/
@TableName("Z_ABNORMAL_BILL")
@ -59,6 +59,11 @@ public class AbnormalBill extends Model<AbnormalBill> {
*/
@TableField("SFC")
private String sfc;
/**
*
*/
@TableField("OPERATION")
private String operation;
/**
*
*/
@ -146,6 +151,7 @@ public class AbnormalBill extends Model<AbnormalBill> {
private String entityLocation;
/**
* B J R Z
| C Y |
*/
@TableField("REPORT_FROM")
private String reportFrom;
@ -209,6 +215,8 @@ public class AbnormalBill extends Model<AbnormalBill> {
@TableField(exist = false)
private String fileNum;
public String getHandle() {
return handle;
}
@ -265,6 +273,14 @@ public class AbnormalBill extends Model<AbnormalBill> {
this.sfc = sfc;
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
public String getWorkCenter() {
return workCenter;
}
@ -527,6 +543,8 @@ public static final String ITEM_BO = "ITEM_BO";
public static final String SFC = "SFC";
public static final String OPERATION = "OPERATION";
public static final String WORK_CENTER = "WORK_CENTER";
public static final String SHOP_ORDER = "SHOP_ORDER";
@ -599,6 +617,7 @@ public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
", type = " + type +
", itemBo = " + itemBo +
", sfc = " + sfc +
", operation = " + operation +
", workCenter = " + workCenter +
", shopOrder = " + shopOrder +
", messageType = " + messageType +

@ -14,11 +14,11 @@ import java.util.List;
/**
* <p>
*
*
* </p>
*
* @author robert
* @since 2021-07-05
* @author
* @since 2021-07-14
*/
public interface AbnormalBillService extends IService<AbnormalBill> {
@ -56,7 +56,7 @@ public interface AbnormalBillService extends IService<AbnormalBill> {
/**
*
*/
HashMap<String,Object> init(String messageType,String type);
HashMap<String,Object> init(String messageType, String type);
/**
*
* @param abnormalBillDto
@ -121,4 +121,6 @@ public interface AbnormalBillService extends IService<AbnormalBill> {
HashMap<String,Object> anomalyReveseRepair(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose);
// void deleteFileInDatabase(String ftpPath,String fileName);
}

@ -17,10 +17,10 @@ import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.mapper.*;
import com.foreverwin.mesnac.meapi.model.*;
import com.foreverwin.mesnac.meapi.service.*;
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.visiprise.common.exception.BaseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
@ -31,18 +31,17 @@ import java.util.*;
/**
* <p>
*
*
* </p>
*
* @author robert
* @since 2021-07-05
* @author
* @since 2021-07-14
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, AbnormalBill> implements AbnormalBillService, AnomalyService {
@Autowired
private AbnormalBillMapper abnormalBillMapper;
@ -100,8 +99,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Autowired
private NcCodeMapper ncCodeMapper;
@Override
public IPage<AbnormalBill> selectPage(FrontPage<AbnormalBill> frontPage, AbnormalBill abnormalBill) {
QueryWrapper<AbnormalBill> queryWrapper = new QueryWrapper<>();
@ -116,6 +113,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
return super.list(queryWrapper);
}
@Override
public String anomalyReportOther(AbnormalBill abnormalBill,
AbnormalBillDispose abnormalBillDispose,
@ -188,10 +186,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
// List<NcCode> ncByNG = ncCodeService.findNcByNG(abnormalBill.getMessageType(), abnormalBill.getNcCode());
// if(ncByNG == null || ncByNG.size() <= 0){
// throw BusinessException.build("该消息类型下没有该不良代码");
// }
this.saveOrUpdate(abnormalBill);
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
@ -208,22 +202,18 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
throw BusinessException.build("设备异常有未处理完成的sfc");
}
}
return message;
}
@Override
public HashMap<String, Object> init(String messageType,String type) {
public HashMap<String, Object> init(String messageType, String type) {
HashMap<String, Object> hashMap = new HashMap<>();
String site = CommonMethods.getSite();
//消息类型
if("Z".equals(type)){
List<NcCode> category = ncCodeService.findNcByCategory(messageType,null);
hashMap.put("ncByNG",category);
}
// if("Z".equals(type)){
// List<NcCode> category = ncCodeService.findNcByCategory(messageType,null);
// hashMap.put("ncByNG",category);
// }
//工作中心
WorkCenter workCenter = new WorkCenter();
workCenter.setWcCategory("LEVEL4");
@ -231,10 +221,10 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
List<WorkCenter> workCenterList = workCenterService.selectList(workCenter);
hashMap.put("workCenter",workCenterList);
//原因分类
NcCode ncCode = new NcCode();
DataField ncCode = new DataField();
ncCode.setSite(site);
ncCode.setNcCategory("REPAIR");
List<NcCode> ncCodeList = ncCodeService.selectList(ncCode);
ncCode.setDataField("REASON_CATEGORY");
List<DataField> ncCodeList = dataFieldListService.findDataFieldListById(ncCode);
hashMap.put("causeType",ncCodeList);
//责任部门
DataField dataField = new DataField();
@ -668,6 +658,8 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
return hashMap;
}
@Override
public void createAnomalyTask(String category, String resource, String shopOrder, String sfc, String ncCodes,String position,String ncQty,String ncDescription) {
String site = CommonMethods.getSite();
@ -721,10 +713,5 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
this.saveOrUpdate(abnormalBill);
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
}
}
}

@ -8,6 +8,7 @@ import com.foreverwin.modular.core.util.CommonMethods;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -23,8 +24,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
/**
* @Description TODO
@ -58,14 +57,12 @@ public class FileUploadedServiceImpl implements FileUploadedService {
if (StringUtil.isBlank(site)) {
site = CommonMethods.getSite();
}
//上传附件目录:年/月/日
String path = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd"))+"/"+taskNo;
//上传附件名称
String fileName = fileItem.getOriginalFilename();
try {
Ftp ftp = new Ftp(host, port,username,password);
ftp.upload(path, fileName, fileItem.getInputStream());
ftp.upload(taskNo, fileName, fileItem.getInputStream());
ftp.close();
} catch (IOException e) {
logger.info(e.getMessage());
@ -145,8 +142,16 @@ public class FileUploadedServiceImpl implements FileUploadedService {
// 设置编码格式
ftpClient.setControlEncoding("GBK");
//切换FTP目录
ftpClient.changeWorkingDirectory(pathname);
ftpClient.dele(filename);
if(StringUtil.isBlank(filename)){
ftpClient.changeWorkingDirectory(pathname);
FTPFile[] ftpFiles = ftpClient.listFiles();
for (FTPFile ftpFile : ftpFiles) {
ftpClient.dele(ftpFile.getName());
}
}else{
ftpClient.changeWorkingDirectory(pathname);
ftpClient.dele(filename);
}
ftpClient.logout();
flag = true;
return true;
@ -172,20 +177,15 @@ public class FileUploadedServiceImpl implements FileUploadedService {
if (StringUtil.isBlank(site)) {
site = CommonMethods.getSite();
}
//上传附件目录:年/月/日
String path = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd"))+"/"+taskNo;
//上传附件名称
String fileName = fileItem.getName();
try {
Ftp ftp = new Ftp(host, port,username,password);
ftp.upload(path, fileName, fileItem.getInputStream());
ftp.upload(fileName, fileName, fileItem.getInputStream());
ftp.close();
} catch (IOException e) {
logger.info(e.getMessage());
throw BusinessException.build("" + e.getMessage());
}
}
}

@ -47,6 +47,7 @@
<result column="WORK_ORDER" property="workOrder"/>
<result column="ITEM_NUMBER" property="itemNumber"/>
<result column="NC_CODE" property="ncCode"/>
<result column="NC_CODE_DESCRIPTION" property="ncCodeDescription"/>
<result column="PRODUCT_CATEGORY" property="productCategory"/>
<result column="MAP" property="map"/>
<result column="PB_DESCRIPTION" property="pbDescription"/>
@ -63,6 +64,7 @@
<result column="ROUTER" property="router"/>
<result column="RESRCE_DESCRIPTION" property="resrceDescription"/>
<result column="FULL_NAME" property="fullName"/>
<result column="OPERATION" property="operation"/>
</resultMap>
<!-- 通用查询结果列 -->
@ -617,14 +619,15 @@
SELECT ZAB.ABNORMAL_NO ABNORMAL_NO ,ZAB.STATUS STATUS,I.ITEM ITEM,IT.DESCRIPTION ITEM_DESCRIPTION,
ZAB."TYPE" "TYPE" ,ZAB.SFC SFC,ZAB.MESSAGE_TYPE MESSAGE_TYPE,ZAB.SHOP_ORDER SHOP_ORDER,
ZAB.WORK_CENTER WORK_CENTER,ZAB.RESRCE RESRCE, WORKORDER.VALUE WORK_ORDER,ITEMNUMBER.VALUE ITEM_NUMBER,
PRODUCTCATEGORY.VALUE PRODUCT_CATEGORY,listagg(NCT2.DESCRIPTION || '/'||NCT.DESCRIPTION || ',') within GROUP(ORDER BY zab.ABNORMAL_NO) NC_CODE , ZAB.PB_DESCRIPTION PB_DESCRIPTION ,ZAB.NC_QTY NC_QTY,
PRODUCTCATEGORY.VALUE PRODUCT_CATEGORY,listagg(NG.DESCRIPTION || '/'||NCT.DESCRIPTION || ',') within GROUP(ORDER BY zab.ABNORMAL_NO) NC_CODE_DESCRIPTION,
ZAB.PB_DESCRIPTION PB_DESCRIPTION ,ZAB.NC_QTY NC_QTY,
ZAB.PB_GRADE PB_GRADE ,NWA.FULL_NAME PB_USER ,ZAB.PB_QTY PB_QTY ,ZAB.DISCOVER DISCOVER ,
ZAB.INSPECTOR INSPECTOR ,ZAB.ENTITY_LOCATION ENTITY_LOCATION ,ZAB.REPORT_FROM REPORT_FROM ,ZAB.OBJECT_BO OBJECT_BO ,
ZAB.PB_PHOTOSHOP PB_PHOTOSHOP,ZABD.DUTY_CAUSE_DESCRIPTION DUTY_CAUSE_DESCRIPTION,ZABD.DUTY_CAUSE_TYPE DUTY_CAUSE_TYPE,ZABD.DUTY_DEPART DUTY_DEPART,
ZABD.DUTY_SEND_USER_GROUP DUTY_SEND_USER_GROUP,ZABD.DUTY_TYPE DUTY_TYPE,ZABD.PRINCIPAL_USER PRINCIPAL_USER,ZABD.ABNORMAL_METHOD ABNORMAL_METHOD,
R.ROUTER ROUTER,ZABD.RESOLVE_SHOP_ORDER RESOLVE_SHOP_ORDER,ZABD.RESOLVE_REMARK RESOLVE_REMARK,ZABD.RESOLVE_SEND_USER RESOLVE_SEND_USER,
ZABD.ABNORMAL_REASON ABNORMAL_REASON,ZABD.BEFORE_MEASURE BEFORE_MEASURE,"MAP".VALUE "MAP",
ZABD.ROUTER_BO ROUTER_BO
ZABD.ABNORMAL_REASON ABNORMAL_REASON,ZABD.BEFORE_MEASURE BEFORE_MEASURE,"MAP".VALUE "MAP",listagg(ZANC.NC_CODE_GROUP || '/'||ZANC.NC_CODE || ',') within GROUP(ORDER BY zab.ABNORMAL_NO) NC_CODE,
ZABD.ROUTER_BO ROUTER_BO,ZAB.OPERATION OPERATION
FROM Z_ABNORMAL_BILL ZAB
LEFT JOIN Z_ABNORMAL_BILL_DISPOSE ZABD ON ZAB.HANDLE = ZABD.ABNORMAL_BILL_BO
INNER JOIN ITEM I ON I.HANDLE = ZAB.ITEM_BO
@ -637,7 +640,7 @@
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 NC_CODE_T NCT2 ON ('NCCodeBO:' || ZAB.SITE || ',' || ZANC.NC_CODE_GROUP) = NCT2.NC_CODE_BO AND NCT2.LOCALE = #{language}
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>
<if test="abnormalBill != null">
@ -659,7 +662,7 @@
ZAB.PB_PHOTOSHOP ,ZABD.DUTY_CAUSE_DESCRIPTION ,ZABD.DUTY_CAUSE_TYPE ,ZABD.DUTY_DEPART ,
ZABD.DUTY_SEND_USER_GROUP ,ZABD.DUTY_TYPE ,ZABD.PRINCIPAL_USER ,ZABD.ABNORMAL_METHOD ,
R.ROUTER ,ZABD.RESOLVE_SHOP_ORDER ,ZABD.RESOLVE_REMARK ,ZABD.RESOLVE_SEND_USER ,
ZABD.ABNORMAL_REASON ,ZABD.BEFORE_MEASURE ,"MAP".VALUE,ZABD.ROUTER_BO
ZABD.ABNORMAL_REASON ,ZABD.BEFORE_MEASURE ,"MAP".VALUE,ZABD.ROUTER_BO,ZAB.OPERATION
</select>

@ -11,6 +11,7 @@
<result column="TYPE" property="type" />
<result column="ITEM_BO" property="itemBo" />
<result column="SFC" property="sfc" />
<result column="OPERATION" property="operation" />
<result column="WORK_CENTER" property="workCenter" />
<result column="SHOP_ORDER" property="shopOrder" />
<result column="MESSAGE_TYPE" property="messageType" />
@ -49,17 +50,14 @@
<result column="WORK_CENTER_DESCRIPTION" property="workCenterDescription"/>
<result column="RESRCE_DESCRIPTION" property="resrceDescription"/>
<result column="REPORT_USER" property="reportUser"/>
<result column="RESPONSE_USER" property="responseUser"/>
<result column="RESPONSE_DATE_TIME" property="responseDateTime"/>
<result column="ABNORMAL_METHOD" property="abnormalMethod"/>
<result column="CONFIRM_USER" property="confirmUser"/>
<result column="RESOLVE_REMARK" property="resolveRemark"/>
<result column="CANCEL_UESR" property="cancelUser"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, ABNORMAL_NO, STATUS, TYPE, ITEM_BO, SFC, WORK_CENTER, SHOP_ORDER, MESSAGE_TYPE, RESRCE, NC_CODE, SHUT_DOWN, RESPONSE_USER, RESPONSE_DATE_TIME, PB_DESCRIPTION, NC_QTY, PB_GRADE, PB_USER, PB_QTY, REPAIR_DATE_TIME, DISCOVER, INSPECTOR, ENTITY_LOCATION, REPORT_FROM, OBJECT_BO, PB_PHOTOSHOP, CANCEL_CODE, CANCEL_REASON, CANCEL_DATE_TIME, CANCEL_USER, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME
HANDLE, SITE, ABNORMAL_NO, STATUS, TYPE, ITEM_BO, SFC, OPERATION, WORK_CENTER, SHOP_ORDER, MESSAGE_TYPE, RESRCE, NC_CODE, SHUT_DOWN, RESPONSE_USER, RESPONSE_DATE_TIME, PB_DESCRIPTION, NC_QTY, PB_GRADE, PB_USER, PB_QTY, REPAIR_DATE_TIME, DISCOVER, INSPECTOR, ENTITY_LOCATION, REPORT_FROM, OBJECT_BO, PB_PHOTOSHOP, CANCEL_CODE, CANCEL_REASON, CANCEL_DATE_TIME, CANCEL_USER, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
@ -100,6 +98,7 @@
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</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.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
@ -145,6 +144,7 @@
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</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.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
@ -198,6 +198,7 @@
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</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.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
@ -251,6 +252,7 @@
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</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.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
@ -304,6 +306,7 @@
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</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.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
@ -357,6 +360,7 @@
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</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.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
@ -410,6 +414,7 @@
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</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.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
@ -459,6 +464,7 @@
<if test="type!=null">TYPE,</if>
<if test="itemBo!=null">ITEM_BO,</if>
<if test="sfc!=null">SFC,</if>
<if test="operation!=null">OPERATION,</if>
<if test="workCenter!=null">WORK_CENTER,</if>
<if test="shopOrder!=null">SHOP_ORDER,</if>
<if test="messageType!=null">MESSAGE_TYPE,</if>
@ -496,6 +502,7 @@
<if test="type!=null">#{type},</if>
<if test="itemBo!=null">#{itemBo},</if>
<if test="sfc!=null">#{sfc},</if>
<if test="operation!=null">#{operation},</if>
<if test="workCenter!=null">#{workCenter},</if>
<if test="shopOrder!=null">#{shopOrder},</if>
<if test="messageType!=null">#{messageType},</if>
@ -540,6 +547,7 @@
#{type},
#{itemBo},
#{sfc},
#{operation},
#{workCenter},
#{shopOrder},
#{messageType},
@ -580,6 +588,7 @@
<if test="et.type!=null">TYPE=#{et.type},</if>
<if test="et.itemBo!=null">ITEM_BO=#{et.itemBo},</if>
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
<if test="et.workCenter!=null">WORK_CENTER=#{et.workCenter},</if>
<if test="et.shopOrder!=null">SHOP_ORDER=#{et.shopOrder},</if>
<if test="et.messageType!=null">MESSAGE_TYPE=#{et.messageType},</if>
@ -620,6 +629,7 @@
TYPE=#{et.type},
ITEM_BO=#{et.itemBo},
SFC=#{et.sfc},
OPERATION=#{et.operation},
WORK_CENTER=#{et.workCenter},
SHOP_ORDER=#{et.shopOrder},
MESSAGE_TYPE=#{et.messageType},
@ -660,6 +670,7 @@
<if test="et.type!=null">TYPE=#{et.type},</if>
<if test="et.itemBo!=null">ITEM_BO=#{et.itemBo},</if>
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
<if test="et.workCenter!=null">WORK_CENTER=#{et.workCenter},</if>
<if test="et.shopOrder!=null">SHOP_ORDER=#{et.shopOrder},</if>
<if test="et.messageType!=null">MESSAGE_TYPE=#{et.messageType},</if>
@ -699,6 +710,7 @@
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</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.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
@ -769,6 +781,7 @@
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</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.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
@ -861,19 +874,19 @@
<select id="findAllByAbnormalNoDevice" resultMap="abnormalBillDto">
SELECT ZAB.ABNORMAL_NO ABNORMAL_NO , ZAB.STATUS STATUS ,ZAB.REPORT_FROM REPORT_FROM ,WCT.DESCRIPTION WORK_CENTER_DESCRIPTION,
ZAB.RESRCE RESRCE ,R.DESCRIPTION RESRCE_DESCRIPTION,ZNU.FULL_NAME REPORT_USER,ZAB.MESSAGE_TYPE MESSAGE_TYPE ,
ZAB.NC_CODE NC_CODE ,ZAB.PB_DESCRIPTION PB_DESCRIPTION ,ZAB.SHUT_DOWN SHUT_DOWN ,ZAB.RESPONSE_USER RESPONSE_USER,ZAB.RESPONSE_DATE_TIME RESPONSE_DATE_TIME,
ZABD.ABNORMAL_METHOD ABNORMAL_METHOD,ZNU3.FULL_NAME CONFIRM_USER,ZABD.RESOLVE_REMARK RESOLVE_REMARK,
ZAB.CANCEL_CODE CANCEL_CODE,ZAB.CANCEL_DATE_TIME CANCEL_DATE_TIME,ZNU4.FULL_NAME CANCEL_USER,ZAB.CANCEL_REASON CANCEL_REASON
ZAB.RESRCE RESRCE ,R.DESCRIPTION RESRCE_DESCRIPTION,ZNU.FULL_NAME REPORT_USER,ZAB.MESSAGE_TYPE MESSAGE_TYPE ,
ZAB.NC_CODE NC_CODE ,ZAB.PB_DESCRIPTION PB_DESCRIPTION ,ZAB.SHUT_DOWN SHUT_DOWN ,ZAB.RESPONSE_USER RESPONSE_USER,ZAB.RESPONSE_DATE_TIME RESPONSE_DATE_TIME,
ZABD.ABNORMAL_METHOD ABNORMAL_METHOD,ZNU3.FULL_NAME CONFIRM_USER,ZABD.RESOLVE_REMARK RESOLVE_REMARK,
ZAB.CANCEL_CODE CANCEL_CODE,ZAB.CANCEL_DATE_TIME CANCEL_DATE_TIME,ZNU4.FULL_NAME CANCEL_USER,ZAB.CANCEL_REASON CANCEL_REASON
FROM
Z_ABNORMAL_BILL ZAB
INNER JOIN Z_ABNORMAL_BILL_DISPOSE ZABD ON ZABD.ABNORMAL_BILL_BO = ZAB.HANDLE
INNER JOIN RESRCE R ON R.RESRCE = ZAB.RESRCE AND R.SITE = ZAB.SITE
LEFT JOIN WORK_CENTER_T WCT ON WCT.WORK_CENTER_BO = ('WORKCENTERBO:' || ZAB.SITE || ',' || ZAB.WORK_CENTER) AND WCT.LOCALE =#{language}
LEFT JOIN Z_NWA_USER ZNU ON ZNU.USER_NAME = ZAB.CREATED_USER AND ZNU.SITE = ZAB.SITE
LEFT JOIN Z_NWA_USER ZNU2 ON ZNU2.USER_NAME = ZAB.RESPONSE_USER AND ZNU2.SITE = ZAB.SITE
LEFT JOIN Z_NWA_USER ZNU3 ON ZNU3.USER_NAME = ZABD.RESOLVE_USER AND ZNU3.SITE = ZAB.SITE
LEFT JOIN Z_NWA_USER ZNU4 ON ZNU4.USER_NAME = ZAB.CANCEL_USER AND ZNU4.SITE = ZAB.SITE
Z_ABNORMAL_BILL ZAB
INNER JOIN Z_ABNORMAL_BILL_DISPOSE ZABD ON ZABD.ABNORMAL_BILL_BO = ZAB.HANDLE
INNER JOIN RESRCE R ON R.RESRCE = ZAB.RESRCE AND R.SITE = ZAB.SITE
LEFT JOIN WORK_CENTER_T WCT ON WCT.WORK_CENTER_BO = ('WORKCENTERBO:' || ZAB.SITE || ',' || ZAB.WORK_CENTER) AND WCT.LOCALE =#{language}
LEFT JOIN Z_NWA_USER ZNU ON ZNU.USER_NAME = ZAB.CREATED_USER AND ZNU.SITE = ZAB.SITE
LEFT JOIN Z_NWA_USER ZNU2 ON ZNU2.USER_NAME = ZAB.RESPONSE_USER AND ZNU2.SITE = ZAB.SITE
LEFT JOIN Z_NWA_USER ZNU3 ON ZNU3.USER_NAME = ZABD.RESOLVE_USER AND ZNU3.SITE = ZAB.SITE
LEFT JOIN Z_NWA_USER ZNU4 ON ZNU4.USER_NAME = ZAB.CANCEL_USER AND ZNU4.SITE = ZAB.SITE
<where>
<if test="abnormalBill != null">
<if test="abnormalBill.site != null and abnormalBill.site != ''">
@ -894,18 +907,19 @@
SITE = #{site}
</if>
<if test="status != null and status.size() != 0">
AND STATUS NOT IN
<foreach collection="status" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
AND STATUS NOT IN
<foreach collection="status" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="type != null and type != ''">
AND "TYPE" = #{type}
AND "TYPE" = #{type}
</if>
<if test="sfc != null and sfc != ''">
AND SFC = #{sfc}
AND SFC = #{sfc}
</if>
</where>
</select>
</mapper>

@ -131,8 +131,9 @@ public enum HandleEnum {
LOAD_INVENTORY("LoadInventoryBO:","LoadInventoryBO:{0},{1}"),
/**用户**/
USR("UserBO","UserBO:{0},{1}");
USR("UserBO","UserBO:{0},{1}"),
TOOL("ToolBO","ToolBO:{0},{1}");
private String prefix;
private String pattern;

@ -59,6 +59,10 @@
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>com.foreverwin.mesnac</groupId>
<artifactId>anomaly</artifactId>
</dependency>
<dependency>
<groupId>com.foreverwin.mesnac</groupId>
<artifactId>meapi</artifactId>

@ -1,17 +1,21 @@
package com.foreverwin.mesnac.dataimport.controller;
import com.foreverwin.mesnac.dataimport.util.APResult;
import com.foreverwin.mesnac.dataimport.util.ImportRequest;
import com.foreverwin.mesnac.anomaly.service.FileUploadedService;
import com.foreverwin.mesnac.common.model.ExportTemplate;
import com.foreverwin.mesnac.common.service.ExportTemplateService;
import com.foreverwin.mesnac.dataimport.service.impl.MasterDataImportServiceImpl;
import com.foreverwin.mesnac.dataimport.util.APResult;
import com.foreverwin.mesnac.dataimport.util.ImportRequest;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.R;
import com.foreverwin.modular.core.util.SpringUtil;
import com.sap.me.frame.Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.websocket.server.PathParam;
@ -27,18 +31,26 @@ public class DataImportController {
@Autowired
private MasterDataImportServiceImpl masterDataImportService;
@PostMapping("/import")
public String importFile(@PathParam("fileType") String fileType, @PathParam("site") String site, @PathParam("user") String user, @PathParam("handleType") final String handleType, @PathParam("mode") final String mode, @RequestParam("file") MultipartFile multipartFile) {
@Autowired
FileUploadedService fileUploadedService;
@RequestMapping("/import")
public String importFile(@PathParam("fileType") String fileType, @PathParam("site") String site,
@PathParam("user") String user, @PathParam("handleType") final String handleType,
@PathParam("mode") final String mode, @RequestParam("file") MultipartFile multipartFile,@PathParam("taskNo")String taskNo) {
ImportRequest importRequest = new ImportRequest();
importRequest.setFileType(fileType);
importRequest.setSite(site);
importRequest.setUser(user);
importRequest.setMode(mode);
importRequest.setMasterType(handleType);
//-----------------------------------------------------------------------------------------------------------------------------------------
try {
String transInfo = masterDataImportService.importFile(multipartFile, importRequest);
return new APResult().getResult(0, transInfo, transInfo);
// String transInfo = masterDataImportService.importFile(multipartFile, importRequest);
fileUploadedService.uploadAttachment(multipartFile,site,taskNo,fileType);
return new APResult().getResult(0,"上传成功",null);
} catch (Exception e) {
e.printStackTrace();
return new APResult().getResult(9999, e.getMessage(), e.getMessage());

@ -24,6 +24,8 @@ public class HandlerFactory {
return new NCGroupHandler();
case "ncCode" :
return new NCCodeHandler();
case "inspectionItem" :
return new InspectionItemHandler();
case "messageType" :
//return new MessageTypeHandler();
}

@ -0,0 +1,94 @@
package com.foreverwin.mesnac.dataimport.handler;
import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mesnac.dataimport.client.ResourceTypeWSClient;
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.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.I18nUtil;
import com.sap.me.plant.ResourceTypeBasicConfiguration;
import java.io.InputStream;
import java.util.Collection;
import java.util.Map;
public class InspectionItemHandler extends BaseHandler {
@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("RESOURCE_TYPE");
}
public RowVisitor<JSONObject> getRowVisitor(String site, String mode, StringBuffer buffer, Integer[] failedNumber) {
return new RowVisitor<JSONObject>() {
@Override
public int visit(long index, JSONObject jsonObject) {
Object[] params = new Object[10];
params[0] = index;
params[1] = jsonObject.getString("resourceType");
String resultMessage = null;
try {
if (jsonObject.containsKey("resourceType") && jsonObject.getString("resourceType").trim().length() > 0) {
jsonObject.put("site", site);
Collection<ResourceTypeBasicConfiguration> collection = ResourceTypeWSClient.find(jsonObject);
if (collection.size() > 0) {
resultMessage = "资源类型主数据已经存在";
} else {
resultMessage = ResourceTypeWSClient.insert(jsonObject);
if (resultMessage == null) {
return 1;
}
}
if (resultMessage != null) {
params[2] = resultMessage;
failedNumber[0]++;
buffer.append("第" + index + "行:" + I18nUtil.getI18nText("MaterData.import.insert.fail", params) + "\n");
return 0;
}
}
return 0;
} catch (Exception e) {
params[2] = e.getMessage();
failedNumber[0]++;
buffer.append("第" + index + "行:" + I18nUtil.getI18nText("MaterData.import.insert.fail", params) + "\n");
}
return 0;
}
@Override
public String[] getHeader() {
return null;
}
};
}
}

@ -139,6 +139,21 @@ public class MasterObjectDefine {
cvsHeadsMapping.put("seqNum","纠正预防措施时间");
break;
case "INSPECTION_ITEM":
cvsHeadsMapping = new HashMap<>();
cvsHeadsMapping.put("seqNum","序号");
cvsHeadsMapping.put("seqNum","消息类型");
cvsHeadsMapping.put("seqNum","消息正文");
cvsHeadsMapping.put("seqNum","响应用户组");
cvsHeadsMapping.put("seqNum","响应用户组");
cvsHeadsMapping.put("seqNum","响应时间(H)");
cvsHeadsMapping.put("seqNum","响应超期上报用户组");
cvsHeadsMapping.put("seqNum","出具方案时间(H)");
cvsHeadsMapping.put("seqNum","方案关闭时通知用户组");
cvsHeadsMapping.put("seqNum","纠正预防措施用户组");
cvsHeadsMapping.put("seqNum","纠正预防措施时间");
break;
default:
break;
}

@ -32,8 +32,8 @@ public class GeneratorApplication {
MpGenerator mpGenerator = mpGeneratorBuilder.dataSourceConfig(dataSourceConfig)
.tablePrefix( "APS_", "DS_", "Z_" )
.packageName( "com.foreverwin.mesnac.anomaly" )
.tables("Z_UPLOAD_PICTURES")
.author("Leon.L")
.tables("Z_ABNORMAL_BILL")
.author("赵嘉伟")
.uiAppId("com.foreverwin.me")
.uiPackage("com.foreverwin.me.migration")
.build();

@ -140,10 +140,15 @@ public class NcCodeController {
return R.ok(ncCodeService.findNcByCategory(category,code));
}
@GetMapping("findSecondaryNcByNc")
@GetMapping("/findSecondaryNcByNc")
public R findSecondaryNcByNcI(String ncCode){
return R.ok(ncCodeService.findSecondaryNcByNc(ncCode));
}
@GetMapping("/findNcCodeByNcGroup")
public R findNcCodeByNcGroup(NcGroup ncGroup){
return R.ok(ncCodeService.findNcCodeByNcGroup(ncGroup));
}
}

@ -3,6 +3,7 @@ package com.foreverwin.mesnac.meapi.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.model.NcGroup;
import com.foreverwin.mesnac.meapi.model.Operation;
import com.foreverwin.mesnac.meapi.service.NcGroupService;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
@ -129,4 +130,9 @@ public class NcGroupController {
public R removeByIds(List<String> ids){
return R.ok(ncGroupService.removeByIds(ids));
}
@GetMapping("/findNgGroupByOperationBo")
public R findNgGroupByOperationBo(Operation operation){
return R.ok(ncGroupService.findNgGroupByOperationBo(operation));
}
}

@ -91,4 +91,6 @@ public class OperationController {
return R.ok(result);
}
}

@ -160,4 +160,9 @@ public class SfcController {
return R.ok(sfcService.removeByIds(ids));
}
@GetMapping("/findOperationBySfc")
public R findOperationBySfc(String sfc){
return R.ok(sfcService.findOperationBySfc(sfc));
}
}

@ -34,4 +34,6 @@ public interface NcCodeMapper extends BaseMapper<NcCode> {
* @return
*/
Integer checkNcCode(@Param("NcCodeList")List<String> ncCodes,@Param("site")String site,@Param("category")String category);
List<NcCode> findNcCodeByNcGroup(@Param("ncGroup")NcGroup ncGroup);
}

@ -1,12 +1,15 @@
package com.foreverwin.mesnac.meapi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.foreverwin.mesnac.meapi.model.NcGroup;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.foreverwin.mesnac.meapi.model.Operation;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* Mapper
@ -19,4 +22,6 @@ import org.springframework.stereotype.Repository;
public interface NcGroupMapper extends BaseMapper<NcGroup> {
IPage selectPageByOperation(Page<NcGroup> frontPage, @Param("site") String site, @Param("operationBO") String operationBO,@Param("globalQuery") String globalQuery);
List<NcGroup> findNgGroupByOperationBo(@Param("operation") Operation operation);
}

@ -28,4 +28,6 @@ public interface OperationMapper extends BaseMapper<Operation> {
Operation queryOperationByErpWorkCenter(@Param("site") String site, @Param("erpWorkCenter") String erpWorkCenter);
IPage<Operation> selectOperationStep( IPage<Operation> page, @Param("locale") String locale,@Param("ew") Wrapper<Operation> wrapper);
}

@ -31,4 +31,6 @@ public interface SfcMapper extends BaseMapper<Sfc> {
Sfc findBySfc(@Param("sfc") Sfc sfc);
IPage pageByResrce(Page<Sfc> pagePlus,@Param("ew") QueryWrapper<SfcDto> queryWrapper,@Param("locale")String locale);
String findOperationBySfc(@Param("site")String site,@Param("sfc")String sfc);
}

@ -33,4 +33,6 @@ public interface NcCodeService extends IService<NcCode> {
List<NcCode> findSecondaryNcByNc(String ncCode);
IPage selectPageByNcGroup(Page<NcGroup> pagePlus, String globalQuery, String ncGroup);
List<NcCode> findNcCodeByNcGroup(NcGroup ncGroup);
}

@ -2,8 +2,9 @@ package com.foreverwin.mesnac.meapi.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.foreverwin.mesnac.meapi.model.NcGroup;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.mesnac.meapi.model.NcGroup;
import com.foreverwin.mesnac.meapi.model.Operation;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.List;
@ -28,4 +29,6 @@ public interface NcGroupService extends IService<NcGroup> {
List<NcGroup> selectList(NcGroup ncGroup);
IPage selectPageByOperation(Page<NcGroup> pagePlus, String globalQuery, String operation);
List<NcGroup> findNgGroupByOperationBo(Operation operation);
}

@ -39,4 +39,5 @@ public interface OperationService extends IService<Operation> {
* @return
*/
Operation queryOperationByErpWorkCenter(String site, String erpWorkCenter);
}

@ -2,7 +2,6 @@ package com.foreverwin.mesnac.meapi.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
@ -50,4 +49,7 @@ public interface SfcService extends IService<Sfc> {
*/
SfcDto findSfcData(String site, String sfc);
String findOperationBySfc(String sfc);
}

@ -74,5 +74,12 @@ public class NcCodeServiceImpl extends ServiceImpl<NcCodeMapper, NcCode> impleme
return ncCodeMapper.selectPageByNcGroup(pagePlus, ncGroupBO, globalQuery,LocaleContextHolder.getLocale().getLanguage());
}
@Override
public List<NcCode> findNcCodeByNcGroup(NcGroup ncGroup) {
String site = CommonMethods.getSite();
ncGroup.setSite(site);
return ncCodeMapper.findNcCodeByNcGroup(ncGroup);
}
}

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.meapi.mapper.NcGroupMapper;
import com.foreverwin.mesnac.meapi.model.NcGroup;
import com.foreverwin.mesnac.meapi.model.Operation;
import com.foreverwin.mesnac.meapi.service.NcGroupService;
import com.foreverwin.mesnac.meapi.util.StringUtils;
import com.foreverwin.modular.core.exception.BaseException;
@ -58,5 +59,11 @@ public class NcGroupServiceImpl extends ServiceImpl<NcGroupMapper, NcGroup> impl
return ncGroupMapper.selectPageByOperation(frontPage, site, operationBO, globalQuery);
}
@Override
public List<NcGroup> findNgGroupByOperationBo(Operation operation) {
String site = CommonMethods.getSite();
operation.setSite(site);
return ncGroupMapper.findNgGroupByOperationBo(operation);
}
}

@ -67,4 +67,6 @@ public class OperationServiceImpl extends ServiceImpl<OperationMapper, Operation
}
}

@ -2,6 +2,7 @@ package com.foreverwin.mesnac.meapi.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -71,4 +72,10 @@ public class SfcServiceImpl extends ServiceImpl<SfcMapper, Sfc> implements SfcSe
public SfcDto findSfcData(String site, String sfc) {
return sfcMapper.findSfcData(site, sfc);
}
@Override
public String findOperationBySfc(String sfc) {
String site = CommonMethods.getSite();
return sfcMapper.findOperationBySfc(site,sfc);
}
}

@ -396,4 +396,23 @@
AND NC_CATEGORY = #{category}
</if>
</select>
<select id="findNcCodeByNcGroup" resultMap="BaseResultMap">
SELECT NC.NC_CODE ,NCT.DESCRIPTION
FROM NC_GROUP NG
INNER JOIN NC_GROUP_MEMBER NGM ON NG.HANDLE = NGM.NC_GROUP_BO
INNER JOIN NC_CODE NC ON NGM.NC_CODE_OR_GROUP_GBO = NC.HANDLE
LEFT JOIN NC_CODE_T NCT ON NCT.NC_CODE_BO = NC.HANDLE AND NCT.LOCALE = 'zh'
<where>
<if test="ncGroup != null">
<if test="ncGroup.site != null and ncGroup.site != ''">
NG.SITE = #{ncGroup.site}
</if>
<if test="ncGroup.ncGroup != null and ncGroup.ncGroup != null">
AND NG.NC_GROUP = #{ncGroup.ncGroup}
</if>
</if>
</where>
</select>
</mapper>

@ -19,6 +19,9 @@
<sql id="Base_Column_List">
HANDLE, CHANGE_STAMP, SITE, NC_GROUP, DESCRIPTION, VALID_AT_ALL_OPERATIONS, PRIORITY, CREATED_DATE_TIME, MODIFIED_DATE_TIME
</sql>
<sql id="Full_Column_List">
NG.HANDLE, NG.CHANGE_STAMP, NG.SITE, NG.NC_GROUP, NG.DESCRIPTION, NG.VALID_AT_ALL_OPERATIONS, NG.PRIORITY, NG.CREATED_DATE_TIME, NG.MODIFIED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
@ -350,4 +353,22 @@
AND (ng.NC_GROUP LIKE '%${globalQuery}%' or NG.DESCRIPTION LIKE '%${globalQuery}%')
</if>
</select>
<select id="findNgGroupByOperationBo" resultMap="BaseResultMap">
SELECT DISTINCT NG.NC_GROUP,NG.DESCRIPTION
FROM NC_GROUP NG
LEFT JOIN NC_GROUP_VALID_OPER NGVO ON NG.HANDLE = NGVO.NC_GROUP_BO
<where>
<if test="operation != null">
<if test="operation.site != null and operation.site != ''">
NG.SITE = #{operation.site}
</if>
<if test="operation.handle != null">
AND (NGVO.OPERATION_BO = #{operation.handle}
OR NG.VALID_AT_ALL_OPERATIONS = 'true')
</if>
</if>
</where>
</select>
</mapper>

@ -634,4 +634,6 @@
</if>
ORDER BY RS.STEP_ID
</select>
</mapper>

@ -673,4 +673,15 @@
AND S.STATUS_BO IN ('StatusBO:'||#{ew.entity.site}||',401','StatusBO:'||#{ew.entity.site}||',402','StatusBO:'||#{ew.entity.site}||',403')
AND zprt.STATUS='FINISH' AND ZPRT."RESULT"='OK'
</select>
<select id="findOperationBySfc" resultType="string">
SELECT SS.OPERATION_BO
FROM SFC S
INNER JOIN SFC_ROUTING SR ON SR.SFC_BO = S.HANDLE
INNER JOIN SFC_ROUTER ST ON ST.SFC_ROUTING_BO = SR.HANDLE
INNER JOIN SFC_STEP SS ON SS.SFC_ROUTER_BO = ST.HANDLE
WHERE (SS.QTY_IN_QUEUE > 0 OR SS.QTY_IN_WORK > 0)
AND S.SFC = #{sfc} AND S.SITE = #{site}
</select>
</mapper>

@ -0,0 +1,137 @@
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.production.model.CutterLog;
import com.foreverwin.mesnac.production.service.CutterLogService;
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.List;
import java.util.Map;
/**
*
* @author Philip
* @since 2021-07-14
*/
@RestController
@RequestMapping("/Z-CUTTER-LOG")
public class CutterLogController {
@Autowired
public CutterLogService cutterLogService;
/**
*
* @return
*/
@ResponseBody
@PostMapping("/doAdd")
public R doAdd(@RequestBody Map<String,Object> map){
cutterLogService.doAdd(map);
return R.ok();
}
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getCutterLogById(@PathVariable String id) {
return R.ok( cutterLogService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getCutterLogList(CutterLog cutterLog){
List<CutterLog> result;
QueryWrapper<CutterLog> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(cutterLog);
result = cutterLogService.list(queryWrapper);
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<CutterLog> frontPage, CutterLog cutterLog){
IPage result;
QueryWrapper<CutterLog> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(cutterLog);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(CutterLog::getHandle, frontPage.getGlobalQuery())
.or().like(CutterLog::getSite, frontPage.getGlobalQuery())
.or().like(CutterLog::getCutter, frontPage.getGlobalQuery())
.or().like(CutterLog::getShopOrder, frontPage.getGlobalQuery())
.or().like(CutterLog::getWorkCenter, frontPage.getGlobalQuery())
.or().like(CutterLog::getSfc, frontPage.getGlobalQuery())
.or().like(CutterLog::getType, frontPage.getGlobalQuery())
.or().like(CutterLog::getOperation, frontPage.getGlobalQuery())
.or().like(CutterLog::getStepId, frontPage.getGlobalQuery())
.or().like(CutterLog::getItem, frontPage.getGlobalQuery())
.or().like(CutterLog::getResrce, frontPage.getGlobalQuery())
.or().like(CutterLog::getCreateUser, frontPage.getGlobalQuery())
);
}
result = cutterLogService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param cutterLog
* @return null
*/
@PostMapping
public R save(@RequestBody CutterLog cutterLog) {
return R.ok(cutterLogService.save(cutterLog));
}
/**
*
* @param cutterLog
* @return null
*/
@PutMapping
public R updateById(@RequestBody CutterLog cutterLog) {
return R.ok(cutterLogService.updateById(cutterLog));
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(cutterLogService.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(cutterLogService.removeByIds(ids));
}
}

@ -1,10 +1,12 @@
package com.foreverwin.mesnac.production.controller;
import com.foreverwin.mesnac.common.enums.HandleEnum;
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 oracle.jdbc.proxy.annotation.Post;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -65,6 +67,7 @@ public class ToolController {
public R page(FrontPage<Tool> frontPage, Tool tool){
IPage result;
QueryWrapper<Tool> queryWrapper = new QueryWrapper<>();
tool.setSite(CommonMethods.getSite());
queryWrapper.setEntity(tool);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
@ -73,7 +76,7 @@ public class ToolController {
.or().like(Tool::getSite, frontPage.getGlobalQuery())
.or().like(Tool::getTool, frontPage.getGlobalQuery())
.or().like(Tool::getDescription, frontPage.getGlobalQuery())
.or().like(Tool::getStatus, frontPage.getGlobalQuery())
.or().like(Tool::getStatus, frontPage.getGlobalQuery())
.or().like(Tool::getToolType, frontPage.getGlobalQuery())
.or().like(Tool::getSpecification, frontPage.getGlobalQuery())
.or().like(Tool::getBrand, frontPage.getGlobalQuery())
@ -127,4 +130,43 @@ public class ToolController {
public R removeByIds(List<String> ids){
return R.ok(toolService.removeByIds(ids));
}
/**
*
* @param tool
* @return null
*/
@PostMapping(value = "/saveOrUpdateOne")
public R saveOrUpdateOne(@RequestBody Tool tool) {
try{
toolService.saveOrUpdateOne(tool);
}catch (Exception e){
return R.failed("数据保存失败" + e.getMessage());
}
return R.ok();
}
@ResponseBody
@GetMapping("/getOneToolByToolNo")
public R getOneToolByToolNo(String tool) {
try{
return R.ok(toolService.getOneToolByToolNo(tool));
}catch (Exception e){
return R.failed("数据保存失败" + e.getMessage());
}
}
@PostMapping("/deleteInspectionPlanByHandle")
public R deleteInspectionPlanByHandle(@RequestBody String tool){
try {
toolService.deleteInspectionPlanByHandle(tool);
} catch (Exception e) {
R.failed("计划删除失败:" + e.getMessage());
}
return R.ok();
}
}

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

@ -0,0 +1,264 @@
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 Philip
* @since 2021-07-14
*/
@TableName("Z_CUTTER_LOG")
public class CutterLog extends Model<CutterLog> {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "HANDLE", type = IdType.INPUT)
private String handle;
/**
*
*/
@TableField("SITE")
private String site;
/**
*
*/
@TableField("CUTTER")
private String cutter;
/**
*
*/
@TableField("SHOP_ORDER")
private String shopOrder;
/**
*
*/
@TableField("WORK_CENTER")
private String workCenter;
/**
*
*/
@TableField("SFC")
private String sfc;
/**
*
*/
@TableField("TYPE")
private String type;
/**
*
*/
@TableField("OPERATION")
private String operation;
/**
*
*/
@TableField("STEP_ID")
private String stepId;
/**
*
*/
@TableField("ITEM")
private String item;
/**
*
*/
@TableField("RESRCE")
private String resrce;
/**
* 使
*/
@TableField("QTY")
private Long qty;
/**
*
*/
@TableField("CREATE_USER")
private String createUser;
/**
*
*/
@TableField("CREATED_DATE_TIME")
private LocalDateTime createdDateTime;
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 getCutter() {
return cutter;
}
public void setCutter(String cutter) {
this.cutter = cutter;
}
public String getShopOrder() {
return shopOrder;
}
public void setShopOrder(String shopOrder) {
this.shopOrder = shopOrder;
}
public String getWorkCenter() {
return workCenter;
}
public void setWorkCenter(String workCenter) {
this.workCenter = workCenter;
}
public String getSfc() {
return sfc;
}
public void setSfc(String sfc) {
this.sfc = sfc;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
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 String getItem() {
return item;
}
public void setItem(String item) {
this.item = item;
}
public String getResrce() {
return resrce;
}
public void setResrce(String resrce) {
this.resrce = resrce;
}
public Long getQty() {
return qty;
}
public void setQty(Long qty) {
this.qty = qty;
}
public String getCreateUser() {
return createUser;
}
public void setCreateUser(String createUser) {
this.createUser = createUser;
}
public LocalDateTime getCreatedDateTime() {
return createdDateTime;
}
public void setCreatedDateTime(LocalDateTime createdDateTime) {
this.createdDateTime = createdDateTime;
}
public static final String HANDLE = "HANDLE";
public static final String SITE = "SITE";
public static final String CUTTER = "CUTTER";
public static final String SHOP_ORDER = "SHOP_ORDER";
public static final String WORK_CENTER = "WORK_CENTER";
public static final String SFC = "SFC";
public static final String TYPE = "TYPE";
public static final String OPERATION = "OPERATION";
public static final String STEP_ID = "STEP_ID";
public static final String ITEM = "ITEM";
public static final String RESRCE = "RESRCE";
public static final String QTY = "QTY";
public static final String CREATE_USER = "CREATE_USER";
public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME";
@Override
protected Serializable pkVal() {
return this.handle;
}
@Override
public String toString() {
return "CutterLog{" +
"handle = " + handle +
", site = " + site +
", cutter = " + cutter +
", shopOrder = " + shopOrder +
", workCenter = " + workCenter +
", sfc = " + sfc +
", type = " + type +
", operation = " + operation +
", stepId = " + stepId +
", item = " + item +
", resrce = " + resrce +
", qty = " + qty +
", createUser = " + createUser +
", createdDateTime = " + createdDateTime +
"}";
}
}

@ -0,0 +1,31 @@
package com.foreverwin.mesnac.production.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.production.model.CutterLog;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.List;
import java.util.Map;
/**
* <p>
*
* </p>
*
* @author Philip
* @since 2021-07-14
*/
public interface CutterLogService extends IService<CutterLog> {
/**
*
* @param frontPage
* @return
*/
IPage<CutterLog> selectPage(FrontPage<CutterLog> frontPage, CutterLog cutterLog);
List<CutterLog> selectList(CutterLog cutterLog);
void doAdd(Map<String, Object> map);
}

@ -25,4 +25,24 @@ public interface ToolService extends IService<Tool> {
IPage<Tool> selectPage(FrontPage<Tool> frontPage, Tool tool);
List<Tool> selectList(Tool tool);
/**
*
* @param tool
*/
void saveOrUpdateOne(Tool tool);
/**
*
* @param tool
* @return
*/
Tool getOneToolByToolNo(String tool);
/**
*
*
*/
void deleteInspectionPlanByHandle(String tool);
}

@ -0,0 +1,121 @@
package com.foreverwin.mesnac.production.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.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.service.CommonService;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.production.mapper.CutterLogMapper;
import com.foreverwin.mesnac.production.mapper.SfcCrossMapper;
import com.foreverwin.mesnac.production.model.CutterLog;
import com.foreverwin.mesnac.production.model.Tool;
import com.foreverwin.mesnac.production.service.CutterLogService;
import com.foreverwin.mesnac.production.service.ToolService;
import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import org.springframework.beans.factory.annotation.Autowired;
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;
import java.util.Map;
import java.util.UUID;
/**
* <p>
*
* </p>
*
* @author Philip
* @since 2021-07-14
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class CutterLogServiceImpl extends ServiceImpl<CutterLogMapper, CutterLog> implements CutterLogService {
@Autowired
private CutterLogMapper cutterLogMapper;
@Autowired
private SfcCrossMapper sfcCorssMapper;
@Autowired
private CommonService commonService;
@Autowired
private ToolService toolService;
@Override
public IPage<CutterLog> selectPage(FrontPage<CutterLog> frontPage, CutterLog cutterLog) {
QueryWrapper<CutterLog> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(cutterLog);
return super.page(frontPage.getPagePlus(), queryWrapper);
}
@Override
public List<CutterLog> selectList(CutterLog cutterLog) {
QueryWrapper<CutterLog> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(cutterLog);
return super.list(queryWrapper);
}
@Override
public void doAdd(Map<String, Object> map) {
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
String sfc = (String)map.get("sfc");
String resrce = (String)map.get("resrce");
List<CutterLog> list = (List<CutterLog>)map.get("cutterList");
ObjectMapper mapper = new ObjectMapper();
list = mapper.convertValue(list, new TypeReference<List<CutterLog>>() {});
SfcDto sfcDto = new SfcDto();
sfcDto.setSfc(sfc);
sfcDto.setResrce(resrce);
Map<String, Object> sfcData = sfcCorssMapper.querySfcData(site, LocaleContextHolder.getLocale().getLanguage(), sfcDto);
if (sfcData == null) {
throw new BaseException("根据当前资源未找到条码[" + sfc + "]的基本信息!");
}
String operation = (String)sfcData.get("OPERATION");
String stepId = (String)sfcData.get("STEP_ID");
String shopOrder = (String)sfcData.get("SHOP_ORDER");
String item = (String)sfcData.get("ITEM");
String workShopBo = commonService.getWorkShopBo(HandleEnum.RESOURCE.getHandle(site, resrce));
String workShop = StringUtil.trimHandle(workShopBo);
if(list==null||list.size()<1){
throw new BaseException("刀具列表不能为空");
}
list.forEach(cutterLog->{
String handle = UUID.randomUUID().toString();
cutterLog.setHandle(handle);
//校验刀具是否存在
String cutter = cutterLog.getCutter();
QueryWrapper<Tool> query=new QueryWrapper<>();
query.eq(Tool.SITE,site);
query.eq(Tool.TOOL,cutter);
query.eq(Tool.STATUS, Constants.STATUS_Y);
List<Tool> toolList = toolService.list(query);
if (toolList.size()<1){
throw new BaseException("不存在的刀具");
}
cutterLog.setSite(site);
cutterLog.setShopOrder(shopOrder);
cutterLog.setWorkCenter(workShop);
cutterLog.setSfc(sfc);
cutterLog.setOperation(operation);
cutterLog.setStepId(stepId);
cutterLog.setItem(item);
cutterLog.setResrce(resrce);
cutterLog.setCreateUser(user);
cutterLog.setCreatedDateTime(LocalDateTime.now());
save(cutterLog);
});
}
}

@ -5,12 +5,17 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.enums.DispatchStatusEnum;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.erp.ZprodordconfStruIn;
import com.foreverwin.mesnac.common.erp.ZprodordconfStruOut;
import com.foreverwin.mesnac.common.erp.holders.TableOfZprodordconfStruInHolder;
import com.foreverwin.mesnac.common.erp.holders.TableOfZprodordconfStruOutHolder;
import com.foreverwin.mesnac.common.model.InspectionItemDetail;
import com.foreverwin.mesnac.common.model.InspectionTask;
import com.foreverwin.mesnac.common.service.CommonService;
import com.foreverwin.mesnac.common.service.InspectionItemService;
import com.foreverwin.mesnac.common.service.InspectionTaskService;
import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
import com.foreverwin.mesnac.common.util.ERPAPI;
import com.foreverwin.mesnac.common.util.ExceptionUtil;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
@ -32,6 +37,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -242,4 +248,52 @@ public class PodTemplateServiceImpl implements PodTemplateService {
sfcDispatchCommonService.updateSfcDispatchStatus(site,CommonMethods.getUser(),dispatchNo, DispatchStatusEnum.COMPLETE.getCode());
});
}
void senErp() throws RemoteException {
String shopOrder = "SO20210714";
String stepId = "OP001";
//请求参数
ZprodordconfStruIn[] ins = new ZprodordconfStruIn[1];
ZprodordconfStruIn struIn = new ZprodordconfStruIn();
//生产订单
struIn.setAufnr(shopOrder);
//步骤标示
struIn.setVornr(stepId);
struIn.setAueru("1");
//良品数量
struIn.setLmnga(new BigDecimal(10));
//报废数量
struIn.setXmnga(new BigDecimal(1));
//机器工时
struIn.setIsm01(new BigDecimal(1));
//人工工时
struIn.setIsm02(new BigDecimal(1));
struIn.setIsm03(new BigDecimal(1));
struIn.setIsm04(new BigDecimal(1));
struIn.setIsm05(new BigDecimal(1));
struIn.setIsm06(new BigDecimal(1));
ins[0] = struIn;
TableOfZprodordconfStruInHolder inHolder = new TableOfZprodordconfStruInHolder(ins);
//返回对象
ZprodordconfStruOut[] outs = new ZprodordconfStruOut[1];
ZprodordconfStruOut struOut = new ZprodordconfStruOut();
struOut.setAufnr(shopOrder);
struOut.setVornr(stepId);
struOut.setAueru("1");
struOut.setLmnga(new BigDecimal(1));
struOut.setRet("");
struOut.setMsg("");
outs[0] = struOut;
TableOfZprodordconfStruOutHolder outHolder = new TableOfZprodordconfStruOutHolder(outs);
//调用WS
ERPAPI.erpWebService().zmesProdordconf(inHolder, outHolder);
String status = outHolder.value[1].getRet();
String message = outHolder.value[1].getMsg();
System.out.println("ERP接口返回状态:" + status + ",消息:" + message);
}
}

@ -1,5 +1,8 @@
package com.foreverwin.mesnac.production.service.impl;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -11,6 +14,7 @@ import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
@ -42,5 +46,49 @@ public class ToolServiceImpl extends ServiceImpl<ToolMapper, Tool> implements To
return super.list(queryWrapper);
}
@Override
public void saveOrUpdateOne(Tool tool) {
String site = tool.getSite();
String toolNo = tool.getTool();
String handle = HandleEnum.TOOL.getHandle(site, toolNo);
String user = CommonMethods.getUser();
tool.setHandle(handle);
Tool byId = toolMapper.selectById(handle);
if (byId != null){
tool.setCreateUser(byId.getCreateUser());
tool.setCreatedDateTime(byId.getCreatedDateTime());
tool.setModifyUser(user);
tool.setModifiedDateTime(LocalDateTime.now());
toolMapper.updateById(tool);
}else{
tool.setCreateUser(user);
tool.setCreatedDateTime(LocalDateTime.now());
toolMapper.insert(tool);
}
}
@Override
public Tool getOneToolByToolNo(String tool) {
String site = CommonMethods.getSite();
String handle = HandleEnum.TOOL.getHandle(site, tool);
return toolMapper.selectById(handle);
}
@Override
public void deleteInspectionPlanByHandle(String tool) {
String site = CommonMethods.getSite();
String handle = HandleEnum.TOOL.getHandle(site, tool);
String user = CommonMethods.getUser();
Tool byId = toolMapper.selectById(handle);
if (byId == null){
throw BusinessException.build("刀具编号不存在!");
}
byId.setStatus("N");
byId.setModifyUser(user);
byId.setModifiedDateTime(LocalDateTime.now());
toolMapper.updateById(byId);
}
}

@ -0,0 +1,466 @@
<?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.CutterLogMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.production.model.CutterLog">
<id column="HANDLE" property="handle" />
<result column="SITE" property="site" />
<result column="CUTTER" property="cutter" />
<result column="SHOP_ORDER" property="shopOrder" />
<result column="WORK_CENTER" property="workCenter" />
<result column="SFC" property="sfc" />
<result column="TYPE" property="type" />
<result column="OPERATION" property="operation" />
<result column="STEP_ID" property="stepId" />
<result column="ITEM" property="item" />
<result column="RESRCE" property="resrce" />
<result column="QTY" property="qty" />
<result column="CREATE_USER" property="createUser" />
<result column="CREATED_DATE_TIME" property="createdDateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, CUTTER, SHOP_ORDER, WORK_CENTER, SFC, TYPE, OPERATION, STEP_ID, ITEM, RESRCE, QTY, CREATE_USER, CREATED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_CUTTER_LOG WHERE HANDLE=#{handle}
</select>
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_CUTTER_LOG
<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_CUTTER_LOG 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_CUTTER_LOG
<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.cutter!=null"> AND CUTTER=#{ew.entity.cutter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</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.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
</where>
</select>
<select id="selectCount" resultType="Integer">
SELECT COUNT(1) FROM Z_CUTTER_LOG
<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.cutter!=null"> AND CUTTER=#{ew.entity.cutter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</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.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_CUTTER_LOG
<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.cutter!=null"> AND CUTTER=#{ew.entity.cutter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</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.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_CUTTER_LOG
<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.cutter!=null"> AND CUTTER=#{ew.entity.cutter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</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.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_CUTTER_LOG
<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.cutter!=null"> AND CUTTER=#{ew.entity.cutter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</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.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_CUTTER_LOG
<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.cutter!=null"> AND CUTTER=#{ew.entity.cutter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</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.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_CUTTER_LOG
<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.cutter!=null"> AND CUTTER=#{ew.entity.cutter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</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.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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.CutterLog">
INSERT INTO Z_CUTTER_LOG
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="site!=null">SITE,</if>
<if test="cutter!=null">CUTTER,</if>
<if test="shopOrder!=null">SHOP_ORDER,</if>
<if test="workCenter!=null">WORK_CENTER,</if>
<if test="sfc!=null">SFC,</if>
<if test="type!=null">TYPE,</if>
<if test="operation!=null">OPERATION,</if>
<if test="stepId!=null">STEP_ID,</if>
<if test="item!=null">ITEM,</if>
<if test="resrce!=null">RESRCE,</if>
<if test="qty!=null">QTY,</if>
<if test="createUser!=null">CREATE_USER,</if>
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="site!=null">#{site},</if>
<if test="cutter!=null">#{cutter},</if>
<if test="shopOrder!=null">#{shopOrder},</if>
<if test="workCenter!=null">#{workCenter},</if>
<if test="sfc!=null">#{sfc},</if>
<if test="type!=null">#{type},</if>
<if test="operation!=null">#{operation},</if>
<if test="stepId!=null">#{stepId},</if>
<if test="item!=null">#{item},</if>
<if test="resrce!=null">#{resrce},</if>
<if test="qty!=null">#{qty},</if>
<if test="createUser!=null">#{createUser},</if>
<if test="createdDateTime!=null">#{createdDateTime},</if>
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.production.model.CutterLog">
INSERT INTO Z_CUTTER_LOG
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{site},
#{cutter},
#{shopOrder},
#{workCenter},
#{sfc},
#{type},
#{operation},
#{stepId},
#{item},
#{resrce},
#{qty},
#{createUser},
#{createdDateTime},
</trim>
</insert>
<update id="updateById">
UPDATE Z_CUTTER_LOG <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.cutter!=null">CUTTER=#{et.cutter},</if>
<if test="et.shopOrder!=null">SHOP_ORDER=#{et.shopOrder},</if>
<if test="et.workCenter!=null">WORK_CENTER=#{et.workCenter},</if>
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
<if test="et.type!=null">TYPE=#{et.type},</if>
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
<if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
<if test="et.item!=null">ITEM=#{et.item},</if>
<if test="et.resrce!=null">RESRCE=#{et.resrce},</if>
<if test="et.qty!=null">QTY=#{et.qty},</if>
<if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</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_CUTTER_LOG <trim prefix="SET" suffixOverrides=",">
SITE=#{et.site},
CUTTER=#{et.cutter},
SHOP_ORDER=#{et.shopOrder},
WORK_CENTER=#{et.workCenter},
SFC=#{et.sfc},
TYPE=#{et.type},
OPERATION=#{et.operation},
STEP_ID=#{et.stepId},
ITEM=#{et.item},
RESRCE=#{et.resrce},
QTY=#{et.qty},
CREATE_USER=#{et.createUser},
CREATED_DATE_TIME=#{et.createdDateTime},
</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_CUTTER_LOG <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.cutter!=null">CUTTER=#{et.cutter},</if>
<if test="et.shopOrder!=null">SHOP_ORDER=#{et.shopOrder},</if>
<if test="et.workCenter!=null">WORK_CENTER=#{et.workCenter},</if>
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
<if test="et.type!=null">TYPE=#{et.type},</if>
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
<if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
<if test="et.item!=null">ITEM=#{et.item},</if>
<if test="et.resrce!=null">RESRCE=#{et.resrce},</if>
<if test="et.qty!=null">QTY=#{et.qty},</if>
<if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</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.cutter!=null"> AND CUTTER=#{ew.entity.cutter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</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.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_CUTTER_LOG WHERE HANDLE=#{handle}
</delete>
<delete id="deleteByMap">
DELETE FROM Z_CUTTER_LOG
<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_CUTTER_LOG
<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.cutter!=null"> AND CUTTER=#{ew.entity.cutter}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</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.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_CUTTER_LOG WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
</mapper>

@ -217,7 +217,7 @@
<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}
and ${ew.sqlSegment}
</if>
</if>
</where>

@ -16,9 +16,9 @@ import com.foreverwin.mesnac.quality.dto.SelfReportRequest;
import com.foreverwin.mesnac.quality.mapper.SelfReportMapper;
import com.foreverwin.mesnac.quality.model.SelfReport;
import com.foreverwin.mesnac.quality.service.SelfReportService;
import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import com.visiprise.common.exception.BaseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
@ -94,7 +94,9 @@ public class SelfReportServiceImpl extends ServiceImpl<SelfReportMapper, SelfRep
sfcDto.setSfc(sfc);
sfcDto.setResrce(resrce);
Map<String, Object> sfcData = sfcCorssMapper.querySfcData(site, LocaleContextHolder.getLocale().getLanguage(), sfcDto);
if (sfcData == null) {
throw new BaseException("根据当前资源未找到条码[" + sfc + "]的基本信息!");
}
String operationStep = (String)sfcData.get("OPERATION_STEP");
String shopOrder = (String)sfcData.get("SHOP_ORDER");
String item = (String)sfcData.get("ITEM");

Loading…
Cancel
Save