Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
6622be6dc6
@ -124,27 +124,6 @@
|
||||
<artifactId>jtds</artifactId>
|
||||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
<!--WebService-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web-services</artifactId>
|
||||
</dependency>
|
||||
<!--JAXB(用于处理XML和SOAP消息)-->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-oxm</artifactId>
|
||||
</dependency>
|
||||
<!--CXF webservices-->
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
|
||||
<version>4.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.jws</groupId>
|
||||
<artifactId>jakarta.jws-api</artifactId>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -66,6 +66,12 @@
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<!--CXF webservices-->
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
|
||||
<version>3.4.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,36 @@
|
||||
package com.ktg.mes.md.config;
|
||||
|
||||
import com.ktg.mes.md.service.IMasterDataSyncService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.cxf.Bus;
|
||||
import org.apache.cxf.bus.spring.SpringBus;
|
||||
import org.apache.cxf.jaxws.EndpointImpl;
|
||||
import org.apache.cxf.transport.servlet.CXFServlet;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.xml.ws.Endpoint;
|
||||
|
||||
@Configuration
|
||||
@RequiredArgsConstructor
|
||||
public class WebServiceConfig {
|
||||
private final IMasterDataSyncService masterDataSyncService;
|
||||
|
||||
@Bean(name = Bus.DEFAULT_BUS_ID)
|
||||
public SpringBus springBus() {
|
||||
return new SpringBus();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean<CXFServlet> cxfServlet() {
|
||||
return new ServletRegistrationBean<>(new CXFServlet(), "/WebServices/open/*");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Endpoint endpoint() {
|
||||
EndpointImpl endpoint = new EndpointImpl(springBus(), masterDataSyncService);
|
||||
endpoint.publish("/MasterDataSyncService");
|
||||
return endpoint;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -36,6 +36,9 @@ public class MdItem extends BaseEntity {
|
||||
private String safeStockFlag;
|
||||
private Integer minStock;
|
||||
private Double maxStock;
|
||||
private Double length;
|
||||
private Double width;
|
||||
private Double height;
|
||||
private String highValue;
|
||||
private Integer attr1;
|
||||
private Integer attr2;
|
||||
@ -228,6 +231,30 @@ public class MdItem extends BaseEntity {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public Double getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public void setLength(Double length) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public Double getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(Double width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public Double getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(Double height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MdItem{" +
|
||||
|
@ -123,4 +123,6 @@ public interface BaseKnifeMapper {
|
||||
List<BaseKnife> selectBaseKnifeNotValidList(BaseKnife baseKnifeWrapper);
|
||||
|
||||
List<String> selectNotEmptyAreaCodeList();
|
||||
|
||||
List<BaseKnife> selectBaseKnifeListByMbbBdMrlId(Long itemId);
|
||||
}
|
||||
|
@ -2,29 +2,40 @@ package com.ktg.mes.md.service;
|
||||
|
||||
import javax.jws.WebMethod;
|
||||
import javax.jws.WebParam;
|
||||
import javax.jws.WebResult;
|
||||
import javax.jws.WebService;
|
||||
import javax.swing.*;
|
||||
|
||||
@WebService(name = "masterDataSyncService", targetNamespace = "http://server.spring.zhang.pers/")
|
||||
@WebService(name = IMasterDataSyncService.SERVICE_NAME, targetNamespace = IMasterDataSyncService.TARGET_NAMESPACE)
|
||||
public interface IMasterDataSyncService {
|
||||
String SERVICE_NAME = "MasterDataSyncService";
|
||||
|
||||
String TARGET_NAMESPACE = "http://server.spring.zhang.pers/";
|
||||
|
||||
/**
|
||||
* 同步物料数据
|
||||
*
|
||||
* @param materialListStr 物料列表
|
||||
*/
|
||||
@WebMethod(operationName = "syncMaterial")
|
||||
String syncMaterial(@WebParam(name = "materialList") Spring materialListStr);
|
||||
@WebResult
|
||||
String syncMaterial(@WebParam(name = "materialListStr") String materialListStr);
|
||||
|
||||
/**
|
||||
* 同步物料分类数据
|
||||
*
|
||||
* @param materialCategoryListStr 物料分类列表
|
||||
*/
|
||||
@WebMethod(operationName = "syncMaterialCategory")
|
||||
String syncMaterialCategory(@WebParam(name = "materialCategoryList") Spring materialCategoryListStr);
|
||||
@WebResult
|
||||
String syncMaterialCategory(@WebParam(name = "materialCategoryList") String materialCategoryListStr);
|
||||
|
||||
/**
|
||||
* 同步计量单位数据
|
||||
*
|
||||
* @param unitListStr 计量单位列表
|
||||
*/
|
||||
@WebMethod(operationName = "syncUnit")
|
||||
String syncUnit(@WebParam(name = "unitList") Spring unitListStr);
|
||||
@WebResult
|
||||
String syncUnit(@WebParam(name = "unitList") String unitListStr);
|
||||
}
|
||||
|
@ -127,27 +127,6 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService {
|
||||
hashMap.put("isToolSetting", nowWmsOutPlanDetailEntity.getIsToolSetting()); // 是否对刀
|
||||
hashMap.put("toolSettingParam", nowWmsOutPlanDetailEntity.getToolSettingParam()); // 对刀参数
|
||||
|
||||
// // 读取xml配置文件
|
||||
// if ("PRODUCT".equals(nowWmsOutPlanDetailEntity.getItemOrProduct())) {
|
||||
// try {
|
||||
// // 抓取远程文件
|
||||
// this.getRemoteFile();
|
||||
//
|
||||
// // 读取本地文件
|
||||
// File xmlFile = new File(myConfig.getToolSettingXmlPath() + CalendarUtil.getDateTimeStrForFile() + "/TSP1203.xml");
|
||||
// JAXBContext jaxbContext = JAXBContext.newInstance(Tools.class);
|
||||
// Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
||||
// Tools paramXml = (Tools) unmarshaller.unmarshal(xmlFile);
|
||||
//
|
||||
// hashMap.put("isToolSetting", 1); // 是否对刀
|
||||
// hashMap.put("toolSettingParam", JSON.toJSONString(paramXml)); // 对刀参数
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// System.out.println("系统找不到指定文件!");
|
||||
//// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
|
||||
/* 实体 */
|
||||
String outTime = null;
|
||||
if (nowWmsOutPlanDetailEntity.getCreateTime() != null)
|
||||
@ -176,74 +155,6 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService {
|
||||
return baseKnifeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取远程文件
|
||||
*/
|
||||
public void getRemoteFile() throws IOException {
|
||||
try {
|
||||
// 创建认证用户
|
||||
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("", myConfig.getRemoteUser(), myConfig.getRemotePass());
|
||||
|
||||
// 构建远程文件对象
|
||||
SmbFile remoteFile = new SmbFile(myConfig.getRemoteUrl(), auth);
|
||||
// 尝试链接
|
||||
remoteFile.connect();
|
||||
if(remoteFile.exists()){
|
||||
// 获取共享文件夹中文件列表
|
||||
SmbFile[] smbFiles = remoteFile.listFiles();
|
||||
for (SmbFile smbFile : smbFiles){
|
||||
createFile(smbFile);
|
||||
}
|
||||
} else {
|
||||
System.out.println("==============START=================");
|
||||
System.out.println("远程文件不存在");
|
||||
System.out.println("===============END==================");
|
||||
}
|
||||
} catch (Exception e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建本地文件
|
||||
*/
|
||||
public void createFile(SmbFile remoteFile) {
|
||||
InputStream in = null;
|
||||
OutputStream out = null;
|
||||
try {
|
||||
// 创建本地文件
|
||||
// File localFile = new File("E:/xml_wjj/" + CalendarUtil.getDateTimeStrForFile() + "/" + remoteFile.getName());
|
||||
File localFile = new File(myConfig.getToolSettingXmlPath() + CalendarUtil.getDateTimeStrForFile() + "/" + remoteFile.getName());
|
||||
if (!localFile.getParentFile().exists()) localFile.getParentFile().mkdirs();
|
||||
if (!localFile.exists()) localFile.createNewFile();
|
||||
else {
|
||||
localFile.delete();
|
||||
localFile.createNewFile();
|
||||
}
|
||||
in = new BufferedInputStream(new SmbFileInputStream(remoteFile));
|
||||
// 获取远程输出流
|
||||
out = new BufferedOutputStream(new FileOutputStream(localFile));
|
||||
byte[] buffer = new byte[4096];
|
||||
int len = 0;
|
||||
// 写入
|
||||
while ((len = in.read(buffer, 0, buffer.length)) != -1) {
|
||||
out.write(buffer, 0, len);
|
||||
}
|
||||
out.flush(); // 刷新缓冲
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
try {
|
||||
if (out != null) out.close();
|
||||
if (in != null) in.close();
|
||||
} catch (Exception e){
|
||||
System.out.println("==============START=================");
|
||||
System.out.println("关闭资源发生错误!");
|
||||
System.out.println("===============END==================");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工具台账
|
||||
*
|
||||
|
@ -9,29 +9,40 @@ import com.ktg.mes.md.service.IMdUnitMeasureService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.codehaus.jackson.JsonNode;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.jws.WebService;
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
@WebService(name = IMasterDataSyncService.SERVICE_NAME, targetNamespace = IMasterDataSyncService.TARGET_NAMESPACE, endpointInterface = "com.ktg.mes.md.service.IMasterDataSyncService")
|
||||
public class MasterDataSyncServiceImpl implements IMasterDataSyncService {
|
||||
private final ItemTypeServiceImpl itemTypeService;
|
||||
private final IMdItemService mdItemService;
|
||||
private final IMdUnitMeasureService mdUnitMeasureService;
|
||||
|
||||
// 无参构造函数(供 CXF 使用)
|
||||
public MasterDataSyncServiceImpl() {
|
||||
this.itemTypeService = null;
|
||||
this.mdItemService = null;
|
||||
this.mdUnitMeasureService = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步物料数据
|
||||
*
|
||||
* @param materialListStr 物料列表
|
||||
*/
|
||||
@Override
|
||||
public String syncMaterial(Spring materialListStr) {
|
||||
public String syncMaterial(String materialListStr) {
|
||||
// 使用 ObjectMapper 来处理 JSON
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
try {
|
||||
// 解析传入的 JSON 字符串
|
||||
String jsonList = objectMapper.readTree(materialListStr.toString()).get("LIST").asText();
|
||||
String jsonList = objectMapper.readTree(materialListStr).get("LIST").asText();
|
||||
JsonNode jsonNode = objectMapper.readTree(jsonList);
|
||||
|
||||
for (JsonNode node : jsonNode) {
|
||||
@ -77,16 +88,17 @@ public class MasterDataSyncServiceImpl implements IMasterDataSyncService {
|
||||
|
||||
/**
|
||||
* 同步物料分类数据
|
||||
*
|
||||
* @param materialCategoryListStr 物料分类列表
|
||||
*/
|
||||
@Override
|
||||
public String syncMaterialCategory(Spring materialCategoryListStr) {
|
||||
public String syncMaterialCategory(String materialCategoryListStr) {
|
||||
// 使用 ObjectMapper 来处理 JSON
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
try {
|
||||
// 解析传入的 JSON 字符串
|
||||
String jsonList = objectMapper.readTree(materialCategoryListStr.toString()).get("LIST").asText();
|
||||
String jsonList = objectMapper.readTree(materialCategoryListStr).get("LIST").asText();
|
||||
JsonNode jsonNode = objectMapper.readTree(jsonList);
|
||||
|
||||
for (JsonNode node : jsonNode) {
|
||||
@ -144,16 +156,17 @@ public class MasterDataSyncServiceImpl implements IMasterDataSyncService {
|
||||
|
||||
/**
|
||||
* 同步计量单位数据
|
||||
*
|
||||
* @param unitListStr 计量单位列表
|
||||
*/
|
||||
@Override
|
||||
public String syncUnit(Spring unitListStr) {
|
||||
public String syncUnit(String unitListStr) {
|
||||
// 使用 ObjectMapper 来处理 JSON
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
try {
|
||||
// 解析传入的 JSON 字符串
|
||||
String jsonList = objectMapper.readTree(unitListStr.toString()).get("LIST").asText();
|
||||
String jsonList = objectMapper.readTree(unitListStr).get("LIST").asText();
|
||||
JsonNode jsonNode = objectMapper.readTree(jsonList);
|
||||
|
||||
for (JsonNode node : jsonNode) {
|
||||
|
@ -242,9 +242,12 @@ public class WmsInTaskController extends BaseController {
|
||||
List<BaseKnifeLocked> baseKnifeLockedList = baseKnifeLockedMapper.selectBaseKnifeLockedList(baseKnifeLockedWrapper);
|
||||
|
||||
// 获取实体并修改状态
|
||||
BaseKnifeLocked baseKnifeLocked = baseKnifeLockedList.get(0);
|
||||
BaseKnifeLocked baseKnifeLocked;
|
||||
if (!baseKnifeLockedList.isEmpty()){
|
||||
baseKnifeLocked = baseKnifeLockedList.get(0);
|
||||
baseKnifeLocked.setStatus(1);
|
||||
baseKnifeLockedMapper.updateBaseKnifeLocked(baseKnifeLocked);
|
||||
}
|
||||
|
||||
// 再次查询物料是否有预订订单
|
||||
baseKnifeLockedWrapper.setPlanSheet(null);
|
||||
|
@ -87,8 +87,8 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
|
||||
task.setCellY(wmStorageArea.getPositionY().toString());
|
||||
task.setCellZ(wmStorageArea.getPositionZ().toString());
|
||||
|
||||
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntityQuery);
|
||||
task.setWmsInPlanDetailEntityList(wmsInPlanDetailEntityList);
|
||||
// List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntityQuery);
|
||||
// task.setWmsInPlanDetailEntityList(wmsInPlanDetailEntityList);
|
||||
wmsInTaskList.add(task);
|
||||
});
|
||||
return wmsInTaskList;
|
||||
|
@ -270,7 +270,6 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
|
||||
|
||||
// 锁定物料
|
||||
int resetCount = 0;
|
||||
String rfid = "";
|
||||
for (MbbProduBom mbbProduBom : bomRoute.getMbbProduBomList()) {
|
||||
// 查询未锁定的物料
|
||||
baseKnifeWrapper.setMbbBdMrlId(mbbProduBom.getMdItemId());
|
||||
@ -281,12 +280,8 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
|
||||
int bomCount = mbbProduBom.getStandardDosage();
|
||||
for (BaseKnife wmsBaseKnife : baseKnifeList) {
|
||||
if (bomCount > 0) {
|
||||
if ("ITEM".equals(wmsBaseKnife.getItemOrProduct())) rfid = wmsBaseKnife.getRfid();
|
||||
wmsBaseKnife.setZdTaskId(zdTask.getWmsZdTaskId());
|
||||
wmsBaseKnife.setIsLocked(1);
|
||||
wmsBaseKnife.setRfid("");
|
||||
// wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
|
||||
// wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime());
|
||||
wmsBaseKnife.setParentId(baseKnife.getBaseKnifeId());
|
||||
wmsBaseKnife.setPlanSheet(zdTask.getPlanSheet());
|
||||
baseKnifeListOutPlan.add(wmsBaseKnife);
|
||||
@ -301,7 +296,9 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
|
||||
|
||||
// 更新重置次数
|
||||
baseKnife.setResetCount(resetCount - 1);
|
||||
baseKnife.setRfid(rfid);
|
||||
// 设置rfid, 为整刀编码加序号 例如整刀编码为 aaa 则整刀rfid为 aaa0001 aaa0002, 传个i:在当前事务中新增的台账还没提交,所以把循环系数加上
|
||||
baseKnife.setRfid(this.getProductRfid(zdTask.getmProductId(), i));
|
||||
|
||||
baseKnifeMapper.updateBaseKnife(baseKnife);
|
||||
}
|
||||
|
||||
@ -397,6 +394,18 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
public String getProductRfid(Long itemId, int i){
|
||||
MdItem mdItem = mdItemMapper.selectMdItemById(itemId);
|
||||
|
||||
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeListByMbbBdMrlId(itemId);
|
||||
if (baseKnifeList.isEmpty()) return mdItem.getItemCode() + String.format("%04d", 1);
|
||||
else {
|
||||
String index = baseKnifeList.get(0).getRfid().substring(baseKnifeList.get(0).getRfid().length() - 4);
|
||||
Integer indexInt = Integer.parseInt(index) + 1 + i;
|
||||
return mdItem.getItemCode() + String.format("%04d", indexInt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
|
@ -619,4 +619,15 @@
|
||||
WHERE KNIFE_FINE_STATE == 1
|
||||
GROUP BY AREA_CODE
|
||||
</select>
|
||||
|
||||
<select id="selectBaseKnifeListByMbbBdMrlId" resultType="com.ktg.mes.md.domain.BaseKnife">
|
||||
<include refid="selectBaseKnifeVo"/>
|
||||
<where>
|
||||
IS_VALID = 0
|
||||
<if test="mbbBdMrlId != null and mbbBdMrlId != ''">
|
||||
and MBB_BD_MRL_ID = #{mbbBdMrlId}
|
||||
</if>
|
||||
</where>
|
||||
order by rfid desc
|
||||
</select>
|
||||
</mapper>
|
@ -21,6 +21,9 @@
|
||||
<result property="minStock" column="min_stock"/>
|
||||
<result property="maxStock" column="max_stock"/>
|
||||
<result property="highValue" column="high_value"/>
|
||||
<result property="length" column="length"/>
|
||||
<result property="width" column="width"/>
|
||||
<result property="height" column="height"/>
|
||||
<result property="attr1" column="attr1"/>
|
||||
<result property="attr2" column="attr2"/>
|
||||
<result property="attr3" column="attr3"/>
|
||||
@ -50,6 +53,9 @@
|
||||
min_stock,
|
||||
max_stock,
|
||||
high_value,
|
||||
length,
|
||||
width,
|
||||
height,
|
||||
attr1,
|
||||
attr2,
|
||||
attr3,
|
||||
@ -195,6 +201,15 @@
|
||||
<if test="highValue != null and highValue != ''">
|
||||
high_value,
|
||||
</if>
|
||||
<if test="length != null and length != ''">
|
||||
length,
|
||||
</if>
|
||||
<if test="width != null and width != ''">
|
||||
width,
|
||||
</if>
|
||||
<if test="height != null and height != ''">
|
||||
height,
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark,
|
||||
</if>
|
||||
@ -247,6 +262,15 @@
|
||||
<if test="highValue != null and highValue != ''">
|
||||
#{highValue},
|
||||
</if>
|
||||
<if test="length != null and length != ''">
|
||||
#{length},
|
||||
</if>
|
||||
<if test="width != null and width != ''">
|
||||
#{width},
|
||||
</if>
|
||||
<if test="height != null and height != ''">
|
||||
#{height},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
#{remark},
|
||||
</if>
|
||||
@ -316,6 +340,15 @@
|
||||
<if test="highValue != null and highValue != ''">
|
||||
high_value = #{highValue},
|
||||
</if>
|
||||
<if test="length != null and length != ''">
|
||||
length = #{length},
|
||||
</if>
|
||||
<if test="width != null and width != ''">
|
||||
width = #{width},
|
||||
</if>
|
||||
<if test="height != null and height != ''">
|
||||
height = #{height},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
|
Loading…
Reference in New Issue
Block a user