完成入库计划显示库位物料信息,完成整刀rfid根据物料编码加序号自动生成,完成开放更新整刀寿命接口

This commit is contained in:
汤锦科 2024-12-17 17:47:46 +08:00
parent 43bb62dbdc
commit b8a861c5c1
9 changed files with 383 additions and 800 deletions

View File

@ -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{" +

View File

@ -123,4 +123,6 @@ public interface BaseKnifeMapper {
List<BaseKnife> selectBaseKnifeNotValidList(BaseKnife baseKnifeWrapper);
List<String> selectNotEmptyAreaCodeList();
List<BaseKnife> selectBaseKnifeListByMbbBdMrlId(Long itemId);
}

View File

@ -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==================");
}
}
}
/**
* 新增工具台账
*

View File

@ -242,9 +242,12 @@ public class WmsInTaskController extends BaseController {
List<BaseKnifeLocked> baseKnifeLockedList = baseKnifeLockedMapper.selectBaseKnifeLockedList(baseKnifeLockedWrapper);
// 获取实体并修改状态
BaseKnifeLocked baseKnifeLocked = baseKnifeLockedList.get(0);
baseKnifeLocked.setStatus(1);
baseKnifeLockedMapper.updateBaseKnifeLocked(baseKnifeLocked);
BaseKnifeLocked baseKnifeLocked;
if (!baseKnifeLockedList.isEmpty()){
baseKnifeLocked = baseKnifeLockedList.get(0);
baseKnifeLocked.setStatus(1);
baseKnifeLockedMapper.updateBaseKnifeLocked(baseKnifeLocked);
}
// 再次查询物料是否有预订订单
baseKnifeLockedWrapper.setPlanSheet(null);

View File

@ -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;

View File

@ -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

View File

@ -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>

View File

@ -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>