完善盘点

This commit is contained in:
liumingxiy 2024-11-13 11:20:36 +08:00
parent 1ae1576d35
commit 864e1c1789
3 changed files with 25 additions and 1 deletions

View File

@ -1,5 +1,6 @@
package com.ktg.mes.config;
import com.alibaba.fastjson.JSON;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.*;
import com.ktg.mes.wm.domain.WmStorageArea;
@ -51,7 +52,7 @@ public class BizConfig {
String nowDateTimeStr = new SimpleDateFormat("HH:mm").format(nowDate);
// 判断是否到达目标时间
if ("00:00".equals(nowDateTimeStr)) {
if ("09:06".equals(nowDateTimeStr)) {
/* 集合存储物料实体集合 */
HashMap<Long, HashMap<String, List<BaseKnife>>> superBaseKnifeListHashMap = new HashMap<>();
@ -83,6 +84,7 @@ public class BizConfig {
wmsInventoryPlan.setEndTime(endTime);
wmsInventoryPlan.setStatus("STATUS_1");
wmsInventoryPlan.setDescription(String.format("%s自动生成的盘点计划。", new SimpleDateFormat("yyyy年MM月dd日").format(nowDate)));
wmsInventoryPlan.setIsag("N");
wmsInventoryPlan.setCreateTime(nowDate);
/* 保存盘点计划数据 */
@ -129,9 +131,13 @@ public class BizConfig {
});
});
System.out.println(JSON.toJSONString(superBaseKnifeListHashMap));
/* 遍历集合 */
superBaseKnifeListHashMap.keySet().forEach(key1 -> {
System.out.println(key1);
superBaseKnifeListHashMap.get(key1).keySet().forEach(key2 -> {
System.out.println("\t" + key2);
/* 切割字符串 */
String[] idStrArray = key2.split("-");

View File

@ -76,6 +76,7 @@ public class WmsInventoryController extends BaseController {
@Log(title = "盘点", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WmsInventory wmsInventory) {
wmsInventory.setUpdateBy(getUsername());
return toAjax(wmsInventoryService.updateWmsInventory(wmsInventory));
}

View File

@ -2,6 +2,7 @@ package com.ktg.mes.md.service.impl;
import com.ktg.common.utils.DateUtils;
import com.ktg.mes.md.domain.WmsInventory;
import com.ktg.mes.md.domain.WmsInventoryPlan;
import com.ktg.mes.md.mapper.MdItemMapper;
import com.ktg.mes.md.mapper.MdUnitMeasureMapper;
import com.ktg.mes.md.mapper.WmsInventoryMapper;
@ -12,6 +13,7 @@ import com.ktg.mes.wm.mapper.WmWarehouseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
@ -25,14 +27,19 @@ public class WmsInventoryServiceImpl implements IWmsInventoryService {
@Autowired
private WmsInventoryMapper wmsInventoryMapper;
@Autowired
private WmsInventoryPlanMapper wmsInventoryPlanMapper;
@Autowired
private WmWarehouseMapper wmWarehouseMapper;
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
@Autowired
private MdItemMapper mdItemMapper;
@Autowired
private MdUnitMeasureMapper mdUnitMeasureMapper;
/**
@ -92,6 +99,16 @@ public class WmsInventoryServiceImpl implements IWmsInventoryService {
@Override
public int updateWmsInventory(WmsInventory wmsInventory) {
wmsInventory.setUpdateTime(DateUtils.getNowDate());
if (wmsInventory.getInventoryCount() != null && wmsInventory.getInventoryCount() != 0) {
wmsInventory.setInventoryTime(new Date(System.currentTimeMillis()));
wmsInventory.setDiffCount(Math.abs(wmsInventory.getSystemCount() - wmsInventory.getInventoryCount()));
}
if (wmsInventory.getAgCount() != null && wmsInventory.getAgCount() != 0) {
wmsInventory.setAgTime(new Date(System.currentTimeMillis()));
wmsInventory.setDiffCount(Math.abs(wmsInventory.getSystemCount() - wmsInventory.getAgCount()));
WmsInventoryPlan wmsInventoryPlan = wmsInventoryPlanMapper.selectWmsInventoryPlanByWmsStockPlanId(wmsInventory.getWmsStockPlanId());
wmsInventoryPlan.setIsag("Y");
}
return wmsInventoryMapper.updateWmsInventory(wmsInventory);
}