Merge remote-tracking branch 'origin/master'

赵嘉伟 4 years ago
commit 945d72fedd

@ -0,0 +1,151 @@
package com.foreverwin.mesnac.common.dto;
import java.io.Serializable;
import java.math.BigDecimal;
/**
*
*
*/
public class LabelPrintDto implements Serializable {
private String site;
private String user;
//打印机
private String printer;
//打印模板名称
private String printTemplate;
//物料编码
private String item;
//物料描述
private String itemDescription;
//供应商
private String supplier;
//批次号
private String batch;
//工作指令
private String workOrder;
//图纸版本号
private String drawingVersion;
//产品条码
private String sfc;
//数量
private BigDecimal qty;
//下料尺寸
private String blankingSize;
//下道工序
private String operation;
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getPrinter() {
return printer;
}
public void setPrinter(String printer) {
this.printer = printer;
}
public String getPrintTemplate() {
return printTemplate;
}
public void setPrintTemplate(String printTemplate) {
this.printTemplate = printTemplate;
}
public String getItem() {
return item;
}
public void setItem(String item) {
this.item = item;
}
public String getItemDescription() {
return itemDescription;
}
public void setItemDescription(String itemDescription) {
this.itemDescription = itemDescription;
}
public String getSupplier() {
return supplier;
}
public void setSupplier(String supplier) {
this.supplier = supplier;
}
public String getBatch() {
return batch;
}
public void setBatch(String batch) {
this.batch = batch;
}
public String getWorkOrder() {
return workOrder;
}
public void setWorkOrder(String workOrder) {
this.workOrder = workOrder;
}
public String getDrawingVersion() {
return drawingVersion;
}
public void setDrawingVersion(String drawingVersion) {
this.drawingVersion = drawingVersion;
}
public String getSfc() {
return sfc;
}
public void setSfc(String sfc) {
this.sfc = sfc;
}
public BigDecimal getQty() {
return qty;
}
public void setQty(BigDecimal qty) {
this.qty = qty;
}
public String getBlankingSize() {
return blankingSize;
}
public void setBlankingSize(String blankingSize) {
this.blankingSize = blankingSize;
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
}

@ -87,6 +87,9 @@ public enum HandleEnum {
/**设备检验任务**/
RESOURCE_INSPECT_TASK("ResourceInspectTaskBo","ResourceInspectTaskBo:{0},{1}"),
/**设备检验任务**/
SPLIT_SFC("SplitSfcBo","SplitSfcBo:{0},{1}"),
/**设备检验任务**/
RESOURCE_REPAIR_TASK("ResourceRepairTaskBo","ResourceRepairTaskBo:{0},{1}"),

@ -218,9 +218,9 @@ public class InspectionTaskServiceImpl extends ServiceImpl<InspectionTaskMapper,
task.setOperation(operation);
task.setStepId(stepId);
task.setResrce((String) paramMap.get("RESRCE"));
task.setCreateUser((String) paramMap.get("CREATE_USER"));
task.setCreateUser(CommonMethods.getUser());
task.setCreatedDateTime(LocalDateTime.now());
task.setModifyUser((String) paramMap.get("CREATE_USER"));
task.setModifyUser(CommonMethods.getUser());
task.setModifiedDateTime(LocalDateTime.now());
task.setSfcDispatchBo((String) paramMap.get("SFC_DISPATCH_DETAIL_BO"));
task.setSfc(sfc);

@ -2,8 +2,11 @@ package com.foreverwin.mesnac.common.service.impl;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONString;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mesnac.common.dto.LabelPrintDto;
import com.foreverwin.mesnac.common.model.PrintLog;
import com.foreverwin.mesnac.common.mapper.PrintLogMapper;
import com.foreverwin.mesnac.common.service.PrintLogService;
@ -15,6 +18,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
@ -54,16 +58,16 @@ public class PrintLogServiceImpl extends ServiceImpl<PrintLogMapper, PrintLog> i
return;
}
JSONArray jsonArray = new JSONArray();
List<LabelPrintDto> labelPrintDtoList = new ArrayList<>();
for (PrintLog printLog : printList) {
JSONObject _json = new JSONObject();
_json.put("PRINTER", printLog.getPrintName());
_json.put("PRINT_TEMPLATE", printLog.getPrintTemplate());
_json.put("PRINT_PARAM", printLog.getPrintParam());
jsonArray.add(_json);
LabelPrintDto labelPrintDto = new LabelPrintDto();
labelPrintDto.setPrinter(printLog.getPrintName());
labelPrintDto.setPrintTemplate(printLog.getPrintTemplate());
labelPrintDto.setItem(printLog.getItem());
labelPrintDto.setItemDescription(printLog.getItemDescription());
labelPrintDtoList.add(labelPrintDto);
}
HttpUtil.post(printServer, jsonArray.toJSONString(), 30000);
HttpUtil.post(printServer, JSON.toJSONString(labelPrintDtoList), 30000);
}
}

