Merge remote-tracking branch 'origin/master'

master
zpl 4 years ago
commit c64dc352dd

@ -42,6 +42,8 @@ public class AbnormalBillDto extends AbnormalBill {
private String resolveRemark;
private String ncCodeDescription;
public String getSeq() {
return seq;
}
@ -123,4 +125,12 @@ public class AbnormalBillDto extends AbnormalBill {
public void setReportUser(String reportUser) {
this.reportUser = reportUser;
}
public String getNcCodeDescription() {
return ncCodeDescription;
}
public void setNcCodeDescription(String ncCodeDescription) {
this.ncCodeDescription = ncCodeDescription;
}
}

@ -310,7 +310,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
public List<AbnormalBillDto> backLog(AbnormalBillDto abnormalBillDto) {
String language = LocaleContextHolder.getLocale().getLanguage();
return abnormalBillMapper.backLog(abnormalBillDto, language);
}
@Override
@ -767,7 +766,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
AbnormalBill abnormalBill = new AbnormalBill();
if(Constants.ABNORMAL_RESRCE.equals(category)){
abnormalNo = this.getNextNumber(category);
abnormalBill.setNcCode(ncCodes);
abnormalBill.setRepairDateTime(now);
abnormalBill.setType(category);

@ -56,6 +56,7 @@
<result column="CONFIRM_USER" property="confirmUser"/>
<result column="RESOLVE_REMARK" property="resolveRemark"/>
<result column="REPORT_SEND_USER_GROUP" property="reportSendUserGroup"/>
<result column="NC_CODE_DESCRIPTION" property="ncCodeDescription"/>
</resultMap>
<resultMap id="scrapDto" type="com.foreverwin.mesnac.common.dto.ScrapDto" >
@ -67,6 +68,7 @@
<result column="ITEM" property="item"/>
<result column="ROUTER" property="router"/>
<result column="BOM" property="bom"/>
<result column="REASON" property="reason"/>
</resultMap>
<!-- 通用查询结果列 -->
@ -874,13 +876,17 @@
<select id="backLog" resultMap="abnormalBillDto">
SELECT ROW_NUMBER() OVER(ORDER BY zab.ABNORMAL_NO ASC) SEQ,zab.ABNORMAL_NO ABNORMAL_NO,
zab.STATUS STATUS, it.DESCRIPTION ITEM_DESCRIPTION, zab.CREATED_DATE_TIME CREATED_DATE_TIME,zab.RESPONSE_DATE_TIME RESPONSE_DATE_TIME
,zab.CREATED_USER CREATED_USER,
zab.NC_CODE NC_CODE,zab.PB_DESCRIPTION PB_DESCRIPTION
FROM Z_ABNORMAL_BILL zab
LEFT JOIN ITEM i ON zab.ITEM_BO = i.HANDLE
LEFT JOIN ITEM_T it ON i.HANDLE = it.ITEM_BO AND it.LOCALE = #{language}
SELECT ROW_NUMBER() OVER(ORDER BY ZAB.ABNORMAL_NO ASC) SEQ,ZAB.ABNORMAL_NO ABNORMAL_NO,
ZAB.STATUS STATUS, IT.DESCRIPTION ITEM_DESCRIPTION, ZAB.CREATED_DATE_TIME CREATED_DATE_TIME,
ZAB.RESPONSE_DATE_TIME RESPONSE_DATE_TIME,
ZAB.CREATED_USER CREATED_USER,
ZAB.NC_CODE NC_CODE,ZAB.PB_DESCRIPTION PB_DESCRIPTION,
SUBSTR(LISTAGG(NCT.DESCRIPTION || ',') WITHIN GROUP(ORDER BY ZAB.ABNORMAL_NO),0,LENGTH(LISTAGG(NCT.DESCRIPTION || ',') WITHIN GROUP(ORDER BY ZAB.ABNORMAL_NO))-1) NC_CODE_DESCRIPTION
FROM Z_ABNORMAL_BILL ZAB
LEFT JOIN ITEM I ON ZAB.ITEM_BO = I.HANDLE
LEFT JOIN ITEM_T IT ON I.HANDLE = IT.ITEM_BO AND IT.LOCALE = #{language}
LEFT JOIN Z_ABNORMAL_NC_CODE ZANC ON ZANC.ABNORMAL_BILL_BO = ZAB.HANDLE
LEFT JOIN NC_CODE_T NCT ON NCT.NC_CODE_BO = 'NCCodeBO:'|| ZAB.SITE || ',' || ZANC.NC_CODE AND NCT.LOCALE = #{language}
<where>
<if test="abnormalBill != null">
<if test="abnormalBill.site != null and abnormalBill.site != ''">
@ -915,6 +921,8 @@
</if>
</if>
</where>
GROUP BY zab.ABNORMAL_NO,zab.STATUS,it.DESCRIPTION,zab.CREATED_DATE_TIME,zab.RESPONSE_DATE_TIME,
zab.CREATED_USER,zab.NC_CODE,zab.PB_DESCRIPTION
</select>
<select id="findAllByAbnormalNoDevice" resultMap="abnormalBillDto">
@ -976,25 +984,30 @@
<select id="findScrapDtoBySfc" resultMap="scrapDto">
SELECT S.SFC SFC, CASE WHEN S2.STATUS = '401' THEN '新建'
WHEN S2.STATUS = '402' THEN '排队'
WHEN S2.STATUS = '403' THEN '活动'
WHEN S2.STATUS = '407' THEN '报废'
END STATUS,
SUBSTR(SS.OPERATION_BO ,INSTR(SS.OPERATION_BO ,',',1)+1,(INSTR(SS.OPERATION_BO ,'#',1)-1)-(INSTR(SS.OPERATION_BO ,',',1)+1)) || '/' || SS.STEP_ID OPERATION,
ZSD.RESRCE RESRCE,ZSD.SHOP_ORDER SHOP_ORDER,
CASE WHEN I.ITEM != 'NULL' THEN I.ITEM || '/' || I.REVISION END ITEM,
CASE WHEN R.ROUTER != 'NULL' THEN R.ROUTER || '/' || R.REVISION END ROUTER ,
CASE WHEN B.BOM != 'NULL' THEN B.BOM || '/' || B.REVISION END BOM
WHEN S2.STATUS = '402' THEN '排队'
WHEN S2.STATUS = '403' THEN '活动'
WHEN S2.STATUS = '407' THEN '报废'
END STATUS,
SUBSTR(SS.OPERATION_BO ,INSTR(SS.OPERATION_BO ,',',1)+1,(INSTR(SS.OPERATION_BO ,'#',1)-1)-(INSTR(SS.OPERATION_BO ,',',1)+1)) || '/' || SS.STEP_ID OPERATION,
ZSD.RESRCE RESRCE,ZSD.SHOP_ORDER SHOP_ORDER,
CASE WHEN I.ITEM != 'NULL' THEN I.ITEM || '/' || I.REVISION END ITEM,
CASE WHEN R.ROUTER != 'NULL' THEN R.ROUTER || '/' || R.REVISION END ROUTER ,
CASE WHEN B.BOM != 'NULL' THEN B.BOM || '/' || B.REVISION END BOM,
CASE WHEN ZSS.HANDLE != 'NULL' THEN ZSS.REASON
ELSE ZABV.PB_DESCRIPTION
END REASON
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 AND (SS.QTY_IN_QUEUE > 0 OR SS.QTY_IN_WORK > 0)
INNER JOIN STATUS S2 ON S2.HANDLE = S.STATUS_BO
INNER JOIN Z_SFC_DISPATCH ZSD ON ZSD.DISPATCH_NO = S.SFC || '-' || SS.STEP_ID
LEFT JOIN SHOP_ORDER SO ON SO.SHOP_ORDER = ZSD.SHOP_ORDER AND SO.SITE = S.SITE
LEFT JOIN ITEM I ON I.HANDLE = SO.PLANNED_ITEM_BO
LEFT JOIN ROUTER R ON R.HANDLE = ZSD.ROUTER_BO
LEFT JOIN BOM B ON B.HANDLE = SO.PLANNED_BOM_BO
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 AND (SS.QTY_IN_QUEUE > 0 OR SS.QTY_IN_WORK > 0)
INNER JOIN STATUS S2 ON S2.HANDLE = S.STATUS_BO
INNER JOIN Z_SFC_DISPATCH ZSD ON ZSD.DISPATCH_NO = S.SFC || '-' || SS.STEP_ID
LEFT JOIN SHOP_ORDER SO ON SO.SHOP_ORDER = ZSD.SHOP_ORDER AND SO.SITE = S.SITE
LEFT JOIN ITEM I ON I.HANDLE = SO.PLANNED_ITEM_BO
LEFT JOIN ROUTER R ON R.HANDLE = ZSD.ROUTER_BO
LEFT JOIN Z_SFC_SCRAP ZSS ON ZSS.SFC = S.SFC AND ZSS.SITE = S.SITE
LEFT JOIN BOM B ON B.HANDLE = SO.PLANNED_BOM_BO
INNER JOIN ( SELECT * FROM Z_ABNORMAL_BILL_VIEW ZABV WHERE ZABV.HANDLE = (SELECT MAX(HANDLE) FROM Z_ABNORMAL_BILL_VIEW) ) ZABV ON ZABV.SFC = S.SFC AND ZABV.SITE= S.SITE
<where>
S.SITE = #{site} AND S.SFC = #{sfc}
</where>

@ -22,6 +22,8 @@ public class ScrapDto {
private String bom;
private String reason;
public String getSfc() {
return sfc;
}
@ -85,4 +87,12 @@ public class ScrapDto {
public void setBom(String bom) {
this.bom = bom;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
}

@ -85,8 +85,9 @@ public class InspectionTaskServiceImpl extends ServiceImpl<InspectionTaskMapper,
if (byId==null){
throw new BaseException("未找到检验任务");
}
if(StringUtil.notBlank(byId.getResult())){
throw new BaseException("检验任务已经保存完成!");
String result= byId.getResult();
if(StringUtil.notBlank(result)&&result.equals(Constants.RSESULT_OK)){
throw new BaseException("检验任务已经保存合格!");
}
task.setComments((String) paramMap.get("COMMENTS"));
task.setStatus(Constants.INSPECTION_TASK_STATUS_COMPLETE);

@ -22,6 +22,7 @@ import com.foreverwin.mesnac.common.service.PrintLogService;
import com.foreverwin.mesnac.common.service.ProdReadyTaskDetailService;
import com.foreverwin.mesnac.common.service.ProdReadyTaskService;
import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
import com.foreverwin.mesnac.common.util.DateUtil;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.dto.BomComponentDto;
import com.foreverwin.mesnac.meapi.model.Item;
@ -33,18 +34,20 @@ 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 org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.jms.ConnectionFactory;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* <p>
@ -65,7 +68,8 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
public static final String STATUS_DOING = "DOING";
public static final String STATUS_FINISH = "FINISH";
public static final String STATUS_CANCEL = "CANCEL";
@Value("${spring.activemq.brokerUrl}")
String brokerURL;
@Value("${print.server}")
private String printServer;
@Autowired
@ -146,9 +150,9 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
String accessoryType = bomComponentDto.getAccessoryType();
//物料P001校验当前派工单SFC+工序/步骤)加工是否需要准备物料
if (accessoryType == null || accessoryType.equals("0")) {
if (prodReadyTaskDetailList.size()>0){
if (prodReadyTaskDetailList.size() > 0) {
long count = prodReadyTaskDetailList.stream().filter(prodReadyTaskDetail -> prodReadyTaskDetail.getInspectionItem().equals(P01)).count();
if (count>0){
if (count > 0) {
continue;
}
}
@ -164,9 +168,9 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
prodReadyTaskDetail.setModifiedDateTime(LocalDateTime.now());
prodReadyTaskDetailList.add(prodReadyTaskDetail);
} else if (accessoryType.equals("1")) {
if (prodReadyTaskDetailList.size()>0){
if (prodReadyTaskDetailList.size() > 0) {
long count = prodReadyTaskDetailList.stream().filter(prodReadyTaskDetail -> prodReadyTaskDetail.getInspectionItem().equals(P02)).count();
if (count>0){
if (count > 0) {
continue;
}
}
@ -268,7 +272,7 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
public List<Map<String, Object>> getInspectionDetailList(Map<String, String> param) {
String type = param.get("type");
String dispatchNo = param.get("dispatchNo");
List<Map<String, Object>> returnMap = null;
List<Map<String, Object>> returnMap = new ArrayList<>();
String site = CommonMethods.getSite();
if (type.equals(P01)) {
//物料接收数据
@ -278,6 +282,18 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
returnMap = prodReadyTaskMapper.getToolDetail(site, LocaleContextHolder.getLocale().getLanguage(), dispatchNo);
} else {
//通过加工的零件号、设备类型、设备获取发布状态的工控程序
SfcDispatchDto sfcdispatch=new SfcDispatchDto();
sfcdispatch.setHandle(HandleEnum.SFC_DISPATCH.getHandle(site,dispatchNo));
sfcdispatch = sfcDispatchCommonService.findSfcDispatchBySfc(sfcdispatch);
Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(site, sfcdispatch.getSfc()));
String itemBo = sfcServiceById.getItemBo();
JSONObject jsonObject = sendToDnc(StringUtil.trimHandle(itemBo), sfcdispatch.getResrce(), sfcdispatch.getResourceType());
Map<String, Object> map=new HashMap<>();
map.put("RESOURCE",sfcdispatch.getResrce());
map.put("RESOURCE_TYPE",sfcdispatch.getResourceType());
map.put("RESULT",jsonObject.get("RESULT"));
map.put("MESSAGE",jsonObject.get("MESSAGE"));
returnMap.add(map);
}
return returnMap;
}
@ -289,7 +305,7 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
if (byId.getStatus().equals(STATUS_CANCEL)) {
throw new BaseException("产前准备任务任务已取消");
}
if (byId.getStatus().equals(STATUS_FINISH)&&byId.getResult().equals(Constants.RSESULT_OK)) {
if (byId.getStatus().equals(STATUS_FINISH) && byId.getResult().equals(Constants.RSESULT_OK)) {
throw new BaseException("产前准备任务任务已完成");
}
List<ProdReadyTaskDetail> prodReadyTaskDetailList = prodReadyTask.getProdReadyTaskDetailList();
@ -314,70 +330,70 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
String sfcDispatchBo = prodReadyTask.getSfcDispatchBo();
SfcDispatchDto sfcDispatchDto=new SfcDispatchDto();
SfcDispatchDto sfcDispatchDto = new SfcDispatchDto();
sfcDispatchDto.setHandle(sfcDispatchBo);
sfcDispatchDto = sfcDispatchCommonService.findSfcDispatchBySfc(sfcDispatchDto);
List<PrintLog> printList=new ArrayList<>();
List<PrintLog> printList = new ArrayList<>();
List<LabelPrintDto> labelPrintDtoList = new ArrayList<>();
String printData = null;
PrintLog printTag=new PrintLog();
PrintLog printTag = new PrintLog();
String resrce = sfcDispatchDto.getResrce();
String printName = customFieldsService.getCustomFieldsValue(HandleEnum.RESOURCE.getHandle(site, resrce), CustomFieldConstant.RESRCE_CUSTOM_FIELD_PRINT_NAME);
if (StringUtil.isBlank(printName)){
if (StringUtil.isBlank(printName)) {
throw new BaseException("资源维护的打印机不能为空");
}
String item = prodReadyTask.getItem();
Item selectCurrent = itemService.selectCurrent(site, item);
QueryWrapper<PrintLog> queryWrapper=new QueryWrapper();
queryWrapper.eq(PrintLog.SFC,prodReadyTask.getSfc());
queryWrapper.eq(PrintLog.STEP_ID,prodReadyTask.getStepId());
queryWrapper.eq(PrintLog.RESRCE,prodReadyTask.getResrce());
queryWrapper.eq(PrintLog.CATEGORY,Constants.PRINT_TYPE_SFC);
queryWrapper.eq(PrintLog.CATEGORY,Constants.PRINT_TYPE_SFC);
QueryWrapper<PrintLog> queryWrapper = new QueryWrapper();
queryWrapper.eq(PrintLog.SFC, prodReadyTask.getSfc());
queryWrapper.eq(PrintLog.STEP_ID, prodReadyTask.getStepId());
queryWrapper.eq(PrintLog.RESRCE, prodReadyTask.getResrce());
queryWrapper.eq(PrintLog.CATEGORY, Constants.PRINT_TYPE_SFC);
queryWrapper.eq(PrintLog.CATEGORY, Constants.PRINT_TYPE_SFC);
List<PrintLog> printLogList = printLogService.list(queryWrapper);
if (printLogList.isEmpty()){
//打印参数
LabelPrintDto labelPrintDto = new LabelPrintDto();
labelPrintDto.setPrinter(printName);
labelPrintDto.setPrintTemplate(Constants.PRINT_TYPE_SFC);
labelPrintDto.setItem(sfcDispatchDto.getItem());
labelPrintDto.setItemDescription(selectCurrent.getDescription());
labelPrintDto.setSfc(prodReadyTask.getSfc());
Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(site, prodReadyTask.getSfc()));
String drawingRevision = customFieldsService.getCustomFieldsValue(sfcServiceById.getItemBo(), CustomFieldConstant.ITEM_DRAWING_REVISION);
labelPrintDto.setDrawingVersion(drawingRevision);
labelPrintDto.setQty(new BigDecimal(sfcServiceById.getQty()));
String workOrder = customFieldsService.getCustomFieldsValue(sfcServiceById.getShopOrderBo(), "WORK_ORDER");
labelPrintDto.setWorkOrder(workOrder);
labelPrintDto.setBlankingSize(sfcDispatchDto.getBlankingSize());
labelPrintDto.setOperation(sfcDispatchDto.getOperation());
labelPrintDtoList.add(labelPrintDto);
printData = JSON.toJSONString(labelPrintDtoList);
//打印记录
printTag.setHandle(UUID.randomUUID().toString());
printTag.setPrintName(printName);
printTag.setPrintTemplate(Constants.PRINT_TYPE_SFC);
printTag.setSite(site);
printTag.setCategory(Constants.PRINT_TYPE_SFC);
printTag.setPrintParam(JSON.toJSONString(labelPrintDtoList));
printTag.setSfc(prodReadyTask.getSfc());
printTag.setResrce(prodReadyTask.getResrce());
printTag.setStepId(prodReadyTask.getStepId());
printTag.setOperation(prodReadyTask.getOperation());
printTag.setItemBo(selectCurrent.getHandle());
printTag.setIsPrint("false");
printTag.setPrintNum(0);
printTag.setItem(item);
printTag.setItemDescription(selectCurrent.getDescription());
if (printLogList.isEmpty()) {
//打印参数
LabelPrintDto labelPrintDto = new LabelPrintDto();
labelPrintDto.setPrinter(printName);
labelPrintDto.setPrintTemplate(Constants.PRINT_TYPE_SFC);
labelPrintDto.setItem(sfcDispatchDto.getItem());
labelPrintDto.setItemDescription(selectCurrent.getDescription());
labelPrintDto.setSfc(prodReadyTask.getSfc());
Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(site, prodReadyTask.getSfc()));
String drawingRevision = customFieldsService.getCustomFieldsValue(sfcServiceById.getItemBo(), CustomFieldConstant.ITEM_DRAWING_REVISION);
labelPrintDto.setDrawingVersion(drawingRevision);
labelPrintDto.setQty(new BigDecimal(sfcServiceById.getQty()));
String workOrder = customFieldsService.getCustomFieldsValue(sfcServiceById.getShopOrderBo(), "WORK_ORDER");
labelPrintDto.setWorkOrder(workOrder);
labelPrintDto.setBlankingSize(sfcDispatchDto.getBlankingSize());
labelPrintDto.setOperation(sfcDispatchDto.getOperation());
labelPrintDtoList.add(labelPrintDto);
printData = JSON.toJSONString(labelPrintDtoList);
//打印记录
printTag.setHandle(UUID.randomUUID().toString());
printTag.setPrintName(printName);
printTag.setPrintTemplate(Constants.PRINT_TYPE_SFC);
printTag.setSite(site);
printTag.setCategory(Constants.PRINT_TYPE_SFC);
printTag.setPrintParam(JSON.toJSONString(labelPrintDtoList));
printTag.setSfc(prodReadyTask.getSfc());
printTag.setResrce(prodReadyTask.getResrce());
printTag.setStepId(prodReadyTask.getStepId());
printTag.setOperation(prodReadyTask.getOperation());
printTag.setItemBo(selectCurrent.getHandle());
printTag.setIsPrint("false");
printTag.setPrintNum(0);
printTag.setItem(item);
printTag.setItemDescription(selectCurrent.getDescription());
printList.add(printTag);
printLogService.savePrintLog(site,user,printTag);
printList.add(printTag);
printLogService.savePrintLog(site, user, printTag);
}else {
} else {
printData = printLogList.get(0).getPrintParam();
}
String post = HttpUtil.post(printServer,printData , 30000);
String post = HttpUtil.post(printServer, printData, 30000);
/**
* {"msg":"打印成功","code":0}
* {"msg":"打印失败","code":500}
@ -385,20 +401,20 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
*/
JSONObject jsonObject = JSONObject.parseObject(post);
String code = jsonObject.getString("code");
if (code == null){
if (code == null) {
}
if (post.indexOf("500") != -1){
if (post.indexOf("500") != -1) {
throw BusinessException.build("打印失败!");
}
if (printLogList.isEmpty()){
if (printLogList.isEmpty()) {
printTag.setIsPrint("true");
printTag.setPrintNum(1);
printLogService.updateById(printTag);
}else {
} else {
PrintLog printLog = printLogList.get(0);
printTag.setIsPrint("true");
printTag.setPrintNum(printLog.getPrintNum()+1);
printTag.setPrintNum(printLog.getPrintNum() + 1);
printTag.setModifiedDateTime(LocalDateTime.now());
printTag.setModifyUser(user);
printLogService.updateById(printLog);
@ -406,4 +422,47 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
}
public JSONObject sendToDnc(String item, String resource, String resourceType) {
String site = CommonMethods.getSite();
String queue="resource.check.process";
JSONObject messageObject=new JSONObject();
String tranid = UUID.randomUUID().toString();
messageObject.put("TRANID", tranid);
String dateTime = DateUtil.formatDate(new Date());
messageObject.put("DATE_TIME", dateTime);
messageObject.put("SITE", site);
messageObject.put("MESSAGE_ID", queue);
messageObject.put("ITEM", item);
messageObject.put("RESOURCE", resource);
messageObject.put("RESOURCE_TYPE", resourceType);
String causeMessage = null;
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
ActiveMQConnection.DEFAULT_USER,
ActiveMQConnection.DEFAULT_PASSWORD, brokerURL);
JmsMessagingTemplate jmsMessagingTemplate = new JmsMessagingTemplate(connectionFactory);
jmsMessagingTemplate.getJmsTemplate().setReceiveTimeout(TimeUnit.SECONDS.toMillis(30));
String message = jmsMessagingTemplate.convertSendAndReceive(queue, messageObject.toString(), String.class);
if (StringUtil.isBlank(message)) {
causeMessage = "队列消息消费超时或者未返回消费数据";
} else {
JSONObject jsonNode = JSONObject.parseObject(message);
String result = jsonNode.getString("STATUS");
if ("S".equalsIgnoreCase(result)) {
return jsonNode;
} else {
causeMessage = jsonNode.getString("MESSAGE");
}
}
JSONObject messageFailObject = new JSONObject();
messageFailObject.put("TRANID", tranid);
messageFailObject.put("RESULT", "E");
messageFailObject.put("MESSAGE", causeMessage);
return messageFailObject;
}
}

@ -40,6 +40,6 @@ activeMq:
queue: send.weChat.notice
exportDocument:
filePath: /Users/zhaojiawei/Desktop/青岛项目后台/mesnac5.biz/production/src/main/resources/
outputPath: /Users/zhaojiawei/Desktop/
template: scrap.ftl
filePath: /usr/word/
outputPath: /usr/word/outputWord/
template: SFC_SCRAP_TEMPLATE.ftl

@ -32,6 +32,21 @@ public class SplitSfcController {
return R.ok(result);
}
@ResponseBody
@GetMapping("/getGoodSfcData")
public R getGoodSfcData(String sfc){
SfcDto result;
result = splitSfcService.getGoodSfcData(sfc);
return R.ok(result);
}
@ResponseBody
@GetMapping("/goodSfcSplit")
public R goodSfcSplit(SfcDto sfcDto){
return R.ok(splitSfcService.goodSfcSplit(sfcDto));
}
@ResponseBody
@GetMapping("/splitSfc")
public R getSfcData(SfcDto sfcDto){

@ -29,5 +29,9 @@ public interface SplitSfcService extends IService<SplitSfc> {
SfcDto getSfcData(String sfc);
SfcDto getGoodSfcData(String sfc);
SplitSfc goodSfcSplit(SfcDto sfcDto);
SplitSfc splitSfc(SfcDto sfcDto);
}

@ -83,6 +83,63 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
return sfcData;
}
@Override
public SfcDto getGoodSfcData(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("未找到产品条码信息");
}
if (!sfcData.getStatus().equals("401")&&!sfcData.getStatus().equals("402")){
throw new BaseException("产品状态不可拆分");
}
if (sfcData.getQty()==1){
throw new BaseException("数量为1不可拆分");
}
return sfcData;
}
@Override
public SplitSfc goodSfcSplit(SfcDto sfcDto){
String site = CommonMethods.getSite();
String sfc = sfcDto.getSfc();
BigDecimal splitQty = new BigDecimal(sfcDto.getQty());
//根据sfc找工单等信息
SfcDto sfcData =getGoodSfcData(sfc);
SplitSfcRequest splitSfcRequest=new SplitSfcRequest();
try {
SplitSerializeServiceInterface splitService = MEServices.create("com.sap.me.production", "SplitSerializeService",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();
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.setCreateUser(CommonMethods.getUser());
splitSfc.setCreatedDateTime(LocalDateTime.now());
save(splitSfc);
String workCenterBo = shopOrderService.getById(HandleEnum.SHOP_ORDER.getHandle(site, sfcData.getShopOrder())).getPlannedWorkCenterBo();
return splitSfc;
} catch (Exception e) {
ExceptionUtil.throwException(e);
}
return null;
}
@Override
public SplitSfc splitSfc(SfcDto sfcDto){
String site = CommonMethods.getSite();
String sfc = sfcDto.getSfc();

@ -367,8 +367,9 @@
</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
SELECT SO.SHOP_ORDER,cf.VALUE WORK_ORDER,OP.OPERATION,ss.STEP_ID,s.QTY,ST.STATUS FROM SFC S
JOIN SHOP_ORDER SO ON so.HANDLE=S.SHOP_ORDER_BO
JOIN STATUS ST ON ST.HANDLE = S.STATUS_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'

Loading…
Cancel
Save