优化库存批次台账

This commit is contained in:
Stang 2024-11-21 15:11:30 +08:00
parent 220539f125
commit ff2924591b
10 changed files with 163 additions and 12 deletions

View File

@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:dm://30.30.2.24:5237/WMS_GJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:dm://30.30.2.24:5237/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:dm://172.16.99.19:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: SYSDBA
password: SYSDBA

View File

@ -42,7 +42,7 @@ public class WmsInPlanTest {
public void insertWmsInPlan() {
WmsInPlan wmsInPlan = new WmsInPlan();
wmsInPlan.setState("0");
wmsInPlan.setSourceType("SGLR");
wmsInPlan.setSourceType("ZDSC");
wmsInPlan.setWareId("10");
wmsInPlan.setCellCode("A0089");
wmsInPlan.setRelBillCode("123456");
@ -60,7 +60,7 @@ public class WmsInPlanTest {
WmsInPlan wmsInPlan = new WmsInPlan();
wmsInPlan.setPlanId("41");
wmsInPlan.setState("0");
wmsInPlan.setSourceType("SGLR");
wmsInPlan.setSourceType("ZDSC");
wmsInPlan.setWareId("10");
wmsInPlan.setCellCode("A0089");
wmsInPlan.setRelBillCode("123456");

View File

@ -24,7 +24,7 @@ public class WmsOutPlanTest {
WmsOutPlan wmsOutPlan = new WmsOutPlan();
wmsOutPlan.setPlanCode("CKJH202411020949");
wmsOutPlan.setWmsBusinessTypeId(12L);
wmsOutPlan.setPlanType("SGLR");
wmsOutPlan.setPlanType("ZDSC");
wmsOutPlan.setPlanState("1");
int i = wmsOutPlanService.insertWmsOutPlan(wmsOutPlan);
System.out.println(i);
@ -39,7 +39,7 @@ public class WmsOutPlanTest {
wmsOutPlan.setWmsOutPlanId(27L);
wmsOutPlan.setPlanCode("CKJH202411020949");
wmsOutPlan.setWmsBusinessTypeId(12L);
wmsOutPlan.setPlanType("SGLR");
wmsOutPlan.setPlanType("ZDSC");
wmsOutPlan.setPlanState("0");
int i = wmsOutPlanService.updateWmsOutPlan(wmsOutPlan);
System.out.println(i);

View File

@ -890,7 +890,7 @@ public class BaseKnifeController extends BaseController {
if (wmsInPlan == null) {
WmsInPlan wmsInPlanTemp = new WmsInPlan();
wmsInPlanTemp.setState("1");
wmsInPlanTemp.setSourceType("SGLR");
wmsInPlanTemp.setSourceType("ZDSC");
wmsInPlanTemp.setCellCode(zdTask.getAttr3());
wmsInPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4());
wmsInPlanTemp.setRelBillCode("组装单据");

View File

@ -70,6 +70,9 @@ public class InventoryBatch {
@Excel(name = "入库/出库")
private Integer inOrOut;
@Excel(name = "入库/出库明细")
private List<HashMap<String, Object>> infoList;
/**
* 日期
*/
@ -155,4 +158,12 @@ public class InventoryBatch {
public void setMdItemNum(Integer mdItemNum) {
this.mdItemNum = mdItemNum;
}
public List<HashMap<String, Object>> getInfoList() {
return infoList;
}
public void setInfoList(List<HashMap<String, Object>> infoList) {
this.infoList = infoList;
}
}

View File

@ -4,10 +4,8 @@ import com.ktg.common.utils.DateUtils;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.*;
import com.ktg.mes.md.service.IInventoryBatchService;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import com.ktg.mes.wm.domain.WmsInTask;
import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper;
import com.ktg.mes.wm.mapper.WmsInTaskMapper;
import com.ktg.mes.wm.domain.*;
import com.ktg.mes.wm.mapper.*;
import com.ktg.mes.wm.service.impl.WmsInPlanDetailEntityServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -35,6 +33,21 @@ public class InventoryBatchServiceImpl implements IInventoryBatchService {
@Autowired
private WmsOutPlanMapper wmsOutPlanMapper;
@Autowired
private WmsInPlanMapper wmsInPlanMapper;
@Autowired
private WmStorageLocationMapper wmStorageLocationMapper;
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
@Autowired
private WmWarehouseMapper wmWarehouseMapper;
@Autowired
private MdItemMapper mdItemMapper;
@Autowired
private WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper;
@ -72,6 +85,7 @@ public class InventoryBatchServiceImpl implements IInventoryBatchService {
@Override
public List<InventoryBatch> selectInventoryBatchList(InventoryBatch inventoryBatch) {
// 构建出库信息
List<InventoryBatch> result = new ArrayList<>();
WmsOutTask wmsOutTaskWrapper = new WmsOutTask();
@ -89,6 +103,69 @@ public class InventoryBatchServiceImpl implements IInventoryBatchService {
inventoryBatchOut.setInOrOut(0);
inventoryBatchOut.setDateTime(outTask.getCreateTime());
inventoryBatchOut.setStatus(outTask.getTaskState());
// 获得当前出库计划明细实体列表并遍历
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
WmsOutPlanDetailEntity entityQuery = new WmsOutPlanDetailEntity();
entityQuery.setWmsOutPlanDetailId(outTask.getWmsOutPlanDetailId());
List<WmsOutPlanDetailEntity> wmsOutPlanDetailEntityList = wmsOutPlanDetailEntityMapper.selectWmsOutPlanDetailEntityList(entityQuery);
wmsOutPlanDetailEntityList.forEach(outPlanDetailEntity -> {
// 根据出库实例对象获取出库计划明细
WmsOutPlanDetail wmsOutPlanDetail = this.wmsOutPlanMapper.selectWmsOutPlanDetailById(outPlanDetailEntity.getWmsOutPlanDetailId());
// 根据计划明细获得出库计划
WmsOutPlan wmsOutPlan = this.wmsOutPlanMapper.selectWmsOutPlanByWmsOutPlanId(wmsOutPlanDetail.getWmsOutPlanId());
// 根据出库计划获得出库类型
WmsBusinessType wmsBusinessType = this.wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsOutPlan.getWmsBusinessTypeId().toString());
// 获得物料
MdItem mdItem = this.mdItemMapper.selectMdItemById(outTask.getMdItemId());
// 设定出库信息数据
HashMap<String, Object> hashMap = new HashMap<>();
/* 来自物料 */
hashMap.put("mdItemId", mdItem.getItemId()); // 物料ID
hashMap.put("mdItemCode", mdItem.getItemCode()); // 物料编码
hashMap.put("mdItemName", mdItem.getItemName()); // 物料名称
hashMap.put("mdItemUnit", mdItem.getUnitName()); // 物料单位
hashMap.put("mdItemKnifeWarn", mdItem.getAttr2()); // 物料名称
/* 来自出入库计划类型 */
hashMap.put("planTypeId", wmsBusinessType.getTypeId()); // 出库类型ID
hashMap.put("planTypeCode", wmsBusinessType.getCode()); // 出库类型编码
hashMap.put("planTypeName", wmsBusinessType.getName()); // 出库类型名称
/* 来自计划明细 */
hashMap.put("detailBatchNum", wmsOutPlanDetail.getDetailBatchNum()); // 明细批次
hashMap.put("wmStorageAreaId", wmsOutPlanDetail.getWmStorageAreaId()); // 库位ID
hashMap.put("wmStorageAreaCode", wmsOutPlanDetail.getWmStorageAreaCode()); // 库位编码
hashMap.put("wmStorageAreaName", wmsOutPlanDetail.getWmStorageAreaName()); // 库位名称
hashMap.put("detailStatus", wmsOutPlanDetail.getDetailState()); // 明细状态
// 查询库区信息
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(wmsOutPlanDetail.getWmStorageAreaId());
WmStorageLocation wmStorageLocation = wmStorageLocationMapper.selectWmStorageLocationByLocationId(wmStorageArea.getLocationId());
// 查询库房信息
WmWarehouse wmWarehouse = wmWarehouseMapper.selectWmWarehouseByWarehouseId(wmStorageLocation.getWarehouseId());
hashMap.put("wmWarehouseName", wmWarehouse.getWarehouseName()); // 库位名称
/* 实体 */
String outTime = null;
if (outPlanDetailEntity.getCreateTime() != null)
outTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(outPlanDetailEntity.getCreateTime());
hashMap.put("dateTime", outTime); // 出库时间
hashMap.put("baseKnifeId", outPlanDetailEntity.getBaseKnifeId());
hashMap.put("planCode", outTask.getWmsOutPlanCode());
// hashMap.put("knifeLife", nowWmsOutPlanDetailEntity.getKnifeLife());
// hashMap.put("resetCount", nowWmsOutPlanDetailEntity.getResetCount());
// 寿命预警
if ("PRODUCT".equals(outPlanDetailEntity.getItemOrProduct()) && outPlanDetailEntity.getKnifeLife() <= mdItem.getAttr2())
hashMap.put("knifeWarning", true);
else
hashMap.put("knifeWarning", false);
hashMapList.add(hashMap);
});
// 注入出库信息对象
inventoryBatchOut.setInfoList(hashMapList);
result.add(inventoryBatchOut);
});
@ -108,6 +185,61 @@ public class InventoryBatchServiceImpl implements IInventoryBatchService {
inventoryBatchIn.setInOrOut(1);
inventoryBatchIn.setDateTime(inTask.getCreateTime());
inventoryBatchIn.setStatus("1");
// 获取当期入库明细数据
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
WmsInPlanDetailEntity entityQuery = new WmsInPlanDetailEntity();
entityQuery.setPlanDetailsId(inTask.getDetailInId());
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityMapper.selectWmsInPlanDetailEntityList(entityQuery);
wmsInPlanDetailEntityList.forEach(inPlanDetailEntity -> {
// 根据出库实例对象获取出库计划明细
WmsInPlanDetails wmsInPlanDetails = this.wmsInPlanMapper.selectWmsInPlanDetailById(inPlanDetailEntity.getPlanDetailsId());
// 根据计划明细获得出库计划
WmsInPlan wmsInPlan = this.wmsInPlanMapper.selectWmsInPlanByPlanId(wmsInPlanDetails.getPlanId().toString());
// 根据出库计划获得出库类型
WmsBusinessType wmsBusinessType = this.wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsInPlan.getBusinessTypeId());
// 获得物料
MdItem mdItem = this.mdItemMapper.selectMdItemById(Long.parseLong(inTask.getMaterialId()));
// 设定出库信息数据
HashMap<String, Object> hashMap = new HashMap<>();
/* 来自物料 */
hashMap.put("mdItemId", mdItem.getItemId()); // 物料ID
hashMap.put("mdItemCode", mdItem.getItemCode()); // 物料编码
hashMap.put("mdItemName", mdItem.getItemName()); // 物料名称
hashMap.put("mdItemUnit", mdItem.getUnitName()); // 物料单位
hashMap.put("mdItemKnifeWarn", mdItem.getAttr2()); // 物料名称
/* 来自出入库计划类型 */
hashMap.put("planTypeId", wmsBusinessType.getTypeId()); // 出库类型ID
hashMap.put("planTypeCode", wmsBusinessType.getCode()); // 出库类型编码
hashMap.put("planTypeName", wmsBusinessType.getName()); // 出库类型名称
/* 来自计划明细 */
hashMap.put("detailBatchNum", wmsInPlanDetails.getBatch()); // 明细批次
hashMap.put("wmStorageAreaId", wmsInPlanDetails.getCellId()); // 库位ID
hashMap.put("wmStorageAreaName", inTask.getCellName()); // 库位名称
hashMap.put("detailStatus", wmsInPlanDetails.getPlanInStatus()); // 明细状态
// 查询库区信息
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(wmsInPlanDetails.getCellId());
WmStorageLocation wmStorageLocation = wmStorageLocationMapper.selectWmStorageLocationByLocationId(wmStorageArea.getLocationId());
// 查询库房信息
WmWarehouse wmWarehouse = wmWarehouseMapper.selectWmWarehouseByWarehouseId(wmStorageLocation.getWarehouseId());
hashMap.put("wmWarehouseName", wmWarehouse.getWarehouseName()); // 库位名称
/* 实体 */
String outTime = null;
if (wmsInPlanDetails.getCreateTime() != null)
outTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(wmsInPlanDetails.getCreateTime());
hashMap.put("dateTime", outTime); // 出库时间
hashMap.put("baseKnifeId", inPlanDetailEntity.getKnifeId());
hashMap.put("planCode", inTask.getPlanInCode());
// hashMap.put("knifeLife", nowWmsOutPlanDetailEntity.getKnifeLife());
// hashMap.put("resetCount", nowWmsOutPlanDetailEntity.getResetCount());
hashMapList.add(hashMap);
});
result.add(inventoryBatchIn);
});

View File

@ -293,7 +293,7 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
wmsOutPlan.setPlanCode(Long.toString(System.currentTimeMillis(), 32).toUpperCase(Locale.ROOT));
wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() != null ? Long.parseLong(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId()) : 14L);
wmsOutPlan.setPlanState("1");
wmsOutPlan.setPlanType("SGLR");
wmsOutPlan.setPlanType("ZDSC");
wmsOutPlan.setRemark("一键清退无寿命物品");
wmsOutPlan.setCreateBy(username);
wmsOutPlan.setCreateTime(new Date());

View File

@ -93,4 +93,6 @@ public interface WmsInPlanMapper
* @return 结果
*/
public Boolean isDuplicatePlanCode(String planCode);
WmsInPlanDetails selectWmsInPlanDetailById(Long planDetailsId);
}

View File

@ -381,7 +381,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
if (wmsInPlan == null) {
WmsInPlan wmsInPlanTemp = new WmsInPlan();
wmsInPlanTemp.setState("1");
wmsInPlanTemp.setSourceType("SGLR");
wmsInPlanTemp.setSourceType("ZDSC");
wmsInPlanTemp.setCellCode(wmStorageArea.getAreaCode());
wmsInPlanTemp.setPlanCode(zdTask.getCode());
wmsInPlanTemp.setRelBillCode("组装单据");

View File

@ -361,4 +361,10 @@
FROM WMS_IN_PLAN
WHERE PLAN_CODE = #{value}
</select>
<select id="selectWmsInPlanDetailById" resultMap="WmsInPlanDetailsResult">
SELECT *
FROM WMS_IN_PLAN_DETAILS
WHERE DETAILS_ID = #{wmsInPlanDetailId};
</select>
</mapper>