@ -69,6 +69,12 @@ public class CallItemController {
List<CallItem> result;
try {
callItem.setSite(CommonMethods.getSite());
if (callItem.getRequireFromDate_S() != null) {
callItem.setRequireFromDate(DateUtil.parse(callItem.getRequireFromDate_S()));
}
if (callItem.getRequireToDate_S() != null) {
callItem.setRequireToDate(DateUtil.parse(callItem.getRequireToDate_S()));
}
if (callItem.getStartFromDate_S() != null) {
callItem.setStartFromDate(DateUtil.parse(callItem.getStartFromDate_S()));
}

@ -95,7 +95,7 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
for (int i = 0; i< callItemList.size(); i++) {
CallItem callItem = callItemList.get(i);
String component = StringUtil.trimHandle(callItem.getComponentBo());
String callItemNo = callItem.getSfc() + component;
String callItemNo = callItem.getSfc() + callItem.getStepId() + component;
callItem.setCallItemNo(callItemNo);
callItem.setHandle(HandleEnum.CALL_ITEM.getHandle(site, callItemNo));

@ -145,7 +145,7 @@ public class IssueItemServiceImpl extends ServiceImpl<IssueItemMapper, IssueItem
}
Item itemModel = itemService.selectCurrent(site, item);
if (itemModel == null) {
throw BusinessException.build("物料{0}没有维护当前版本!", item);
throw BusinessException.build("物料【" +item+"】没有维护当前版本!");
}
String itemBo = itemModel.getHandle();
String materialType = itemModel.getMaterialType();
@ -243,7 +243,7 @@ public class IssueItemServiceImpl extends ServiceImpl<IssueItemMapper, IssueItem
//查询匹配的叫料记录
List<CallItem> list = callItemService.findIssueMatchCallItemList(site, workOrder, blankingSize, resource, item);
if (list == null || list.size() <= 0) {
throw BusinessException.build("根据发料数据未找到发料记录!");
throw BusinessException.build("未找到当前物料对应的叫料记录!");
}
BigDecimal remainQty = new BigDecimal(qty);

@ -316,8 +316,6 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
//派工导入
if (DispatchStatusEnum.IMPORT.getCode().equals(type)) {
//TODO 派工单已经开始或完成的不修改
String handle = HandleEnum.SFC_DISPATCH.getHandle(site, dispatchNo);
SfcDispatch sfcDispatchModel = this.getById(handle);
if (sfcDispatchModel == null) {
@ -327,9 +325,16 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
continue;
}
resourceType = sfcDispatchModel.getResourceType();
String status = sfcDispatchModel.getDispatchStatus();
//派工单已经开始或完成的不修改
if (DispatchStatusEnum.START.equals(status) || DispatchStatusEnum.COMPLETE.equals(status)) {
flag = false;
message.append(seq++ % 3 == 0 ? "\n" : "| |");
message.append("派工单[" + dispatchNo + "]已经开始/完成,不能修改派工数据!");
continue;
}
type = sfcDispatch.getDispatchStatus();
sfcDispatch.setHandle(handle);
//是否导入
sfcDispatch.setIsImport(Constants.BOOL_TRUE);
@ -454,12 +459,4 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
String site = CommonMethods.getSite();
return sfcDispatchMapper.findSfcDispatchBySfc(site,sfcDispatch);
}
// @Override
// public SfcDispatchDto findResrceBySfc(SfcDispatch sfcDispatch) {
// String site = CommonMethods.getSite();
// String[] status = {"START","COMPLETE"};
// return sfcDispatchMapper.findResrceBySfc(sfcDispatch,site,status);
// }
}

@ -659,6 +659,9 @@
GROUP BY SFC_DISPATCH_BO
) VP ON VP.SFC_DISPATCH_BO = ZCI.SFC_DISPATCH_BO
WHERE ZSD.SITE = #{site}
<if test="dispatchNo != null and dispatchNo != ''">
AND ZSD.DISPATCH_NO = #{dispatchNo}
</if>
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
@ -815,16 +818,16 @@
ORDER BY ZSD.SFC, ZSD.STEP_ID, ZCI.CALL_TYPE
</select>
<update id="modifyCallItemStatusByDispatchBo">
MODIFY Z_CALL_ITEM SET STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime}
<update id="updateCallItemStatusByDispatchBo">
UPDATE Z_CALL_ITEM SET STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime}
WHERE STATUS != '804' AND SFC_DISPATCH_BO IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item.sfcDispatchBo}
</foreach>
</update>
<update id="modifyCallItemStatusByCallItemNo">
MODIFY Z_CALL_ITEM SET STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime}
<update id="updateCallItemStatusByCallItemNo">
UPDATE Z_CALL_ITEM SET STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime}
WHERE STATUS != '804' AND CALL_ITEM_NO IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item}
@ -832,7 +835,7 @@
</update>
<update id="refreshRequiredTime">
MODIFY Z_CALL_ITEM SET MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime}, REQUIRED_DATE_TIME = (
UPDATE Z_CALL_ITEM SET MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime}, REQUIRED_DATE_TIME = (
SELECT ZSD.PLANNED_START_DATE
FROM Z_SFC_DISPATCH ZSD
WHERE Z_CALL_ITEM.SFC_DISPATCH_BO = ZSD.HANDLE
@ -850,8 +853,11 @@
INNER JOIN ITEM M ON B.COMPONENT_BO = M.HANDLE
INNER JOIN SHOP_ORDER Z ON Z.SITE = B.SITE AND Z.SHOP_ORDER = B.SHOP_ORDER
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = Z.HANDLE AND CF."ATTRIBUTE" = 'WORK_ORDER'
WHERE B.SITE = #{site} AND M.ITEM = #{item} AND P.BLANKING_SIZE = #{blankingSize}
WHERE B.SITE = #{site} AND M.ITEM = #{item}
AND (B.ISSUE_QTY IS NULL OR B.ISSUE_QTY &lt; B.REQUIRED_QTY)
<if test="blankingSize != null and blankingSize != ''">
AND P.BLANKING_SIZE = #{blankingSize}
</if>
<if test="workOrder != null and workOrder != ''">
AND CF.VALUE = #{workOrder}
</if>

@ -17,8 +17,17 @@ public class SfcDto extends Sfc {
private String stepId;
private String plannedStartDate;
private String plannedCompDate;
//工作令号
private String workOrder;
public String getWorkOrder() {
return workOrder;
}
public void setWorkOrder(String workOrder) {
this.workOrder = workOrder;
}
public String getStepId() {
return stepId;
}
@ -123,11 +132,4 @@ public class SfcDto extends Sfc {
this.plannedCompDate = plannedCompDate;
}
public String getWorkOrder() {
return workOrder;
}
public void setWorkOrder(String workOrder) {
this.workOrder = workOrder;
}
}

@ -656,7 +656,7 @@
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = IM.HANDLE AND IT.LOCALE = 'zh'
INNER JOIN SFC_ROUTING SG ON SG.SFC_BO = SC.HANDLE
INNER JOIN SFC_ROUTER SR ON SR.SFC_ROUTING_BO = SG.HANDLE AND SR.IN_USE = 'true'
INNER JOIN SFC_STEP SP ON SP.SFC_ROUTER_BO = SR.HANDLE
INNER JOIN SFC_STEP SP ON SP.SFC_ROUTER_BO = SR.HANDLE AND (SP.QTY_IN_QUEUE > 0 OR SP.QTY_IN_WORK > 0)
INNER JOIN OPERATION OP ON SP.OPERATION_BO = 'OperationBO:'||OP.SITE||','||OP.OPERATION||',#' AND OP.CURRENT_REVISION = 'true'
LEFT JOIN OPERATION_T OT ON OT.OPERATION_BO = OP.HANDLE AND OT.LOCALE = 'zh'
LEFT JOIN Z_SFC_DISPATCH ZSD ON ZSD.SITE = SC.SITE AND ZSD.SFC = SC.SFC AND ZSD.OPERATION = OP.OPERATION AND ZSD.STEP_ID = SP.STEP_ID

@ -0,0 +1,136 @@
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.meapi.dto.SfcDto;
import com.foreverwin.mesnac.production.model.SplitSfc;
import com.foreverwin.mesnac.production.service.SplitSfcService;
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;
/**
*
* @author Philip
* @since 2021-07-20
*/
@RestController
@RequestMapping("/Z-SPLIT-SFC")
public class SplitSfcController {
@Autowired
public SplitSfcService splitSfcService;
@ResponseBody
@GetMapping("/getSfcData")
public R getSfcData(String sfc){
SfcDto result;
result = splitSfcService.getSfcData(sfc);
return R.ok(result);
}
@ResponseBody
@GetMapping("/splitSfc")
public R getSfcData(SfcDto sfcDto){
return R.ok( splitSfcService.splitSfc(sfcDto));
}
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getSplitSfcById(@PathVariable String id) {
return R.ok( splitSfcService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getSplitSfcList(SplitSfc splitSfc){
List<SplitSfc> result;
QueryWrapper<SplitSfc> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(splitSfc);
result = splitSfcService.list(queryWrapper);
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<SplitSfc> frontPage, SplitSfc splitSfc){
IPage result;
QueryWrapper<SplitSfc> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(splitSfc);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(SplitSfc::getHandle, frontPage.getGlobalQuery())
.or().like(SplitSfc::getSite, frontPage.getGlobalQuery())
.or().like(SplitSfc::getSfc, frontPage.getGlobalQuery())
.or().like(SplitSfc::getSplitSfc, frontPage.getGlobalQuery())
.or().like(SplitSfc::getRouter, frontPage.getGlobalQuery())
.or().like(SplitSfc::getCreateUser, frontPage.getGlobalQuery())
);
}
result = splitSfcService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param splitSfc
* @return null
*/
@PostMapping
public R save(@RequestBody SplitSfc splitSfc) {
return R.ok(splitSfcService.save(splitSfc));
}
/**
*
* @param splitSfc
* @return null
*/
@PutMapping
public R updateById(@RequestBody SplitSfc splitSfc) {
return R.ok(splitSfcService.updateById(splitSfc));
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(splitSfcService.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(splitSfcService.removeByIds(ids));
}
}

@ -0,0 +1,33 @@
package com.foreverwin.mesnac.production.dto;
import com.foreverwin.mesnac.production.model.SplitSfc;
public class SplitSfcDto extends SplitSfc {
private String ncCode;
private String routerBo;
private String ncQty;
public String getNcCode() {
return ncCode;
}
public void setNcCode(String ncCode) {
this.ncCode = ncCode;
}
public String getRouterBo() {
return routerBo;
}
public void setRouterBo(String routerBo) {
this.routerBo = routerBo;
}
public String getNcQty() {
return ncQty;
}
public void setNcQty(String ncQty) {
this.ncQty = ncQty;
}
}

@ -69,7 +69,7 @@ public interface SfcCrossMapper extends BaseMapper {
List<SfcDto> getSfcListByResrce(@Param("site") String site, @Param("resrce") String resrce,@Param("locale") String locale);
Integer resourceCheck(@Param("resrceBO")String resrceBO, @Param("dateTime")LocalDateTime dateTime);
SfcDto getInfoBySfc(@Param("sfc")Sfc sfc);
Integer resourceCheck(@Param("site")String site,@Param("resrce")String resrce, @Param("dateTime")LocalDateTime dateTime);
}

@ -0,0 +1,24 @@
package com.foreverwin.mesnac.production.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.production.dto.SplitSfcDto;
import com.foreverwin.mesnac.production.model.SplitSfc;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper
* </p>
*
* @author Philip
* @since 2021-07-20
*/
@Repository
public interface SplitSfcMapper extends BaseMapper<SplitSfc> {
SfcDto getSfcData(@Param("handle") String handle);
SplitSfcDto getAbnormalQty(@Param("site")String site, @Param("sfc")String sfc, @Param("operation") String operation);
}

@ -0,0 +1,169 @@
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.math.BigDecimal;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author Philip
* @since 2021-07-20
*/
@TableName("Z_SPLIT_SFC")
public class SplitSfc extends Model<SplitSfc> {
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("SPLIT_SFC")
private String splitSfc;
/**
*
*/
@TableField("SPLIT_QTY")
private BigDecimal splitQty;
/**
* 线
*/
@TableField("ROUTER")
private String router;
/**
*
*/
@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 getSfc() {
return sfc;
}
public void setSfc(String sfc) {
this.sfc = sfc;
}
public String getSplitSfc() {
return splitSfc;
}
public void setSplitSfc(String splitSfc) {
this.splitSfc = splitSfc;
}
public BigDecimal getSplitQty() {
return splitQty;
}
public void setSplitQty(BigDecimal splitQty) {
this.splitQty = splitQty;
}
public String getRouter() {
return router;
}
public void setRouter(String router) {
this.router = router;
}
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 SFC = "SFC";
public static final String SPLIT_SFC = "SPLIT_SFC";
public static final String SPLIT_QTY = "SPLIT_QTY";
public static final String ROUTER = "ROUTER";
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 "SplitSfc{" +
"handle = " + handle +
", site = " + site +
", sfc = " + sfc +
", splitSfc = " + splitSfc +
", splitQty = " + splitQty +
", router = " + router +
", createUser = " + createUser +
", createdDateTime = " + createdDateTime +
"}";
}
}

@ -0,0 +1,33 @@
package com.foreverwin.mesnac.production.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.production.model.SplitSfc;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author Philip
* @since 2021-07-20
*/
public interface SplitSfcService extends IService<SplitSfc> {
/**
*
* @param frontPage
* @return
*/
IPage<SplitSfc> selectPage(FrontPage<SplitSfc> frontPage, SplitSfc splitSfc);
List<SplitSfc> selectList(SplitSfc splitSfc);
SfcDto getSfcData(String sfc);
SplitSfc splitSfc(SfcDto sfcDto);
}

@ -173,7 +173,7 @@ public class PodTemplateServiceImpl implements PodTemplateService {
throw new BaseException("资源不能为空");
}
//是否设备点检
sfcCrossService.resourceCheck(HandleEnum.RESOURCE.getHandle(site,resrce));
sfcCrossService.resourceCheck(resrce);
sfcDtoList.forEach(sfcDto -> {
String operation = sfcDto.getOperation();
Operation currentRevisionRef = operationService.getCurrentRevisionRef(site, operation);

@ -77,10 +77,11 @@ public class SfcCrossServiceImpl implements SfcCrossService {
}
@Override
public void resourceCheck(String resrceBO) {
public void resourceCheck(String resrce) {
LocalDateTime now = LocalDateTime.now();
String site = CommonMethods.getSite();
LocalDateTime dateTime = LocalDateTime.of(now.getYear(), now.getMonth(), now.getDayOfMonth(), 0, 0, 0);
Integer integer = sfcCrossMapper.resourceCheck(resrceBO, dateTime);
Integer integer = sfcCrossMapper.resourceCheck(site,resrce, dateTime);
if (integer<1){
throw new BaseException("当前设备点检未完成");
}

@ -0,0 +1,166 @@
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.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.util.ExceptionUtil;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.production.dto.SplitSfcDto;
import com.foreverwin.mesnac.production.mapper.SplitSfcMapper;
import com.foreverwin.mesnac.production.model.SplitSfc;
import com.foreverwin.mesnac.production.service.SplitSfcService;
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.nonconformance.*;
import com.sap.me.production.SplitSerializeServiceInterface;
import com.sap.me.production.SplitSfcDetail;
import com.sap.me.production.SplitSfcRequest;
import com.sap.me.production.SplitSfcResponse;
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.Collection;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author Philip
* @since 2021-07-20
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> implements SplitSfcService {
@Autowired
private SplitSfcMapper splitSfcMapper;
@Override
public IPage<SplitSfc> selectPage(FrontPage<SplitSfc> frontPage, SplitSfc splitSfc) {
QueryWrapper<SplitSfc> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(splitSfc);
return super.page(frontPage.getPagePlus(), queryWrapper);
}
@Override
public List<SplitSfc> selectList(SplitSfc splitSfc) {
QueryWrapper<SplitSfc> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(splitSfc);
return super.list(queryWrapper);
}
@Override
public SfcDto getSfcData(String sfc) {
String site = CommonMethods.getSite();
String handle = HandleEnum.SFC.getHandle(site, sfc);
//根据sfc找工单等信息
SfcDto sfcData = splitSfcMapper.getSfcData(handle);
if (sfcData==null){
throw new BaseException("未找到产品条码信息");
}
String operation = sfcData.getOperation();
//查询质量异常记录数量
SplitSfcDto sfcDto=splitSfcMapper.getAbnormalQty(site,sfc,operation);
if (sfcDto==null){
throw new BaseException("未找到方案确认的质量异常");
}
sfcData.setQty(Double.valueOf(sfcDto.getNcQty()));
return sfcData;
}
@Override
public SplitSfc splitSfc(SfcDto sfcDto){
String site = CommonMethods.getSite();
String sfc = sfcDto.getSfc();
String handle = HandleEnum.SFC.getHandle(site, sfc);
BigDecimal splitQty = new BigDecimal(sfcDto.getQty());
//根据sfc找工单等信息
SfcDto sfcData = splitSfcMapper.getSfcData(handle);
String operation = sfcData.getOperation();
if (sfcData==null){
throw new BaseException("未找到产品条码信息");
}
//查询质量异常记录数量 处置工艺路线及不良代码
SplitSfcDto splitSfcDto=splitSfcMapper.getAbnormalQty(site,sfc,operation);
String routerBo = splitSfcDto.getRouterBo();
String ncCode = splitSfcDto.getNcCode();
if (StringUtil.isBlank(routerBo)){
throw new BaseException("异常处置未选择处置工艺路线");
}
if (StringUtil.isBlank(ncCode)){
throw new BaseException("异常处置未选择不良代码");
}
BigDecimal sfcQty = new BigDecimal(sfcData.getQty());
if (new BigDecimal(splitSfcDto.getNcQty()).compareTo(sfcQty)>=0){
throw new BaseException("质量异常数量不小于于产品条码的数量,不能拆分");
}
if (splitQty.compareTo(new BigDecimal(splitSfcDto.getNcQty()))>0){
throw new BaseException("拆分数量大于质量异常数量的数量,不能拆分");
}
String[] splitNcCode = ncCode.split(",");
SplitSfcRequest splitSfcRequest=new SplitSfcRequest();
try {
SplitSerializeServiceInterface splitService = MEServices.create("com.sap.me.production", "SplitSerializeService",site);
NCProductionServiceInterface ncProductionService = MEServices.create("com.sap.me.nonconformance", "NCProductionService",site);
//拆sfc
List<SplitSfcDetail> newList=new ArrayList<>();
SplitSfcDetail splitDetail=new SplitSfcDetail();
splitDetail.setQuantity(splitQty);
newList.add(splitDetail);
splitSfcRequest.setNewSfcList(newList);
splitSfcRequest.setSfcRef(HandleEnum.SFC.getHandle(site,sfc));
Collection<SplitSfcResponse> splitSfcResponses = splitService.splitSfc(splitSfcRequest);
SplitSfcResponse splitSfcResponse = splitSfcResponses.iterator().next();
String newSfcRef = splitSfcResponse.getNewSfcRef();
//记录不合格
CreateNCRequest createNCRequest=new CreateNCRequest();
createNCRequest.setQty(splitQty);
createNCRequest.setSfcRef(newSfcRef);
ProductionContext productionContext=new ProductionContext();
StepIdentifier stepIdentifier=new StepIdentifier();
stepIdentifier.setStepId(sfcData.getStepId());
stepIdentifier.setOperationId(sfcData.getOperation());
productionContext.setStepIdentifier(stepIdentifier);
createNCRequest.setProdCtx(productionContext);
createNCRequest.setNcCodeRef(HandleEnum.NC_CODE.getHandle(site,splitNcCode[0]));
ncProductionService.createNC(createNCRequest);
//不合格处置特殊工艺路线
DispositionMultipleSfcsRequest dispositionSfcsRequest=new DispositionMultipleSfcsRequest();
List<String> sfcs=new ArrayList<>();
sfcs.add(newSfcRef);
dispositionSfcsRequest.setSfcs(sfcs);
dispositionSfcsRequest.setBypassStepValidation(true);
DispositionSelection dispositionSelection=new DispositionSelection();
dispositionSelection.setRouterRef(routerBo);
dispositionSfcsRequest.setDispositionSelection(dispositionSelection);
ncProductionService.dispositionMultipleSfcs(dispositionSfcsRequest);
SplitSfc splitSfc=new SplitSfc();
String newSfc = StringUtil.trimHandle(newSfcRef);
splitSfc.setHandle(HandleEnum.SPLIT_SFC.getHandle(site,newSfc));
splitSfc.setSite(site);
splitSfc.setSfc(sfc);
splitSfc.setSplitSfc(newSfc);
splitSfc.setSplitQty(splitQty);
splitSfc.setRouter(StringUtil.trimHandle(routerBo));
splitSfc.setCreateUser(CommonMethods.getUser());
splitSfc.setCreatedDateTime(LocalDateTime.now());
save(splitSfc);
return splitSfc;
} catch (Exception e) {
ExceptionUtil.throwException(e);
}
return null;
}
}

@ -160,7 +160,7 @@ WHERE sfc.site = #{site} and
</select>
<select id="resourceCheck" resultType="java.lang.Integer">
SELECT count(HANDLE) FROM Z_RESOURCE_INSPECT_TASK zrit WHERE RESOURCE_BO=#{resrceBO} AND CATEGORY='DM' AND STATUS='COMPLETE' AND "RESULT"='OK' AND CREATED_DATE_TIME>=#{dateTime}
SELECT count(HANDLE) FROM Z_RESOURCE_INSPECT_TASK zrit WHERE site=#{site} and RESRCE=#{resrce} AND CATEGORY='DM' AND STATUS='COMPLETE' AND "RESULT"='OK' AND CREATED_DATE_TIME>=#{dateTime}
</select>
<select id="getInfoBySfc" resultType="com.foreverwin.mesnac.meapi.dto.SfcDto">

@ -0,0 +1,385 @@
<?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.SplitSfcMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.production.model.SplitSfc">
<id column="HANDLE" property="handle" />
<result column="SITE" property="site" />
<result column="SFC" property="sfc" />
<result column="SPLIT_SFC" property="splitSfc" />
<result column="SPLIT_QTY" property="splitQty" />
<result column="ROUTER" property="router" />
<result column="CREATE_USER" property="createUser" />
<result column="CREATED_DATE_TIME" property="createdDateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, SFC, SPLIT_SFC, SPLIT_QTY, ROUTER, CREATE_USER, CREATED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_SPLIT_SFC WHERE HANDLE=#{handle}
</select>
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_SPLIT_SFC
<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_SPLIT_SFC 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_SPLIT_SFC
<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.splitSfc!=null"> AND SPLIT_SFC=#{ew.entity.splitSfc}</if>
<if test="ew.entity.splitQty!=null"> AND SPLIT_QTY=#{ew.entity.splitQty}</if>
<if test="ew.entity.router!=null"> AND ROUTER=#{ew.entity.router}</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_SPLIT_SFC
<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.splitSfc!=null"> AND SPLIT_SFC=#{ew.entity.splitSfc}</if>
<if test="ew.entity.splitQty!=null"> AND SPLIT_QTY=#{ew.entity.splitQty}</if>
<if test="ew.entity.router!=null"> AND ROUTER=#{ew.entity.router}</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_SPLIT_SFC
<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.splitSfc!=null"> AND SPLIT_SFC=#{ew.entity.splitSfc}</if>
<if test="ew.entity.splitQty!=null"> AND SPLIT_QTY=#{ew.entity.splitQty}</if>
<if test="ew.entity.router!=null"> AND ROUTER=#{ew.entity.router}</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_SPLIT_SFC
<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.splitSfc!=null"> AND SPLIT_SFC=#{ew.entity.splitSfc}</if>
<if test="ew.entity.splitQty!=null"> AND SPLIT_QTY=#{ew.entity.splitQty}</if>
<if test="ew.entity.router!=null"> AND ROUTER=#{ew.entity.router}</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_SPLIT_SFC
<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.splitSfc!=null"> AND SPLIT_SFC=#{ew.entity.splitSfc}</if>
<if test="ew.entity.splitQty!=null"> AND SPLIT_QTY=#{ew.entity.splitQty}</if>
<if test="ew.entity.router!=null"> AND ROUTER=#{ew.entity.router}</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_SPLIT_SFC
<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.splitSfc!=null"> AND SPLIT_SFC=#{ew.entity.splitSfc}</if>
<if test="ew.entity.splitQty!=null"> AND SPLIT_QTY=#{ew.entity.splitQty}</if>
<if test="ew.entity.router!=null"> AND ROUTER=#{ew.entity.router}</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_SPLIT_SFC
<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.splitSfc!=null"> AND SPLIT_SFC=#{ew.entity.splitSfc}</if>
<if test="ew.entity.splitQty!=null"> AND SPLIT_QTY=#{ew.entity.splitQty}</if>
<if test="ew.entity.router!=null"> AND ROUTER=#{ew.entity.router}</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.SplitSfc">
INSERT INTO Z_SPLIT_SFC
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="site!=null">SITE,</if>
<if test="sfc!=null">SFC,</if>
<if test="splitSfc!=null">SPLIT_SFC,</if>
<if test="splitQty!=null">SPLIT_QTY,</if>
<if test="router!=null">ROUTER,</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="sfc!=null">#{sfc},</if>
<if test="splitSfc!=null">#{splitSfc},</if>
<if test="splitQty!=null">#{splitQty},</if>
<if test="router!=null">#{router},</if>
<if test="createUser!=null">#{createUser},</if>
<if test="createdDateTime!=null">#{createdDateTime},</if>
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.production.model.SplitSfc">
INSERT INTO Z_SPLIT_SFC
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{site},
#{sfc},
#{splitSfc},
#{splitQty},
#{router},
#{createUser},
#{createdDateTime},
</trim>
</insert>
<update id="updateById">
UPDATE Z_SPLIT_SFC <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.splitSfc!=null">SPLIT_SFC=#{et.splitSfc},</if>
<if test="et.splitQty!=null">SPLIT_QTY=#{et.splitQty},</if>
<if test="et.router!=null">ROUTER=#{et.router},</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_SPLIT_SFC <trim prefix="SET" suffixOverrides=",">
SITE=#{et.site},
SFC=#{et.sfc},
SPLIT_SFC=#{et.splitSfc},
SPLIT_QTY=#{et.splitQty},
ROUTER=#{et.router},
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_SPLIT_SFC <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.splitSfc!=null">SPLIT_SFC=#{et.splitSfc},</if>
<if test="et.splitQty!=null">SPLIT_QTY=#{et.splitQty},</if>
<if test="et.router!=null">ROUTER=#{et.router},</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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.splitSfc!=null"> AND SPLIT_SFC=#{ew.entity.splitSfc}</if>
<if test="ew.entity.splitQty!=null"> AND SPLIT_QTY=#{ew.entity.splitQty}</if>
<if test="ew.entity.router!=null"> AND ROUTER=#{ew.entity.router}</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_SPLIT_SFC WHERE HANDLE=#{handle}
</delete>
<delete id="deleteByMap">
DELETE FROM Z_SPLIT_SFC
<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_SPLIT_SFC
<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.splitSfc!=null"> AND SPLIT_SFC=#{ew.entity.splitSfc}</if>
<if test="ew.entity.splitQty!=null"> AND SPLIT_QTY=#{ew.entity.splitQty}</if>
<if test="ew.entity.router!=null"> AND ROUTER=#{ew.entity.router}</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_SPLIT_SFC WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="getSfcData" resultType="com.foreverwin.mesnac.meapi.dto.SfcDto">
SELECT SO.SHOP_ORDER,cf.VALUE WORK_ORDER,OP.OPERATION,ss.STEP_ID,s.qty FROM SFC S
JOIN SHOP_ORDER SO ON so.HANDLE=S.SHOP_ORDER_BO
LEFT JOIN CUSTOM_FIELDS CF ON cf.HANDLE=s.SHOP_ORDER_BO AND CF."ATTRIBUTE"='WORK_ORDER'
JOIN SFC_ROUTING SR ON s.HANDLE=sr.SFC_BO
JOIN SFC_ROUTER SR2 ON SR.HANDLE =SR2.SFC_ROUTING_BO AND SR2.IN_USE = 'true'
JOIN SFC_STEP SS ON SR2.HANDLE =SS.SFC_ROUTER_BO AND (SS.QTY_IN_QUEUE>0 or SS.QTY_IN_WORK>0)
JOIN OPERATION OP ON 'OperationBO:'|| OP.SITE ||','|| OP.OPERATION||',#'=SS.OPERATION_BO
WHERE S.HANDLE=#{handle}
</select>
<select id="getAbnormalQty" resultType="com.foreverwin.mesnac.production.dto.SplitSfcDto">
SELECT zab.NC_QTY,zsbd.ROUTER_BO,zab.NC_CODE FROM Z_ABNORMAL_BILL zab
JOIN Z_ABNORMAL_BILL_DISPOSE zsbd ON zab.HANDLE=ZSBD.ABNORMAL_BILL_BO
WHERE ZAB.SFC=#{sfc} AND zab.SITE=#{site} AND ZAB.OPERATION=#{operation} AND zab.STATUS='F' AND zab."TYPE"='Z'
</select>
</mapper>
Loading…
Cancel
Save