From 96751bb0359111343a62f08d29495e918d1f7811 Mon Sep 17 00:00:00 2001
From: yangwl <1726150332@qq.com>
Date: Fri, 14 Jan 2022 09:17:50 +0800
Subject: [PATCH] =?UTF-8?q?=E8=99=9A=E6=8B=9F=E6=89=93=E5=8D=B0=EF=BC=8C?=
=?UTF-8?q?=E5=9B=BE=E7=BA=B8=E7=89=88=E6=9C=AC=E8=BD=AC=E6=8D=A2=E5=88=B0?=
=?UTF-8?q?=E5=B7=A5=E5=8D=95=E4=B8=8B=E8=BE=BE=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../service/impl/AbnormalBillServiceImpl.java | 1 +
common/pom.xml | 30 +++
.../common/controller/FileController.java | 63 +++++++
.../common/controller/PrintLogController.java | 21 +++
.../common/service/PrintLogService.java | 11 ++
.../service/SfcDispatchCommonService.java | 3 +-
.../service/impl/PrintLogServiceImpl.java | 56 ++++++
.../src/main/resources/application-local.yml | 15 +-
.../src/main/resources/application-qas.yml | 7 +
.../service/ShopOrderReleaseService.java | 5 +-
.../service/impl/SfcDispatchServiceImpl.java | 6 +-
.../impl/ShopOrderReleaseServiceImpl.java | 176 ++++++++++--------
.../service/impl/CustomFieldsServiceImpl.java | 7 +-
13 files changed, 313 insertions(+), 88 deletions(-)
diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java
index 315bf96a..f5f49d27 100644
--- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java
+++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java
@@ -52,6 +52,7 @@ import com.foreverwin.modular.core.util.FrontPage;
import com.sap.me.nonconformance.*;
import com.sap.me.production.SplitSerializeServiceInterface;
import com.sap.me.production.SplitSfcRequest;
+
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/common/pom.xml b/common/pom.xml
index cab7f265..b85c8c44 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -110,6 +110,36 @@
commons-net
commons-net
+
+
+
+ com.itextpdf
+ itextpdf
+ 5.5.13
+
+
+ com.itextpdf
+ itext7-core
+ 7.2.0
+ pom
+
+
+
+ com.itextpdf
+ itext-asian
+ 5.2.0
+
+
+
+ com.google.zxing
+ core
+ 3.1.0
+
+
+ com.google.zxing
+ javase
+ 3.1.0
+
\ No newline at end of file
diff --git a/common/src/main/java/com/foreverwin/mesnac/common/controller/FileController.java b/common/src/main/java/com/foreverwin/mesnac/common/controller/FileController.java
index 1b273a2f..67608964 100644
--- a/common/src/main/java/com/foreverwin/mesnac/common/controller/FileController.java
+++ b/common/src/main/java/com/foreverwin/mesnac/common/controller/FileController.java
@@ -128,4 +128,67 @@ public class FileController {
return R.ok(null,"获取CAPP文件成功!");
}
+
+ /**
+ * 获取文件流
+ * @return
+ */
+ @ResponseBody
+ @RequestMapping(method = RequestMethod.GET, value = "/LabelPrintPdf/{fileName}")
+ public R getLabelPrintPdf(HttpServletRequest request, HttpServletResponse response, @PathVariable("fileName") String fileName) {
+ InputStream in = null;
+ OutputStream out = null;
+
+ String path = request.getParameter("Path").replace('-','/');;
+ String filepatch=path;
+ try {
+ FTPClient ftp= new FTPClient();
+ ftp.connect("172.16.251.187",8091); //连接ftp服务器
+ ftp.login("administrator","mes@123"); //登录ftp服务器
+ ftp.changeWorkingDirectory(filepatch);
+ ftp.storeFile("Label.pdf", in);
+ if(null == in){
+ in = ftpClient.getFtp(new String(path.getBytes("GBK"), FTPClient.DEFAULT_CONTROL_ENCODING));
+ }
+
+ //本地测试
+ /*String newPath = new String(path.getBytes("GBK"), FTPClient.DEFAULT_CONTROL_ENCODING);
+ in = plmFtpClient.getFtp(newPath);
+ if(null == in){
+ in = plmFtpClient.getFtp(new String(path.getBytes("UTF-8"), FTPClient.DEFAULT_CONTROL_ENCODING));
+ }*/
+
+ if(null == in){
+ throw new BaseException("获取FTP文件路径为:【"+path+"】的文件流失败!");
+ }
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=in.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);
+ }
+ byte[] data = outStream.toByteArray();
+ out = response.getOutputStream();
+ out.write(data);
+ out.flush();
+ ftp.logout();
+ ftp.disconnect();
+ }catch (Exception e){
+ return R.failed("下载文件失败:文件路径为"+path+":"+e.getMessage());
+ }finally {
+ try {
+ if(null != out){
+ out.close();
+ }
+ if(null != in){
+ in.close();
+ }
+
+ }catch (Exception e1){
+ return R.failed("下载文件失败:关闭文件流处理异常"+e1.getMessage());
+ }
+ }
+ return R.ok(null,"下载文件成功!");
+ }
+
}
\ No newline at end of file
diff --git a/common/src/main/java/com/foreverwin/mesnac/common/controller/PrintLogController.java b/common/src/main/java/com/foreverwin/mesnac/common/controller/PrintLogController.java
index cc70baef..ab35efa2 100644
--- a/common/src/main/java/com/foreverwin/mesnac/common/controller/PrintLogController.java
+++ b/common/src/main/java/com/foreverwin/mesnac/common/controller/PrintLogController.java
@@ -10,12 +10,18 @@ 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 com.itextpdf.text.Document;
+import com.itextpdf.text.PageSize;
+import com.itextpdf.text.pdf.PdfWriter;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.foreverwin.mesnac.common.service.PrintLogService;
import com.foreverwin.mesnac.common.model.PrintLog;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
import java.util.List;
import java.util.Map;
@@ -97,6 +103,21 @@ public class PrintLogController {
return R.ok();
}
+ @ResponseBody
+ @PostMapping("/exportLabel")
+ public R exportLabel(@RequestBody List requestList){
+ try {
+ if (requestList == null || requestList.size() <= 0) {
+ throw BusinessException.build("请选择至少一笔记录进行操作!");
+ }
+// String filepatch=printLogService.labelExport(requestList);
+ return R.ok(printLogService.labelExport(requestList));
+ }catch (Exception e){
+ return R.failed(e.getMessage());
+ }
+
+ }
+
/**
* 根据sfc,查询当前sfc的打印信息
diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/PrintLogService.java b/common/src/main/java/com/foreverwin/mesnac/common/service/PrintLogService.java
index f5a2aa36..ab840f44 100644
--- a/common/src/main/java/com/foreverwin/mesnac/common/service/PrintLogService.java
+++ b/common/src/main/java/com/foreverwin/mesnac/common/service/PrintLogService.java
@@ -3,7 +3,10 @@ package com.foreverwin.mesnac.common.service;
import com.foreverwin.mesnac.common.dto.LabelPrintDto;
import com.foreverwin.mesnac.common.model.PrintLog;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.itextpdf.text.DocumentException;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -33,6 +36,14 @@ public interface PrintLogService extends IService {
*/
void labelPrint(String site, String user, List printList);
+ /**
+ * 标签导出
+ *
+ * @param printList
+ *
+ */
+ String labelExport(List printList) throws Exception;
+
/**
* 查询标签打印所有数据
* @param printLog
diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/SfcDispatchCommonService.java b/common/src/main/java/com/foreverwin/mesnac/common/service/SfcDispatchCommonService.java
index d2708cf8..c8d8fca9 100644
--- a/common/src/main/java/com/foreverwin/mesnac/common/service/SfcDispatchCommonService.java
+++ b/common/src/main/java/com/foreverwin/mesnac/common/service/SfcDispatchCommonService.java
@@ -2,6 +2,7 @@ package com.foreverwin.mesnac.common.service;
import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
+import java.io.IOException;
import java.math.BigDecimal;
/**
@@ -26,7 +27,7 @@ public interface SfcDispatchCommonService {
* @param routerBo
* @param stepSequence
*/
- void saveSplitSfcDispatch(String site, String user, String category, String shopOrder, String sfc, String operation, String stepId, String splitSfc, String routerBo, String stepSequence);
+ void saveSplitSfcDispatch(String site, String user, String category, String shopOrder, String sfc, String operation, String stepId, String splitSfc, String routerBo, String stepSequence) throws IOException;
/**
* 修改派工单状态
diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/impl/PrintLogServiceImpl.java b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/PrintLogServiceImpl.java
index 14bf4b90..1257b0d0 100644
--- a/common/src/main/java/com/foreverwin/mesnac/common/service/impl/PrintLogServiceImpl.java
+++ b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/PrintLogServiceImpl.java
@@ -12,14 +12,24 @@ import com.foreverwin.mesnac.common.model.PrintLog;
import com.foreverwin.mesnac.common.mapper.PrintLogMapper;
import com.foreverwin.mesnac.common.service.PrintLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.foreverwin.mesnac.common.util.DrawPrepareProducts;
+import com.foreverwin.mesnac.common.util.QRUtils;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods;
+import com.itextpdf.text.Document;
+import com.itextpdf.text.DocumentException;
+import com.itextpdf.text.Image;
+import com.itextpdf.text.PageSize;
+import com.itextpdf.text.pdf.PdfWriter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
+import javax.servlet.http.HttpServletResponse;
+import java.awt.*;
+import java.io.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
@@ -42,6 +52,21 @@ public class PrintLogServiceImpl extends ServiceImpl i
@Value("${print.server}")
private String printServer;
+ @Value("${exportLabel.qrPath}")
+ private String qrPath;
+
+ @Value("${exportLabel.destPath}")
+ private String destPath;
+
+ @Value("${exportLabel.original}")
+ private String original;
+
+ @Value("${exportLabel.finall}")
+ private String finall;
+
+ @Value("${exportLabel.filepatch}")
+ private String filepatch;
+
@Autowired
private PrintLogMapper printLogMapper;
@@ -103,6 +128,37 @@ public class PrintLogServiceImpl extends ServiceImpl i
}
+ @Override
+ public String labelExport(List requestList) throws Exception {
+ // 1.新建document对象
+ Document document = new Document(PageSize.A4);// 建立一个Document对象
+ // 2.建立一个书写器(Writer)与document对象关联
+ File file = new File(filepatch);
+ file.createNewFile();
+ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file));
+ //3.打开文件
+ document.open();
+
+ for (PrintLog printLog : requestList){
+ String s=printLog.getPrintParam();
+ System.out.println(s);
+// LabelPrintDto labelPrintDto=JSONObject.parseObject(printLog.getPrintParam(),LabelPrintDto.class);
+ //4.生成二维码
+ QRUtils.encode(printLog.getSfc(),qrPath,destPath);
+ //5.绘图
+ DrawPrepareProducts.mark(original, finall,
+ Color.black, "收货方","物料描述","数量","订单号","工序","下料尺寸","产品条码","物料编码");
+ Image image = Image.getInstance(finall);
+ image.setAlignment(Image.ALIGN_MIDDLE);
+ image.scalePercent(50); //依照比例缩放
+ //向pdf文档添加绘制好的图
+ document.add(image);
+ }
+ //关闭文档
+ document.close();
+ return "-pdfdownload";
+ }
+
@Override
public List getPrintLogListByCondition(PrintLog printLog) {
return printLogMapper.getPrintLogListByCondition(printLog);
diff --git a/console/src/main/resources/application-local.yml b/console/src/main/resources/application-local.yml
index 31107874..ed7f4699 100644
--- a/console/src/main/resources/application-local.yml
+++ b/console/src/main/resources/application-local.yml
@@ -131,4 +131,17 @@ cappftp:
# username: Administrator
# password: cappnew@123
# uploadDir:
-# downloadDir:
\ No newline at end of file
+# downloadDir:
+
+#exportLabel:
+# qrPath: /exportpdf/QRCODE.jpg
+# destPath: /exportpdf
+# original: /exportpdf/original.png
+# finall: /exportpdf/finall.png
+# filepatch: /exportpdf/标签导出.pdf
+exportLabel:
+ qrPath: D:\\img\\QRCODE.jpg
+ destPath: D:\\img\\
+ original: D:\\img\\original.png
+ finall: D:\\img\\finall.png
+ filepatch: D:\\img\\Label.pdf
\ No newline at end of file
diff --git a/console/src/main/resources/application-qas.yml b/console/src/main/resources/application-qas.yml
index 2f6e914a..ea153899 100644
--- a/console/src/main/resources/application-qas.yml
+++ b/console/src/main/resources/application-qas.yml
@@ -50,6 +50,13 @@ quartz:
print:
server: http://172.16.170.163:8022/print/mesnacprint
+exportLabel:
+ qrPath: /exportpdf/QRCODE.jpg
+ destPath: /exportpdf
+ original: /exportpdf/original.png
+ finall: /exportpdf/finall.png
+ filepatch: /exportpdf/标签导出.pdf
+
activeMq:
sendWeChatMessage: tcp://localhost:61616?wireFormat.maxInactivityDuration=0
queue: send.weChat.notice
diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/ShopOrderReleaseService.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/ShopOrderReleaseService.java
index 6f70aa2a..7ce634c0 100644
--- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/ShopOrderReleaseService.java
+++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/ShopOrderReleaseService.java
@@ -5,6 +5,7 @@ import com.foreverwin.mesnac.dispatch.model.ShopOrderRelease;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.foreverwin.mesnac.meapi.model.ShopOrder;
+import java.io.IOException;
import java.util.List;
/**
@@ -62,7 +63,7 @@ public interface ShopOrderReleaseService {
* @param user
* @param shopOrderRelease
*/
- Boolean shopOrderRelease(String site, String user,StringBuffer message, ShopOrderRelease shopOrderRelease);
+ Boolean shopOrderRelease(String site, String user,StringBuffer message, ShopOrderRelease shopOrderRelease) throws IOException;
/**
* 工单整理- 刷新派工单
@@ -86,5 +87,5 @@ public interface ShopOrderReleaseService {
* @param sfcModel
* @param routerList
*/
- void sfcDispatch(String site, String user, ShopOrder shopOrderModel, Sfc sfcModel, List routerList);
+ void sfcDispatch(String site, String user, ShopOrder shopOrderModel, Sfc sfcModel, List routerList) throws IOException;
}
diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java
index ef2464fb..efb8fdea 100644
--- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java
+++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java
@@ -124,9 +124,9 @@ public class SfcDispatchServiceImpl extends ServiceImpl selectShopOrderRouter(String routerBo) {
return shopOrderReleaseMapper.selectShopOrderRouter(routerBo);
@@ -130,7 +135,7 @@ public class ShopOrderReleaseServiceImpl implements ShopOrderReleaseService {
}
}
@Override
- public Boolean shopOrderRelease(String site, String user,StringBuffer message,ShopOrderRelease shopOrderRelease) {
+ public Boolean shopOrderRelease(String site, String user,StringBuffer message,ShopOrderRelease shopOrderRelease) throws IOException {
//工单标准服务
ShopOrderServiceInterface shopOrderServiceInterface = null;
try {
@@ -200,7 +205,6 @@ public class ShopOrderReleaseServiceImpl implements ShopOrderReleaseService {
//组装派工数据
for (int i = 0 ; i < sfcList.size(); i++) {
ReleasedSfc releasedSfc = sfcList.get(i);
-
Sfc sfcModel = new Sfc();
sfcModel.setSfc(releasedSfc.getSfc());
sfcModel.setQty(releasedSfc.getQuantity().doubleValue());
@@ -213,7 +217,7 @@ public class ShopOrderReleaseServiceImpl implements ShopOrderReleaseService {
//------------------------------------------------------------------------------------------------------------------
/**派工--按工序**/
@Override
- public void sfcDispatch(String site, String user, ShopOrder shopOrderModel, Sfc sfcModel, List routerList) {
+ public void sfcDispatch(String site, String user, ShopOrder shopOrderModel, Sfc sfcModel, List routerList) throws IOException {
LocalDateTime nowDate = LocalDateTime.now();
String router = routerList.get(0).getRouter();
@@ -233,11 +237,13 @@ public class ShopOrderReleaseServiceImpl implements ShopOrderReleaseService {
}
String sfc = sfcModel.getSfc();
+ String itemBo=sfcModel.getItemBo();
String shopOrder = shopOrderModel.getShopOrder();
String stepId = "";
String nextStepBo = "";
String operation = "";
String routerStepBo = entryRouterStepBo;
+
//首工序计划开始时间为工单计划开始时间
//LocalDateTime plannedStartDate = shopOrderModel.getPlannedStartDate();
//LocalDateTime plannedCompleteDate = shopOrderModel.getPlannedStartDate();
@@ -250,87 +256,101 @@ public class ShopOrderReleaseServiceImpl implements ShopOrderReleaseService {
List sfcDispatchList = new ArrayList<>();
//--------------------------------------------------------------------------------------------------------------
//循环步骤标识记录派工数据
- for (int m = 0 ; m < map.size(); m++) {
- RouterDTO routerDTO = map.get(routerStepBo);
- if (routerDTO == null) {
- break;
- }
- operation = routerDTO.getOperation();
- if (StringUtil.isBlank(operation)) {
- continue;
- }
-
- stepId = routerDTO.getStepId();
- nextStepBo = routerDTO.getNextStepBo();
- if (StringUtils.isBlank(nextStepBo) && m != map.size() -1) {
- continue;
- }
- String isFirstOperation = (m == 0) ? Constants.BOOL_TRUE : Constants.BOOL_FALSE;
- Double prodHours = new Double(this.prodHoursCl(operation, routerDTO.getProdHours()));
- //计算完成时间
- //plannedCompleteDate = plannedStartDate.plusMinutes(prodHours.longValue());
+ //登录Capp的FTP文件服务器
+ FTPClient connect = null;
+ try {
+ connect = cappFtpClient.login();
+ for (int m = 0 ; m < map.size(); m++) {
+ RouterDTO routerDTO = map.get(routerStepBo);
+ if (routerDTO == null) {
+ break;
+ }
+ operation = routerDTO.getOperation();
+ if (StringUtil.isBlank(operation)) {
+ continue;
+ }
- //查询工序所属车间
- String workCenter = null;
- if (operation.contains("_")) {
- workCenter = operation.split("_")[0];
- } else {
- workCenter = operation;
- }
- String workCenterBo = HandleEnum.WORK_CENTER.getHandle(site, workCenter);
- WorkCenter workCenterModel = workCenterService.getById(workCenterBo);
- if (workCenterModel == null) {
- throw BusinessException.build("生产车间【" +workCenter+ "】不存在");
- }
+ stepId = routerDTO.getStepId();
+ nextStepBo = routerDTO.getNextStepBo();
+ if (StringUtils.isBlank(nextStepBo) && m != map.size() -1) {
+ continue;
+ }
+ String isFirstOperation = (m == 0) ? Constants.BOOL_TRUE : Constants.BOOL_FALSE;
+
+ Double prodHours = new Double(this.prodHoursCl(operation, routerDTO.getProdHours()));
+ //计算完成时间
+ //plannedCompleteDate = plannedStartDate.plusMinutes(prodHours.longValue());
+
+ //查询工序所属车间
+ String workCenter = null;
+ if (operation.contains("_")) {
+ workCenter = operation.split("_")[0];
+ } else {
+ workCenter = operation;
+ }
+ String workCenterBo = HandleEnum.WORK_CENTER.getHandle(site, workCenter);
+ WorkCenter workCenterModel = workCenterService.getById(workCenterBo);
+ if (workCenterModel == null) {
+ throw BusinessException.build("生产车间【" +workCenter+ "】不存在");
+ }
- //派工数据
- String dispatchNo = sfc + "-" + stepId;
- SfcDispatch sfcDispatchModel = new SfcDispatch();
- sfcDispatchModel.setHandle(HandleEnum.SFC_DISPATCH.getHandle(site, dispatchNo));
- sfcDispatchModel.setSite(site);
- sfcDispatchModel.setShopOrder(shopOrder);
- sfcDispatchModel.setSfc(sfc);
- sfcDispatchModel.setDispatchSeq((m + 1)+"");
- sfcDispatchModel.setDispatchNo(dispatchNo);
- sfcDispatchModel.setDispatchStatus(Constants.STATUS_NEW);
- sfcDispatchModel.setDrawingsNo("");
- sfcDispatchModel.setDrawingsRevision("");
- sfcDispatchModel.setIsLock(Constants.STATUS_N);
- sfcDispatchModel.setRouterBo(routerBo);
- sfcDispatchModel.setStepId(stepId);
- sfcDispatchModel.setOperation(operation);
- sfcDispatchModel.setResourceType(routerDTO.getResourceType());
- sfcDispatchModel.setWorkCenter(workCenter);
- sfcDispatchModel.setDispatchQty(sfcModel.getQty());
- sfcDispatchModel.setProdHours(prodHours);
- sfcDispatchModel.setTurnOperation("false");
- //sfcDispatchModel.setPlannedStartDate(plannedStartDate);
- //sfcDispatchModel.setPlannedCompleteDate(plannedCompleteDate);
- sfcDispatchModel.setSoReleasedDate(nowDate);
- sfcDispatchModel.setIsDispatch(Constants.BOOL_FALSE);
- sfcDispatchModel.setIsImport(Constants.BOOL_FALSE);
- sfcDispatchModel.setIsFirstOperation(isFirstOperation);
- sfcDispatchModel.setPrepositionStepId(prepositionStepId);
- sfcDispatchModel.setPrepositionOperation(prepositionOperation);
- sfcDispatchModel.setCreateUser(user);
- sfcDispatchModel.setCreatedDateTime(nowDate);
- sfcDispatchModel.setModifyUser(user);
- sfcDispatchModel.setModifiedDateTime(nowDate);
- sfcDispatchModel.setOther1("false");
- sfcDispatchList.add(sfcDispatchModel);
+ //派工数据
+ String dispatchNo = sfc + "-" + stepId;
+ SfcDispatch sfcDispatchModel = new SfcDispatch();
+ sfcDispatchModel.setHandle(HandleEnum.SFC_DISPATCH.getHandle(site, dispatchNo));
+ sfcDispatchModel.setSite(site);
+ sfcDispatchModel.setShopOrder(shopOrder);
+ sfcDispatchModel.setSfc(sfc);
+ sfcDispatchModel.setDispatchSeq((m + 1)+"");
+ sfcDispatchModel.setDispatchNo(dispatchNo);
+ sfcDispatchModel.setDispatchStatus(Constants.STATUS_NEW);
+ sfcDispatchModel.setDrawingsNo("");
+ sfcDispatchModel.setDrawingsRevision(GetDrawingVersionUtil.GetDrawingVerson(itemBo, connect));
+// sfcDispatchModel.setDrawingsRevision("");
+ sfcDispatchModel.setIsLock(Constants.STATUS_N);
+ sfcDispatchModel.setRouterBo(routerBo);
+ sfcDispatchModel.setStepId(stepId);
+ sfcDispatchModel.setOperation(operation);
+ sfcDispatchModel.setResourceType(routerDTO.getResourceType());
+ sfcDispatchModel.setWorkCenter(workCenter);
+ sfcDispatchModel.setDispatchQty(sfcModel.getQty());
+ sfcDispatchModel.setProdHours(prodHours);
+ sfcDispatchModel.setTurnOperation("false");
+ //sfcDispatchModel.setPlannedStartDate(plannedStartDate);
+ //sfcDispatchModel.setPlannedCompleteDate(plannedCompleteDate);
+ sfcDispatchModel.setSoReleasedDate(nowDate);
+ sfcDispatchModel.setIsDispatch(Constants.BOOL_FALSE);
+ sfcDispatchModel.setIsImport(Constants.BOOL_FALSE);
+ sfcDispatchModel.setIsFirstOperation(isFirstOperation);
+ sfcDispatchModel.setPrepositionStepId(prepositionStepId);
+ sfcDispatchModel.setPrepositionOperation(prepositionOperation);
+ sfcDispatchModel.setCreateUser(user);
+ sfcDispatchModel.setCreatedDateTime(nowDate);
+ sfcDispatchModel.setModifyUser(user);
+ sfcDispatchModel.setModifiedDateTime(nowDate);
+ sfcDispatchModel.setOther1("false");
+ sfcDispatchList.add(sfcDispatchModel);
- //计划开始时间累加
- //plannedStartDate = plannedCompleteDate;
+ //计划开始时间累加
+ //plannedStartDate = plannedCompleteDate;
- //赋值下一步骤
- routerStepBo = routerDTO.getNextStepBo();
+ //赋值下一步骤
+ routerStepBo = routerDTO.getNextStepBo();
- //前置工序&步骤赋值
- prepositionStepId = stepId;
- prepositionOperation = operation;
+ //前置工序&步骤赋值
+ prepositionStepId = stepId;
+ prepositionOperation = operation;
+ }
+ }catch (Exception e){
+ ExceptionUtil.throwException(e);
+ }
+ finally {
+ if (connect!=null&&connect.isConnected()){
+ connect.logout();
+ connect.disconnect();
+ }
}
-
//批量插入工位&人员派工数据
sfcDispatchService.saveBatch(sfcDispatchList);
}
diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/CustomFieldsServiceImpl.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/CustomFieldsServiceImpl.java
index a6ea0ffc..2b3457cc 100644
--- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/CustomFieldsServiceImpl.java
+++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/CustomFieldsServiceImpl.java
@@ -7,8 +7,9 @@ import com.foreverwin.mesnac.meapi.model.CustomFields;
import com.foreverwin.mesnac.meapi.mapper.CustomFieldsMapper;
import com.foreverwin.mesnac.meapi.service.CustomFieldsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
+
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
@@ -67,7 +68,7 @@ public class CustomFieldsServiceImpl extends ServiceImpl customFieldsWrapper = new QueryWrapper<>();