完成验证订单完成状态功能
This commit is contained in:
parent
e6a7bc32d8
commit
67debb35c8
@ -13,6 +13,7 @@ import com.ktg.mes.md.mapper.WmsOutPlanMapper;
|
||||
import com.ktg.mes.md.mapper.WmsOutTaskMapper;
|
||||
import com.ktg.mes.md.service.*;
|
||||
import com.ktg.mes.wm.domain.*;
|
||||
import com.ktg.mes.wm.mapper.ProductionArrangementsMapper;
|
||||
import com.ktg.mes.wm.service.IWmStorageAreaService;
|
||||
import com.ktg.mes.wm.service.IWmsInPlanService;
|
||||
import com.ktg.mes.wm.service.IWmsInTaskService;
|
||||
@ -78,6 +79,9 @@ public class BaseKnifeController extends BaseController {
|
||||
@Autowired
|
||||
private WmsOutTaskMapper wmsOutTaskMapper;
|
||||
|
||||
@Autowired
|
||||
private ProductionArrangementsMapper productionArrangementsMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
@ -449,7 +453,6 @@ public class BaseKnifeController extends BaseController {
|
||||
baseKnifeOriginList.add(item);
|
||||
item.setPlanSheet(planSheet);
|
||||
item.setIsLocked(1);
|
||||
item.setKnifeFineState(2);
|
||||
item.setLockedStartTime(techBom.getLockedStartTime());
|
||||
item.setLockedEndTime(techBom.getLockedEndTime());
|
||||
baseKnifeService.updateBaseKnife(item);
|
||||
@ -573,98 +576,110 @@ public class BaseKnifeController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
// 生成出库计划单
|
||||
WmsOutPlan outPlan = new WmsOutPlan();
|
||||
outPlan.setPlanCode(planSheet);
|
||||
outPlan.setWmsBusinessTypeId(16L);
|
||||
outPlan.setPlanState("1");
|
||||
outPlan.setPlanType("ZDCK");
|
||||
outPlan.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanMapper.insertWmsOutPlan(outPlan);
|
||||
// 添加生产准备记录
|
||||
ProductionArrangements productionArrangements = new ProductionArrangements();
|
||||
productionArrangements.setPlanSheet(planSheet);
|
||||
productionArrangements.setProcessCode(processCodeList.toString());
|
||||
productionArrangements.setStatus(0);
|
||||
productionArrangementsMapper.insertProductionArrangements(productionArrangements);
|
||||
|
||||
String batchNum = "SCZBPC01";
|
||||
// 出库任务,进行基础物料的出库
|
||||
HashMap<Long, HashMap<String, List<BaseKnife>>> baseKnifeHashMapMap = new HashMap<>();
|
||||
if (!msg.contains("缺少物料已生成组装任务!")){
|
||||
// 生成出库计划单
|
||||
WmsOutPlan outPlan = new WmsOutPlan();
|
||||
outPlan.setPlanCode(planSheet);
|
||||
outPlan.setWmsBusinessTypeId(16L);
|
||||
outPlan.setPlanState("1");
|
||||
outPlan.setPlanType("ZDCK");
|
||||
outPlan.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanMapper.insertWmsOutPlan(outPlan);
|
||||
|
||||
// 遍历构建map
|
||||
baseKnifeOriginList.forEach(item -> {
|
||||
// 判断当前物料主键是否已经被收录
|
||||
baseKnifeHashMapMap.computeIfAbsent(item.getMbbBdMrlId(), k -> new HashMap<>());
|
||||
String batchNum = "SCZBPC01";
|
||||
// 出库任务,进行基础物料的出库
|
||||
HashMap<Long, HashMap<String, List<BaseKnife>>> baseKnifeHashMapMap = new HashMap<>();
|
||||
|
||||
// 判断当前库位编码是否已经被收录
|
||||
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).computeIfAbsent(item.getAreaCode(), k -> new ArrayList<>());
|
||||
// 遍历构建map
|
||||
baseKnifeOriginList.forEach(item -> {
|
||||
// 判断当前物料主键是否已经被收录
|
||||
baseKnifeHashMapMap.computeIfAbsent(item.getMbbBdMrlId(), k -> new HashMap<>());
|
||||
|
||||
// 对当前台账对象进行收录
|
||||
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).get(item.getAreaCode()).add(item);
|
||||
});
|
||||
// 判断当前库位编码是否已经被收录
|
||||
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).computeIfAbsent(item.getAreaCode(), k -> new ArrayList<>());
|
||||
|
||||
// 生成出库计划明细
|
||||
WmsOutPlan outPlanTemp = outPlan;
|
||||
baseKnifeHashMapMap.keySet().forEach(mdItemId -> {
|
||||
MdItem mdItemOutPlan = mdItemService.selectMdItemById(mdItemId);
|
||||
// 根据库位编码遍历
|
||||
baseKnifeHashMapMap.get(mdItemId).keySet().forEach(areaCode -> {
|
||||
// 获得库位对象
|
||||
WmStorageArea wmStorageAreaOutPlan = wmStorageAreaService.selectWmStorageAreaByAreaCode(areaCode);
|
||||
|
||||
WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail();
|
||||
outPlanDetail.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
|
||||
outPlanDetail.setMdItemId(mdItemId);
|
||||
outPlanDetail.setMdItemCode(mdItemOutPlan.getItemCode());
|
||||
outPlanDetail.setMdItemName(mdItemOutPlan.getItemName());
|
||||
outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName());
|
||||
outPlanDetail.setPlannedQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
|
||||
outPlanDetail.setRealQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
|
||||
outPlanDetail.setDetailBatchNum(batchNum);
|
||||
outPlanDetail.setWmStorageAreaId(wmStorageAreaOutPlan.getAreaId());
|
||||
outPlanDetail.setWmStorageAreaCode(wmStorageAreaOutPlan.getAreaCode());
|
||||
outPlanDetail.setWmStorageAreaName(wmStorageAreaOutPlan.getAreaName());
|
||||
outPlanDetail.setDetailState("1");
|
||||
outPlanDetail.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanMapper.insertWmsOutPlanDetail(outPlanDetail);
|
||||
|
||||
// 遍历台账对象
|
||||
baseKnifeHashMapMap.get(mdItemId).get(areaCode).forEach(item -> {
|
||||
// 构建出库计划明细实体
|
||||
WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity();
|
||||
wmsOutPlanDetailEntity.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
||||
wmsOutPlanDetailEntity.setBaseKnifeId(item.getBaseKnifeId());
|
||||
wmsOutPlanDetailEntity.setAreaCode(item.getAreaCode());
|
||||
wmsOutPlanDetailEntity.setItemOrProduct(item.getItemOrProduct());
|
||||
wmsOutPlanDetailEntity.setKnifeCode(item.getKnifeCode());
|
||||
wmsOutPlanDetailEntity.setKnifeName(item.getKnifeName());
|
||||
wmsOutPlanDetailEntity.setPlanSheet(item.getPlanSheet());
|
||||
wmsOutPlanDetailEntity.setKnifeLife(item.getKnifeLife());
|
||||
wmsOutPlanDetailEntity.setResetCount(item.getResetCount());
|
||||
wmsOutPlanDetailEntity.setKnifeUnit(item.getKnifeUnit());
|
||||
wmsOutPlanDetailEntity.setSafeStock(item.getKnifeType());
|
||||
wmsOutPlanDetailEntity.setStandardQuantity(item.getStandardQuantity());
|
||||
wmsOutPlanDetailEntity.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);
|
||||
});
|
||||
|
||||
// 生成出库任务
|
||||
WmsOutTask wmsOutTask = new WmsOutTask();
|
||||
wmsOutTask.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
|
||||
wmsOutTask.setWmsOutPlanCode(outPlanTemp.getPlanCode());
|
||||
wmsOutTask.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
||||
// 出库类型 12组刀出库
|
||||
wmsOutTask.setWmsBusinessTypeId(12L);
|
||||
wmsOutTask.setTaskCode(generateTaskCode("CKT"));
|
||||
wmsOutTask.setTaskNumber(outPlanDetail.getPlannedQuantity());
|
||||
wmsOutTask.setOutNumber(outPlanDetail.getRealQuantity());
|
||||
wmsOutTask.setWmStorageAreaId(outPlanDetail.getWmStorageAreaId());
|
||||
wmsOutTask.setBatchNum(batchNum);
|
||||
wmsOutTask.setMdItemId(outPlanDetail.getMdItemId());
|
||||
wmsOutTask.setMdItemCode(outPlanDetail.getMdItemCode());
|
||||
wmsOutTask.setMdItemName(outPlanDetail.getMdItemName());
|
||||
wmsOutTask.setMdItemUnit(outPlanDetail.getMdItemUnit());
|
||||
wmsOutTask.setTaskState("1");
|
||||
wmsOutTask.setRecipientUsername("");
|
||||
wmsOutTask.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
|
||||
// 对当前台账对象进行收录
|
||||
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).get(item.getAreaCode()).add(item);
|
||||
});
|
||||
});
|
||||
|
||||
// 生成出库计划明细
|
||||
WmsOutPlan outPlanTemp = outPlan;
|
||||
baseKnifeHashMapMap.keySet().forEach(mdItemId -> {
|
||||
MdItem mdItemOutPlan = mdItemService.selectMdItemById(mdItemId);
|
||||
// 根据库位编码遍历
|
||||
baseKnifeHashMapMap.get(mdItemId).keySet().forEach(areaCode -> {
|
||||
// 获得库位对象
|
||||
WmStorageArea wmStorageAreaOutPlan = wmStorageAreaService.selectWmStorageAreaByAreaCode(areaCode);
|
||||
|
||||
WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail();
|
||||
outPlanDetail.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
|
||||
outPlanDetail.setMdItemId(mdItemId);
|
||||
outPlanDetail.setMdItemCode(mdItemOutPlan.getItemCode());
|
||||
outPlanDetail.setMdItemName(mdItemOutPlan.getItemName());
|
||||
outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName());
|
||||
outPlanDetail.setPlannedQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
|
||||
outPlanDetail.setRealQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
|
||||
outPlanDetail.setDetailBatchNum(batchNum);
|
||||
outPlanDetail.setWmStorageAreaId(wmStorageAreaOutPlan.getAreaId());
|
||||
outPlanDetail.setWmStorageAreaCode(wmStorageAreaOutPlan.getAreaCode());
|
||||
outPlanDetail.setWmStorageAreaName(wmStorageAreaOutPlan.getAreaName());
|
||||
outPlanDetail.setDetailState("1");
|
||||
outPlanDetail.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanMapper.insertWmsOutPlanDetail(outPlanDetail);
|
||||
|
||||
// 遍历台账对象
|
||||
baseKnifeHashMapMap.get(mdItemId).get(areaCode).forEach(item -> {
|
||||
// 构建出库计划明细实体
|
||||
WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity();
|
||||
wmsOutPlanDetailEntity.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
||||
wmsOutPlanDetailEntity.setBaseKnifeId(item.getBaseKnifeId());
|
||||
wmsOutPlanDetailEntity.setAreaCode(item.getAreaCode());
|
||||
wmsOutPlanDetailEntity.setItemOrProduct(item.getItemOrProduct());
|
||||
wmsOutPlanDetailEntity.setKnifeCode(item.getKnifeCode());
|
||||
wmsOutPlanDetailEntity.setKnifeName(item.getKnifeName());
|
||||
wmsOutPlanDetailEntity.setPlanSheet(item.getPlanSheet());
|
||||
wmsOutPlanDetailEntity.setKnifeLife(item.getKnifeLife());
|
||||
wmsOutPlanDetailEntity.setResetCount(item.getResetCount());
|
||||
wmsOutPlanDetailEntity.setKnifeUnit(item.getKnifeUnit());
|
||||
wmsOutPlanDetailEntity.setSafeStock(item.getKnifeType());
|
||||
wmsOutPlanDetailEntity.setStandardQuantity(item.getStandardQuantity());
|
||||
wmsOutPlanDetailEntity.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);
|
||||
});
|
||||
|
||||
// 生成出库任务
|
||||
WmsOutTask wmsOutTask = new WmsOutTask();
|
||||
wmsOutTask.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
|
||||
wmsOutTask.setWmsOutPlanCode(outPlanTemp.getPlanCode());
|
||||
wmsOutTask.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
||||
// 出库类型 12组刀出库
|
||||
wmsOutTask.setWmsBusinessTypeId(12L);
|
||||
wmsOutTask.setTaskCode(generateTaskCode("CKT"));
|
||||
wmsOutTask.setTaskNumber(outPlanDetail.getPlannedQuantity());
|
||||
wmsOutTask.setOutNumber(outPlanDetail.getRealQuantity());
|
||||
wmsOutTask.setWmStorageAreaId(outPlanDetail.getWmStorageAreaId());
|
||||
wmsOutTask.setBatchNum(batchNum);
|
||||
wmsOutTask.setMdItemId(outPlanDetail.getMdItemId());
|
||||
wmsOutTask.setMdItemCode(outPlanDetail.getMdItemCode());
|
||||
wmsOutTask.setMdItemName(outPlanDetail.getMdItemName());
|
||||
wmsOutTask.setMdItemUnit(outPlanDetail.getMdItemUnit());
|
||||
wmsOutTask.setTaskState("0");
|
||||
wmsOutTask.setRecipientUsername("");
|
||||
wmsOutTask.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
|
||||
});
|
||||
});
|
||||
|
||||
productionArrangements.setStatus(1);
|
||||
productionArrangementsMapper.updateProductionArrangements(productionArrangements);
|
||||
}
|
||||
|
||||
operLog.setJsonResult(msg);
|
||||
operLog.setStatus(0);
|
||||
|
@ -0,0 +1,171 @@
|
||||
package com.ktg.mes.md.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.DateUtils;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.mes.md.domain.*;
|
||||
import com.ktg.mes.md.mapper.WmsOutPlanDetailEntityMapper;
|
||||
import com.ktg.mes.md.mapper.WmsOutPlanMapper;
|
||||
import com.ktg.mes.md.mapper.WmsOutTaskMapper;
|
||||
import com.ktg.mes.md.service.IBaseKnifeService;
|
||||
import com.ktg.mes.md.service.IBaseTechnologyBomService;
|
||||
import com.ktg.mes.md.service.IBomRouteService;
|
||||
import com.ktg.mes.md.service.IMdItemService;
|
||||
import com.ktg.mes.wm.domain.*;
|
||||
import com.ktg.mes.wm.service.IWmStorageAreaService;
|
||||
import com.ktg.mes.wm.service.IWmsInPlanService;
|
||||
import com.ktg.mes.wm.service.IWmsInTaskService;
|
||||
import com.ktg.mes.wm.service.IWmsZdTaskService;
|
||||
import com.ktg.system.domain.SysOperLog;
|
||||
import com.ktg.system.service.ISysOperLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static com.ktg.generator.util.MultiModuleCodeGenerator.generateTaskCode;
|
||||
|
||||
/**
|
||||
* 工具台账Controller
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2024-10-31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/mes/md/inventoryBatch")
|
||||
public class InventoryBatchController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBaseKnifeService baseKnifeService;
|
||||
|
||||
@Autowired
|
||||
private IMdItemService mdItemService;
|
||||
|
||||
@Autowired
|
||||
private ISysOperLogService operLogService;
|
||||
|
||||
@Autowired
|
||||
private IWmStorageAreaService wmStorageAreaService;
|
||||
|
||||
@Autowired
|
||||
private IWmsInPlanService wmsInPlanService;
|
||||
|
||||
@Autowired
|
||||
private IWmsInTaskService wmsInTaskService;
|
||||
|
||||
@Autowired
|
||||
private WmsOutPlanMapper wmsOutPlanMapper;
|
||||
|
||||
@Autowired
|
||||
private WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper;
|
||||
|
||||
@Autowired
|
||||
private WmsOutTaskMapper wmsOutTaskMapper;
|
||||
|
||||
/**
|
||||
* 查询出库任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('md:TASK:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(InventoryBatch inventoryBatch) {
|
||||
startPage();
|
||||
|
||||
List<InventoryBatch> result = new ArrayList<>();
|
||||
|
||||
WmsOutTask wmsOutTaskWrapper = new WmsOutTask();
|
||||
wmsOutTaskWrapper.setBatchNum(inventoryBatch.getBatchNum());
|
||||
wmsOutTaskWrapper.setMdItemCode(inventoryBatch.getMdItemCode());
|
||||
List<WmsOutTask> outTaskList = wmsOutTaskMapper.selectWmsOutTaskList(wmsOutTaskWrapper);
|
||||
outTaskList.forEach(outTask -> {
|
||||
InventoryBatch inventoryBatchOut = new InventoryBatch();
|
||||
inventoryBatchOut.setId(outTask.getWmsOutTaskId());
|
||||
inventoryBatchOut.setBatchNum(outTask.getBatchNum());
|
||||
inventoryBatchOut.setMdItemCode(outTask.getMdItemCode());
|
||||
inventoryBatchOut.setMdItemName(outTask.getMdItemName());
|
||||
inventoryBatchOut.setMdItemUnit(outTask.getMdItemUnit());
|
||||
inventoryBatchOut.setMdItemNum(outTask.getTaskNumber());
|
||||
inventoryBatchOut.setInOrOut(0);
|
||||
inventoryBatchOut.setDateTime(outTask.getCreateTime());
|
||||
inventoryBatchOut.setStatus(outTask.getTaskState());
|
||||
result.add(inventoryBatchOut);
|
||||
});
|
||||
|
||||
return getDataTable(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出工具台账列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('md:baseKnife:export')")
|
||||
@Log(title = "工具台账", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BaseKnife baseKnife)
|
||||
{
|
||||
List<BaseKnife> list = baseKnifeService.selectBaseKnifeList(baseKnife);
|
||||
ExcelUtil<BaseKnife> util = new ExcelUtil<BaseKnife>(BaseKnife.class);
|
||||
util.exportExcel(response, list, "工具台账数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工具台账详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('md:baseKnife:query')")
|
||||
@GetMapping(value = "/{baseKnifeId}")
|
||||
public AjaxResult getInfo(@PathVariable("baseKnifeId") Long baseKnifeId)
|
||||
{
|
||||
return AjaxResult.success(baseKnifeService.selectBaseKnifeByBaseKnifeId(baseKnifeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工具台账
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('md:baseKnife:add')")
|
||||
@Log(title = "工具台账", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BaseKnife baseKnife)
|
||||
{
|
||||
return toAjax(baseKnifeService.insertBaseKnife(baseKnife));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工具台账
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('md:baseKnife:edit')")
|
||||
@Log(title = "工具台账", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BaseKnife baseKnife)
|
||||
{
|
||||
return toAjax(baseKnifeService.updateBaseKnife(baseKnife));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工具台账
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('md:baseKnife:edit')")
|
||||
@Log(title = "工具台账", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/reset/{baseKnifeId}")
|
||||
public AjaxResult reset(@PathVariable Long baseKnifeId)
|
||||
{
|
||||
return toAjax(baseKnifeService.resetBaseKnifeByBaseKnifeId(baseKnifeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工具台账
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('md:baseKnife:remove')")
|
||||
@Log(title = "工具台账", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{baseKnifeIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] baseKnifeIds)
|
||||
{
|
||||
return toAjax(baseKnifeService.deleteBaseKnifeByBaseKnifeIds(baseKnifeIds));
|
||||
}
|
||||
}
|
158
ktg-mes/src/main/java/com/ktg/mes/md/domain/InventoryBatch.java
Normal file
158
ktg-mes/src/main/java/com/ktg/mes/md/domain/InventoryBatch.java
Normal file
@ -0,0 +1,158 @@
|
||||
package com.ktg.mes.md.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ktg.common.annotation.Excel;
|
||||
import com.ktg.common.core.domain.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库存批次
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2024-11-02
|
||||
*/
|
||||
public class InventoryBatch {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
@Excel(name = "批次号")
|
||||
private String batchNum;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@Excel(name = "物料编码")
|
||||
private String mdItemCode;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
@Excel(name = "物料名称")
|
||||
private String mdItemName;
|
||||
|
||||
/**
|
||||
* 物料单位
|
||||
*/
|
||||
@Excel(name = "物料单位")
|
||||
private String mdItemUnit;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@Excel(name = "规格型号")
|
||||
private String specification;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@Excel(name = "数量")
|
||||
private Integer mdItemNum;
|
||||
|
||||
/**
|
||||
* 批次类型
|
||||
*/
|
||||
@Excel(name = "入库/出库")
|
||||
private Integer inOrOut;
|
||||
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date dateTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getBatchNum() {
|
||||
return batchNum;
|
||||
}
|
||||
|
||||
public void setBatchNum(String batchNum) {
|
||||
this.batchNum = batchNum;
|
||||
}
|
||||
|
||||
public String getMdItemCode() {
|
||||
return mdItemCode;
|
||||
}
|
||||
|
||||
public void setMdItemCode(String mdItemCode) {
|
||||
this.mdItemCode = mdItemCode;
|
||||
}
|
||||
|
||||
public String getMdItemName() {
|
||||
return mdItemName;
|
||||
}
|
||||
|
||||
public void setMdItemName(String mdItemName) {
|
||||
this.mdItemName = mdItemName;
|
||||
}
|
||||
|
||||
public String getMdItemUnit() {
|
||||
return mdItemUnit;
|
||||
}
|
||||
|
||||
public void setMdItemUnit(String mdItemUnit) {
|
||||
this.mdItemUnit = mdItemUnit;
|
||||
}
|
||||
|
||||
public String getSpecification() {
|
||||
return specification;
|
||||
}
|
||||
|
||||
public void setSpecification(String specification) {
|
||||
this.specification = specification;
|
||||
}
|
||||
|
||||
public Integer getInOrOut() {
|
||||
return inOrOut;
|
||||
}
|
||||
|
||||
public void setInOrOut(Integer inOrOut) {
|
||||
this.inOrOut = inOrOut;
|
||||
}
|
||||
|
||||
public Date getDateTime() {
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
public void setDateTime(Date dateTime) {
|
||||
this.dateTime = dateTime;
|
||||
}
|
||||
|
||||
public Integer getMdItemNum() {
|
||||
return mdItemNum;
|
||||
}
|
||||
|
||||
public void setMdItemNum(Integer mdItemNum) {
|
||||
this.mdItemNum = mdItemNum;
|
||||
}
|
||||
}
|
@ -60,4 +60,6 @@ public interface BaseTechnologyBomMapper
|
||||
public int deleteBaseTechnologyBomByTechnologyBomIds(String[] technologyBomIds);
|
||||
|
||||
List<BaseTechnologyBom> selectBaseTechnologyBomListByProcessCodeList(List<String> processCodeList);
|
||||
|
||||
List<BaseTechnologyBom> selectBaseTechnologyBomListByProcessCode(String processCode);
|
||||
}
|
||||
|
@ -0,0 +1,104 @@
|
||||
package com.ktg.mes.wm.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.mes.wm.domain.ProductionArrangements;
|
||||
import com.ktg.mes.wm.service.IProductionArrangementsService;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 生产准备记录Controller
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2024-11-18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/md/ARRANGEMENTS")
|
||||
public class ProductionArrangementsController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IProductionArrangementsService productionArrangementsService;
|
||||
|
||||
/**
|
||||
* 查询生产准备记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('md:ARRANGEMENTS:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ProductionArrangements productionArrangements)
|
||||
{
|
||||
startPage();
|
||||
List<ProductionArrangements> list = productionArrangementsService.selectProductionArrangementsList(productionArrangements);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出生产准备记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('md:ARRANGEMENTS:export')")
|
||||
@Log(title = "生产准备记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ProductionArrangements productionArrangements)
|
||||
{
|
||||
List<ProductionArrangements> list = productionArrangementsService.selectProductionArrangementsList(productionArrangements);
|
||||
ExcelUtil<ProductionArrangements> util = new ExcelUtil<ProductionArrangements>(ProductionArrangements.class);
|
||||
util.exportExcel(response, list, "生产准备记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取生产准备记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('md:ARRANGEMENTS:query')")
|
||||
@GetMapping(value = "/{productionArrangementsId}")
|
||||
public AjaxResult getInfo(@PathVariable("productionArrangementsId") String productionArrangementsId)
|
||||
{
|
||||
return AjaxResult.success(productionArrangementsService.selectProductionArrangementsByProductionArrangementsId(productionArrangementsId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产准备记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('md:ARRANGEMENTS:add')")
|
||||
@Log(title = "生产准备记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ProductionArrangements productionArrangements)
|
||||
{
|
||||
return toAjax(productionArrangementsService.insertProductionArrangements(productionArrangements));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改生产准备记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('md:ARRANGEMENTS:edit')")
|
||||
@Log(title = "生产准备记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ProductionArrangements productionArrangements)
|
||||
{
|
||||
return toAjax(productionArrangementsService.updateProductionArrangements(productionArrangements));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除生产准备记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('md:ARRANGEMENTS:remove')")
|
||||
@Log(title = "生产准备记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{productionArrangementsIds}")
|
||||
public AjaxResult remove(@PathVariable String[] productionArrangementsIds)
|
||||
{
|
||||
return toAjax(productionArrangementsService.deleteProductionArrangementsByProductionArrangementsIds(productionArrangementsIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
package com.ktg.mes.wm.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ktg.common.annotation.Excel;
|
||||
import com.ktg.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 生产准备记录对象 PRODUCTION_ARRANGEMENTS
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2024-11-18
|
||||
*/
|
||||
public class ProductionArrangements extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 生产准备ID */
|
||||
private String productionArrangementsId;
|
||||
|
||||
/** 计划单 */
|
||||
@Excel(name = "计划单")
|
||||
private String planSheet;
|
||||
|
||||
/** 工序号 */
|
||||
@Excel(name = "工序号")
|
||||
private String processCode;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
private Integer status;
|
||||
|
||||
/** 预留字段1 */
|
||||
@Excel(name = "预留字段1")
|
||||
private String attr1;
|
||||
|
||||
/** 预留字段2 */
|
||||
@Excel(name = "预留字段2")
|
||||
private String attr2;
|
||||
|
||||
/** 预留字段3 */
|
||||
@Excel(name = "预留字段3")
|
||||
private String attr3;
|
||||
|
||||
/** 预留字段4 */
|
||||
@Excel(name = "预留字段4")
|
||||
private String attr4;
|
||||
|
||||
public void setProductionArrangementsId(String productionArrangementsId)
|
||||
{
|
||||
this.productionArrangementsId = productionArrangementsId;
|
||||
}
|
||||
|
||||
public String getProductionArrangementsId()
|
||||
{
|
||||
return productionArrangementsId;
|
||||
}
|
||||
public void setPlanSheet(String planSheet)
|
||||
{
|
||||
this.planSheet = planSheet;
|
||||
}
|
||||
|
||||
public String getPlanSheet()
|
||||
{
|
||||
return planSheet;
|
||||
}
|
||||
public void setProcessCode(String processCode)
|
||||
{
|
||||
this.processCode = processCode;
|
||||
}
|
||||
|
||||
public String getProcessCode()
|
||||
{
|
||||
return processCode;
|
||||
}
|
||||
public void setStatus(Integer status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setAttr1(String attr1)
|
||||
{
|
||||
this.attr1 = attr1;
|
||||
}
|
||||
|
||||
public String getAttr1()
|
||||
{
|
||||
return attr1;
|
||||
}
|
||||
public void setAttr2(String attr2)
|
||||
{
|
||||
this.attr2 = attr2;
|
||||
}
|
||||
|
||||
public String getAttr2()
|
||||
{
|
||||
return attr2;
|
||||
}
|
||||
public void setAttr3(String attr3)
|
||||
{
|
||||
this.attr3 = attr3;
|
||||
}
|
||||
|
||||
public String getAttr3()
|
||||
{
|
||||
return attr3;
|
||||
}
|
||||
public void setAttr4(String attr4)
|
||||
{
|
||||
this.attr4 = attr4;
|
||||
}
|
||||
|
||||
public String getAttr4()
|
||||
{
|
||||
return attr4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("productionArrangementsId", getProductionArrangementsId())
|
||||
.append("planSheet", getPlanSheet())
|
||||
.append("processCode", getProcessCode())
|
||||
.append("status", getStatus())
|
||||
.append("attr1", getAttr1())
|
||||
.append("attr2", getAttr2())
|
||||
.append("attr3", getAttr3())
|
||||
.append("attr4", getAttr4())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.ktg.mes.wm.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ktg.mes.wm.domain.ProductionArrangements;
|
||||
|
||||
/**
|
||||
* 生产准备记录Mapper接口
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2024-11-18
|
||||
*/
|
||||
public interface ProductionArrangementsMapper
|
||||
{
|
||||
/**
|
||||
* 查询生产准备记录
|
||||
*
|
||||
* @param productionArrangementsId 生产准备记录主键
|
||||
* @return 生产准备记录
|
||||
*/
|
||||
public ProductionArrangements selectProductionArrangementsByProductionArrangementsId(String productionArrangementsId);
|
||||
|
||||
/**
|
||||
* 查询生产准备记录列表
|
||||
*
|
||||
* @param productionArrangements 生产准备记录
|
||||
* @return 生产准备记录集合
|
||||
*/
|
||||
public List<ProductionArrangements> selectProductionArrangementsList(ProductionArrangements productionArrangements);
|
||||
|
||||
/**
|
||||
* 新增生产准备记录
|
||||
*
|
||||
* @param productionArrangements 生产准备记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertProductionArrangements(ProductionArrangements productionArrangements);
|
||||
|
||||
/**
|
||||
* 修改生产准备记录
|
||||
*
|
||||
* @param productionArrangements 生产准备记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateProductionArrangements(ProductionArrangements productionArrangements);
|
||||
|
||||
/**
|
||||
* 删除生产准备记录
|
||||
*
|
||||
* @param productionArrangementsId 生产准备记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProductionArrangementsByProductionArrangementsId(String productionArrangementsId);
|
||||
|
||||
/**
|
||||
* 批量删除生产准备记录
|
||||
*
|
||||
* @param productionArrangementsIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProductionArrangementsByProductionArrangementsIds(String[] productionArrangementsIds);
|
||||
|
||||
ProductionArrangements selectProductionArrangementsByPlanSheet(String planSheet);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ktg.mes.wm.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ktg.mes.wm.domain.ProductionArrangements;
|
||||
|
||||
/**
|
||||
* 生产准备记录Service接口
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2024-11-18
|
||||
*/
|
||||
public interface IProductionArrangementsService
|
||||
{
|
||||
/**
|
||||
* 查询生产准备记录
|
||||
*
|
||||
* @param productionArrangementsId 生产准备记录主键
|
||||
* @return 生产准备记录
|
||||
*/
|
||||
public ProductionArrangements selectProductionArrangementsByProductionArrangementsId(String productionArrangementsId);
|
||||
|
||||
/**
|
||||
* 查询生产准备记录列表
|
||||
*
|
||||
* @param productionArrangements 生产准备记录
|
||||
* @return 生产准备记录集合
|
||||
*/
|
||||
public List<ProductionArrangements> selectProductionArrangementsList(ProductionArrangements productionArrangements);
|
||||
|
||||
/**
|
||||
* 新增生产准备记录
|
||||
*
|
||||
* @param productionArrangements 生产准备记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertProductionArrangements(ProductionArrangements productionArrangements);
|
||||
|
||||
/**
|
||||
* 修改生产准备记录
|
||||
*
|
||||
* @param productionArrangements 生产准备记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateProductionArrangements(ProductionArrangements productionArrangements);
|
||||
|
||||
/**
|
||||
* 批量删除生产准备记录
|
||||
*
|
||||
* @param productionArrangementsIds 需要删除的生产准备记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProductionArrangementsByProductionArrangementsIds(String[] productionArrangementsIds);
|
||||
|
||||
/**
|
||||
* 删除生产准备记录信息
|
||||
*
|
||||
* @param productionArrangementsId 生产准备记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProductionArrangementsByProductionArrangementsId(String productionArrangementsId);
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.ktg.mes.wm.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ktg.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ktg.mes.wm.mapper.ProductionArrangementsMapper;
|
||||
import com.ktg.mes.wm.domain.ProductionArrangements;
|
||||
import com.ktg.mes.wm.service.IProductionArrangementsService;
|
||||
|
||||
/**
|
||||
* 生产准备记录Service业务层处理
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2024-11-18
|
||||
*/
|
||||
@Service
|
||||
public class ProductionArrangementsServiceImpl implements IProductionArrangementsService
|
||||
{
|
||||
@Autowired
|
||||
private ProductionArrangementsMapper productionArrangementsMapper;
|
||||
|
||||
/**
|
||||
* 查询生产准备记录
|
||||
*
|
||||
* @param productionArrangementsId 生产准备记录主键
|
||||
* @return 生产准备记录
|
||||
*/
|
||||
@Override
|
||||
public ProductionArrangements selectProductionArrangementsByProductionArrangementsId(String productionArrangementsId)
|
||||
{
|
||||
return productionArrangementsMapper.selectProductionArrangementsByProductionArrangementsId(productionArrangementsId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询生产准备记录列表
|
||||
*
|
||||
* @param productionArrangements 生产准备记录
|
||||
* @return 生产准备记录
|
||||
*/
|
||||
@Override
|
||||
public List<ProductionArrangements> selectProductionArrangementsList(ProductionArrangements productionArrangements)
|
||||
{
|
||||
return productionArrangementsMapper.selectProductionArrangementsList(productionArrangements);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产准备记录
|
||||
*
|
||||
* @param productionArrangements 生产准备记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertProductionArrangements(ProductionArrangements productionArrangements)
|
||||
{
|
||||
productionArrangements.setCreateTime(DateUtils.getNowDate());
|
||||
return productionArrangementsMapper.insertProductionArrangements(productionArrangements);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改生产准备记录
|
||||
*
|
||||
* @param productionArrangements 生产准备记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateProductionArrangements(ProductionArrangements productionArrangements)
|
||||
{
|
||||
productionArrangements.setUpdateTime(DateUtils.getNowDate());
|
||||
return productionArrangementsMapper.updateProductionArrangements(productionArrangements);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除生产准备记录
|
||||
*
|
||||
* @param productionArrangementsIds 需要删除的生产准备记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteProductionArrangementsByProductionArrangementsIds(String[] productionArrangementsIds)
|
||||
{
|
||||
return productionArrangementsMapper.deleteProductionArrangementsByProductionArrangementsIds(productionArrangementsIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除生产准备记录信息
|
||||
*
|
||||
* @param productionArrangementsId 生产准备记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteProductionArrangementsByProductionArrangementsId(String productionArrangementsId)
|
||||
{
|
||||
return productionArrangementsMapper.deleteProductionArrangementsByProductionArrangementsId(productionArrangementsId);
|
||||
}
|
||||
}
|
@ -14,9 +14,7 @@ import com.ktg.mes.md.service.IBaseTechnologyBomService;
|
||||
import com.ktg.mes.md.service.IBomRouteService;
|
||||
import com.ktg.mes.md.service.IMdItemService;
|
||||
import com.ktg.mes.wm.domain.*;
|
||||
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
|
||||
import com.ktg.mes.wm.mapper.WmsInPlanMapper;
|
||||
import com.ktg.mes.wm.mapper.WmsInTaskMapper;
|
||||
import com.ktg.mes.wm.mapper.*;
|
||||
import com.ktg.mes.wm.service.IWmStorageAreaService;
|
||||
import com.ktg.mes.wm.service.IWmsInPlanService;
|
||||
import com.ktg.mes.wm.service.IWmsInTaskService;
|
||||
@ -24,7 +22,6 @@ import com.ktg.system.mapper.SysOperLogMapper;
|
||||
import com.ktg.system.service.ISysOperLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ktg.mes.wm.mapper.WmsZdTaskMapper;
|
||||
import com.ktg.mes.wm.service.IWmsZdTaskService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -74,6 +71,9 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
|
||||
@Autowired
|
||||
private WmsOutTaskMapper wmsOutTaskMapper;
|
||||
|
||||
@Autowired
|
||||
private ProductionArrangementsMapper productionArrangementsMapper;
|
||||
|
||||
/**
|
||||
* 查询组装任务
|
||||
*
|
||||
@ -172,7 +172,6 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
|
||||
return AjaxResult.error("bom物料不足进行组装:" + mbbProduBom.getMdItemCode());
|
||||
}
|
||||
|
||||
List<WmsOutPlanDetail> wmsOutPlanDetailList = new ArrayList<>();
|
||||
List<BaseKnife> baseKnifeListOutPlan = new ArrayList<>();
|
||||
|
||||
// 查询工艺bom
|
||||
@ -224,6 +223,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
|
||||
// 判断是否需要锁定整刀
|
||||
if (lockedFlag) {
|
||||
baseKnife.setIsLocked(1);
|
||||
baseKnife.setKnifeFineState(2);
|
||||
baseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
|
||||
baseKnife.setLockedEndTime(technologyBom.getLockedEndTime());
|
||||
} else {
|
||||
@ -251,7 +251,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
|
||||
if (bomCount > 0) {
|
||||
wmsBaseKnife.setZdTaskId(zdTask.getWmsZdTaskId());
|
||||
wmsBaseKnife.setIsLocked(1);
|
||||
wmsBaseKnife.setKnifeFineState(2);
|
||||
wmsBaseKnife.setKnifeFineState(1);
|
||||
wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
|
||||
wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime());
|
||||
wmsBaseKnife.setParentId(baseKnife.getBaseKnifeId());
|
||||
@ -269,236 +269,98 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
|
||||
// 更新重置次数
|
||||
baseKnife.setResetCount(resetCount - 1);
|
||||
baseKnifeMapper.updateBaseKnife(baseKnife);
|
||||
|
||||
// 出库任务,进行基础物料的出库
|
||||
HashMap<Long, HashMap<String, List<BaseKnife>>> baseKnifeHashMapMap = new HashMap<>();
|
||||
|
||||
// 遍历构建map
|
||||
baseKnifeListOutPlan.forEach(item -> {
|
||||
// 判断当前物料主键是否已经被收录
|
||||
baseKnifeHashMapMap.computeIfAbsent(item.getMbbBdMrlId(), k -> new HashMap<>());
|
||||
|
||||
// 判断当前库位编码是否已经被收录
|
||||
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).computeIfAbsent(item.getAreaCode(), k -> new ArrayList<>());
|
||||
|
||||
// 对当前台账对象进行收录
|
||||
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).get(item.getAreaCode()).add(item);
|
||||
});
|
||||
|
||||
// 生成出库计划明细
|
||||
WmsOutPlan outPlanTemp = outPlan;
|
||||
baseKnifeHashMapMap.keySet().forEach(mdItemId -> {
|
||||
MdItem mdItemOutPlan = mdItemMapper.selectMdItemById(mdItemId);
|
||||
// 根据库位编码遍历
|
||||
baseKnifeHashMapMap.get(mdItemId).keySet().forEach(areaCode -> {
|
||||
// 获得库位对象
|
||||
WmStorageArea wmStorageAreaOutPlan = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(areaCode);
|
||||
|
||||
WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail();
|
||||
outPlanDetail.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
|
||||
outPlanDetail.setMdItemId(mdItemId);
|
||||
outPlanDetail.setMdItemCode(mdItemOutPlan.getItemCode());
|
||||
outPlanDetail.setMdItemName(mdItemOutPlan.getItemName());
|
||||
outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName());
|
||||
outPlanDetail.setPlannedQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
|
||||
outPlanDetail.setRealQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
|
||||
outPlanDetail.setDetailBatchNum(batchNum);
|
||||
outPlanDetail.setWmStorageAreaId(wmStorageAreaOutPlan.getAreaId());
|
||||
outPlanDetail.setWmStorageAreaCode(wmStorageAreaOutPlan.getAreaCode());
|
||||
outPlanDetail.setWmStorageAreaName(wmStorageAreaOutPlan.getAreaName());
|
||||
outPlanDetail.setDetailState("1");
|
||||
outPlanDetail.setCreateBy(getUsername());
|
||||
outPlanDetail.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanMapper.insertWmsOutPlanDetail(outPlanDetail);
|
||||
|
||||
// 遍历台账对象
|
||||
baseKnifeHashMapMap.get(mdItemId).get(areaCode).forEach(item -> {
|
||||
// 构建出库计划明细实体
|
||||
WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity();
|
||||
wmsOutPlanDetailEntity.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
||||
wmsOutPlanDetailEntity.setBaseKnifeId(item.getBaseKnifeId());
|
||||
wmsOutPlanDetailEntity.setAreaCode(item.getAreaCode());
|
||||
wmsOutPlanDetailEntity.setItemOrProduct(item.getItemOrProduct());
|
||||
wmsOutPlanDetailEntity.setKnifeCode(item.getKnifeCode());
|
||||
wmsOutPlanDetailEntity.setKnifeName(item.getKnifeName());
|
||||
wmsOutPlanDetailEntity.setPlanSheet(item.getPlanSheet());
|
||||
wmsOutPlanDetailEntity.setKnifeLife(item.getKnifeLife());
|
||||
wmsOutPlanDetailEntity.setResetCount(item.getResetCount());
|
||||
wmsOutPlanDetailEntity.setKnifeUnit(item.getKnifeUnit());
|
||||
wmsOutPlanDetailEntity.setSafeStock(item.getKnifeType());
|
||||
wmsOutPlanDetailEntity.setStandardQuantity(item.getStandardQuantity());
|
||||
wmsOutPlanDetailEntity.setCreateBy(getUsername());
|
||||
wmsOutPlanDetailEntity.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);
|
||||
});
|
||||
|
||||
// 生成出库任务
|
||||
WmsOutTask wmsOutTask = new WmsOutTask();
|
||||
wmsOutTask.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
|
||||
wmsOutTask.setWmsOutPlanCode(outPlanTemp.getPlanCode());
|
||||
wmsOutTask.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
||||
// 出库类型 12组刀出库
|
||||
wmsOutTask.setWmsBusinessTypeId(12L);
|
||||
wmsOutTask.setTaskCode(generateTaskCode("CKT"));
|
||||
wmsOutTask.setTaskNumber(outPlanDetail.getPlannedQuantity());
|
||||
wmsOutTask.setOutNumber(outPlanDetail.getRealQuantity());
|
||||
wmsOutTask.setWmStorageAreaId(outPlanDetail.getWmStorageAreaId());
|
||||
wmsOutTask.setBatchNum(batchNum);
|
||||
wmsOutTask.setMdItemId(outPlanDetail.getMdItemId());
|
||||
wmsOutTask.setMdItemCode(outPlanDetail.getMdItemCode());
|
||||
wmsOutTask.setMdItemName(outPlanDetail.getMdItemName());
|
||||
wmsOutTask.setMdItemUnit(outPlanDetail.getMdItemUnit());
|
||||
wmsOutTask.setTaskState("1");
|
||||
wmsOutTask.setRecipientUsername("");
|
||||
wmsOutTask.setCreateBy(getUsername());
|
||||
wmsOutTask.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 出库任务,进行基础物料的出库
|
||||
HashMap<Long, HashMap<String, List<BaseKnife>>> baseKnifeHashMapMap = new HashMap<>();
|
||||
|
||||
// 遍历构建map
|
||||
baseKnifeListOutPlan.forEach(item -> {
|
||||
// 判断当前物料主键是否已经被收录
|
||||
baseKnifeHashMapMap.computeIfAbsent(item.getMbbBdMrlId(), k -> new HashMap<>());
|
||||
|
||||
// 判断当前库位编码是否已经被收录
|
||||
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).computeIfAbsent(item.getAreaCode(), k -> new ArrayList<>());
|
||||
|
||||
// 对当前台账对象进行收录
|
||||
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).get(item.getAreaCode()).add(item);
|
||||
});
|
||||
|
||||
// 生成出库计划明细
|
||||
WmsOutPlan outPlanTemp = outPlan;
|
||||
baseKnifeHashMapMap.keySet().forEach(mdItemId -> {
|
||||
MdItem mdItemOutPlan = mdItemMapper.selectMdItemById(mdItemId);
|
||||
// 根据库位编码遍历
|
||||
baseKnifeHashMapMap.get(mdItemId).keySet().forEach(areaCode -> {
|
||||
// 获得库位对象
|
||||
WmStorageArea wmStorageAreaOutPlan = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(areaCode);
|
||||
|
||||
WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail();
|
||||
outPlanDetail.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
|
||||
outPlanDetail.setMdItemId(mdItemId);
|
||||
outPlanDetail.setMdItemCode(mdItemOutPlan.getItemCode());
|
||||
outPlanDetail.setMdItemName(mdItemOutPlan.getItemName());
|
||||
outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName());
|
||||
outPlanDetail.setPlannedQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
|
||||
outPlanDetail.setRealQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
|
||||
outPlanDetail.setDetailBatchNum(batchNum);
|
||||
outPlanDetail.setWmStorageAreaId(wmStorageAreaOutPlan.getAreaId());
|
||||
outPlanDetail.setWmStorageAreaCode(wmStorageAreaOutPlan.getAreaCode());
|
||||
outPlanDetail.setWmStorageAreaName(wmStorageAreaOutPlan.getAreaName());
|
||||
outPlanDetail.setDetailState("1");
|
||||
outPlanDetail.setCreateBy(getUsername());
|
||||
outPlanDetail.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanMapper.insertWmsOutPlanDetail(outPlanDetail);
|
||||
|
||||
// 遍历台账对象
|
||||
baseKnifeHashMapMap.get(mdItemId).get(areaCode).forEach(item -> {
|
||||
// 构建出库计划明细实体
|
||||
WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity();
|
||||
wmsOutPlanDetailEntity.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
||||
wmsOutPlanDetailEntity.setBaseKnifeId(item.getBaseKnifeId());
|
||||
wmsOutPlanDetailEntity.setAreaCode(item.getAreaCode());
|
||||
wmsOutPlanDetailEntity.setItemOrProduct(item.getItemOrProduct());
|
||||
wmsOutPlanDetailEntity.setKnifeCode(item.getKnifeCode());
|
||||
wmsOutPlanDetailEntity.setKnifeName(item.getKnifeName());
|
||||
wmsOutPlanDetailEntity.setPlanSheet(item.getPlanSheet());
|
||||
wmsOutPlanDetailEntity.setKnifeLife(item.getKnifeLife());
|
||||
wmsOutPlanDetailEntity.setResetCount(item.getResetCount());
|
||||
wmsOutPlanDetailEntity.setKnifeUnit(item.getKnifeUnit());
|
||||
wmsOutPlanDetailEntity.setSafeStock(item.getKnifeType());
|
||||
wmsOutPlanDetailEntity.setStandardQuantity(item.getStandardQuantity());
|
||||
wmsOutPlanDetailEntity.setCreateBy(getUsername());
|
||||
wmsOutPlanDetailEntity.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);
|
||||
});
|
||||
|
||||
// 生成出库任务
|
||||
WmsOutTask wmsOutTask = new WmsOutTask();
|
||||
wmsOutTask.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
|
||||
wmsOutTask.setWmsOutPlanCode(outPlanTemp.getPlanCode());
|
||||
wmsOutTask.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
||||
// 出库类型 12组刀出库
|
||||
wmsOutTask.setWmsBusinessTypeId(12L);
|
||||
wmsOutTask.setTaskCode(generateTaskCode("CKT"));
|
||||
wmsOutTask.setTaskNumber(outPlanDetail.getPlannedQuantity());
|
||||
wmsOutTask.setOutNumber(outPlanDetail.getRealQuantity());
|
||||
wmsOutTask.setWmStorageAreaId(outPlanDetail.getWmStorageAreaId());
|
||||
wmsOutTask.setBatchNum(batchNum);
|
||||
wmsOutTask.setMdItemId(outPlanDetail.getMdItemId());
|
||||
wmsOutTask.setMdItemCode(outPlanDetail.getMdItemCode());
|
||||
wmsOutTask.setMdItemName(outPlanDetail.getMdItemName());
|
||||
wmsOutTask.setMdItemUnit(outPlanDetail.getMdItemUnit());
|
||||
wmsOutTask.setTaskState("1");
|
||||
wmsOutTask.setRecipientUsername("");
|
||||
wmsOutTask.setCreateBy(getUsername());
|
||||
wmsOutTask.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
|
||||
});
|
||||
});
|
||||
|
||||
// 更新组装任务
|
||||
zdTask.setStatus("1");
|
||||
// zdTask.setQtyOk(zdTask.getProductIdQty());
|
||||
wmsZdTaskMapper.updateWmsZdTask(zdTask);
|
||||
return AjaxResult.success();
|
||||
|
||||
|
||||
// String batchNum = "ZZPC001";
|
||||
//
|
||||
// // 判断物料是否充足
|
||||
// BomRoute bomRoute = bomRouteMapper.selectBomRouteByBomRouteId(zdTask.getAttr1());
|
||||
// BaseKnife baseKnifeWrapper = new BaseKnife();
|
||||
// List<BaseKnife> baseKnifeList = new ArrayList<>();
|
||||
//
|
||||
// // 遍历组装整刀需要的bom物料
|
||||
// for (MbbProduBom mbbProduBom : bomRoute.getMbbProduBomList()) {
|
||||
// // 查找未锁定的物料
|
||||
// baseKnifeWrapper.setMbbBdMrlId(mbbProduBom.getMdItemId());
|
||||
// baseKnifeWrapper.setIsLocked(0);
|
||||
// baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
|
||||
//
|
||||
// // 如果未锁定的物料不足所需数量
|
||||
// if (baseKnifeList.size() < mbbProduBom.getStandardDosage() * zdTask.getProductIdQty())
|
||||
// return AjaxResult.error("bom物料不足进行组装:" + mbbProduBom.getMdItemCode());
|
||||
// }
|
||||
//
|
||||
// List<WmsOutPlanDetail> wmsOutPlanDetailList = new ArrayList<>();
|
||||
// List<BaseKnife> baseKnifeListOutPlan = new ArrayList<>();
|
||||
//
|
||||
// BaseTechnologyBom technologyBom = new BaseTechnologyBom();
|
||||
//
|
||||
// // 出库基础物料, 根据图号查询出库计划,如果不存在生成计划,存在则往计划中添加任务
|
||||
// WmsOutPlan outPlan = wmsOutPlanMapper.selectWmsOutPlanByPlanCode(zdTask.getAttr4());
|
||||
// if (outPlan == null){
|
||||
// // 构建新的出库计划
|
||||
// WmsOutPlan outPlanTemp = new WmsOutPlan();
|
||||
// outPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4());
|
||||
// outPlanTemp.setWmsBusinessTypeId(12L);
|
||||
// outPlanTemp.setPlanState("1");
|
||||
// outPlanTemp.setPlanType("ZDCK");
|
||||
// outPlanTemp.setCreateBy(getUsername());
|
||||
// outPlanTemp.setCreateTime(DateUtils.getNowDate());
|
||||
// wmsOutPlanMapper.insertWmsOutPlan(outPlanTemp);
|
||||
// outPlan = outPlanTemp;
|
||||
// }
|
||||
//
|
||||
// // 出库任务
|
||||
// for (MbbProduBom mbbProduBom : bomRoute.getMbbProduBomList()) {
|
||||
// // 出库任务,进行基础物料的出库
|
||||
// MdItem mdItemOutPlan = mdItemMapper.selectMdItemById(mbbProduBom.getMdItemId());
|
||||
// WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail();
|
||||
// outPlanDetail.setWmsOutPlanId(outPlan.getWmsOutPlanId());
|
||||
// outPlanDetail.setMdItemId(mbbProduBom.getMdItemId());
|
||||
// outPlanDetail.setMdItemCode(mdItemOutPlan.getItemCode());
|
||||
// outPlanDetail.setMdItemName(mdItemOutPlan.getItemName());
|
||||
// outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName());
|
||||
// outPlanDetail.setPlannedQuantity(mbbProduBom.getStandardDosage() * zdTask.getProductIdQty());
|
||||
// outPlanDetail.setRealQuantity(mbbProduBom.getStandardDosage() * zdTask.getProductIdQty());
|
||||
// outPlanDetail.setDetailBatchNum(batchNum);
|
||||
// // 查询库位信息
|
||||
// WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(zdTask.getAttr3());
|
||||
// outPlanDetail.setWmStorageAreaId(wmStorageArea.getAreaId());
|
||||
// outPlanDetail.setWmStorageAreaCode(wmStorageArea.getAreaCode());
|
||||
// outPlanDetail.setWmStorageAreaName(wmStorageArea.getAreaName());
|
||||
// outPlanDetail.setDetailState("1");
|
||||
// wmsOutPlanDetailList.add(outPlanDetail);
|
||||
//
|
||||
// // 查询未锁定的物料
|
||||
// baseKnifeWrapper.setMbbBdMrlId(mbbProduBom.getMdItemId());
|
||||
// baseKnifeWrapper.setIsLocked(0);
|
||||
// baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
|
||||
//
|
||||
// // 锁定基础 物料
|
||||
// int bomCount = mbbProduBom.getStandardDosage();
|
||||
// for (BaseKnife wmsBaseKnife : baseKnifeList){
|
||||
// if (bomCount > 0){
|
||||
// wmsBaseKnife.setIsLocked(1);
|
||||
// wmsBaseKnife.setKnifeFineState(2);
|
||||
// wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
|
||||
// wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime());
|
||||
//// wmsBaseKnife.setAttr1(baseKnife.getBaseKnifeId());
|
||||
// wmsBaseKnife.setPlanSheet(zdTask.getAttr4());
|
||||
// baseKnifeListOutPlan.add(wmsBaseKnife);
|
||||
// baseKnifeMapper.updateBaseKnife(wmsBaseKnife);
|
||||
// bomCount--;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 出库
|
||||
// int i = 0;
|
||||
// for (WmsOutPlanDetail outPlanDetail : wmsOutPlanDetailList){
|
||||
// wmsOutPlanMapper.insertWmsOutPlanDetail(outPlanDetail);
|
||||
//
|
||||
// // 出库计划明细,绑定实体
|
||||
// for (int j = 0; j < outPlanDetail.getPlannedQuantity(); j++) {
|
||||
// WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity();
|
||||
// wmsOutPlanDetailEntity.setBaseKnifeId(baseKnifeListOutPlan.get(i).getBaseKnifeId());
|
||||
// wmsOutPlanDetailEntity.setAreaCode(baseKnifeListOutPlan.get(i).getAreaCode());
|
||||
// wmsOutPlanDetailEntity.setItemOrProduct(baseKnifeListOutPlan.get(i).getItemOrProduct());
|
||||
// wmsOutPlanDetailEntity.setKnifeCode(baseKnifeListOutPlan.get(i).getKnifeCode());
|
||||
// wmsOutPlanDetailEntity.setKnifeName(baseKnifeListOutPlan.get(i).getKnifeName());
|
||||
// wmsOutPlanDetailEntity.setPlanSheet(baseKnifeListOutPlan.get(i).getPlanSheet());
|
||||
// wmsOutPlanDetailEntity.setKnifeLife(baseKnifeListOutPlan.get(i).getKnifeLife());
|
||||
// wmsOutPlanDetailEntity.setResetCount(baseKnifeListOutPlan.get(i).getResetCount());
|
||||
// wmsOutPlanDetailEntity.setKnifeUnit(baseKnifeListOutPlan.get(i).getKnifeUnit());
|
||||
// wmsOutPlanDetailEntity.setSafeStock(baseKnifeListOutPlan.get(i).getKnifeType());
|
||||
// wmsOutPlanDetailEntity.setStandardQuantity(baseKnifeListOutPlan.get(i++).getStandardQuantity());
|
||||
// wmsOutPlanDetailEntity.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
||||
// wmsOutPlanDetailEntity.setCreateBy(getUsername());
|
||||
// wmsOutPlanDetailEntity.setCreateTime(DateUtils.getNowDate());
|
||||
// wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);
|
||||
// }
|
||||
//
|
||||
// // 生成出库任务
|
||||
// WmsOutTask wmsOutTask = new WmsOutTask();
|
||||
// wmsOutTask.setWmsOutPlanId(outPlan.getWmsOutPlanId());
|
||||
// wmsOutTask.setWmsOutPlanCode(outPlan.getPlanCode());
|
||||
// wmsOutTask.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
||||
// // 出库类型 12组刀出库
|
||||
// wmsOutTask.setWmsBusinessTypeId(12L);
|
||||
// wmsOutTask.setTaskCode(generateTaskCode(outPlan.getPlanCode()));
|
||||
// wmsOutTask.setTaskNumber(outPlanDetail.getPlannedQuantity());
|
||||
// wmsOutTask.setOutNumber(outPlanDetail.getRealQuantity());
|
||||
// wmsOutTask.setWmStorageAreaId(outPlanDetail.getWmStorageAreaId());
|
||||
// wmsOutTask.setBatchNum(batchNum);
|
||||
// wmsOutTask.setMdItemId(outPlanDetail.getMdItemId());
|
||||
// wmsOutTask.setMdItemCode(outPlanDetail.getMdItemCode());
|
||||
// wmsOutTask.setMdItemName(outPlanDetail.getMdItemName());
|
||||
// wmsOutTask.setMdItemUnit(outPlanDetail.getMdItemUnit());
|
||||
// wmsOutTask.setTaskState("1");
|
||||
// wmsOutTask.setRecipientUsername("");
|
||||
// wmsOutTask.setCreateBy(getUsername());
|
||||
// wmsOutTask.setCreateTime(DateUtils.getNowDate());
|
||||
// wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
|
||||
// }
|
||||
//
|
||||
// // 更新组装任务
|
||||
// zdTask.setStatus("1");
|
||||
// zdTask.setQtyOk(zdTask.getProductIdQty());
|
||||
// wmsZdTaskMapper.updateWmsZdTask(zdTask);
|
||||
// return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@ -580,9 +442,8 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
|
||||
baseKnifeMapper.updateBaseKnife(baseKnife);
|
||||
});
|
||||
|
||||
// 生成出库任务
|
||||
|
||||
|
||||
// 检测订单是否完成,完成则出库整刀
|
||||
if (zdTask.getPlanSheet() != null && this.checkFinal(zdTask.getPlanSheet())) this.createOutTask(zdTask.getPlanSheet());
|
||||
|
||||
// 更新组装任务
|
||||
zdTask.setStatus("2");
|
||||
@ -601,4 +462,149 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
}
|
||||
|
||||
// 检查订单完成状态
|
||||
public Boolean checkFinal(String planSheet){
|
||||
// 获取订单记录
|
||||
ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet);
|
||||
String[] processCodes = productionArrangements.getProcessCode().substring(1, productionArrangements.getProcessCode().length() - 1).split(",");
|
||||
for (String processCode : processCodes) {
|
||||
// 遍历工序
|
||||
List<BaseTechnologyBom> baseTechnologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomListByProcessCode(processCode.trim());
|
||||
if (baseTechnologyBomList != null && baseTechnologyBomList.size() > 0) {
|
||||
// 判断订单锁定的物料是否足够
|
||||
for (BaseTechnologyBom technologyBom : baseTechnologyBomList) {
|
||||
BaseKnife baseKnifeWrapper = new BaseKnife();
|
||||
baseKnifeWrapper.setPlanSheet(planSheet);
|
||||
baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode());
|
||||
List<BaseKnife> baseKnifePlanSheetList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
|
||||
if (baseKnifePlanSheetList.size() < technologyBom.getKnifeCount()) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// 检查订单完成状态
|
||||
@Transactional
|
||||
public void createOutTask(String planSheet){
|
||||
// 构建出库计划
|
||||
WmsOutPlan outPlan = new WmsOutPlan();
|
||||
outPlan.setPlanCode(planSheet);
|
||||
outPlan.setWmsBusinessTypeId(16L);
|
||||
outPlan.setPlanState("1");
|
||||
outPlan.setPlanType("ZDCK");
|
||||
outPlan.setCreateBy(getUsername());
|
||||
outPlan.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanMapper.insertWmsOutPlan(outPlan);
|
||||
|
||||
// 所有的物料
|
||||
List<BaseKnife> baseKnifeResultList = new ArrayList<>();
|
||||
|
||||
// 获取订单记录
|
||||
ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet);
|
||||
String[] processCodes = productionArrangements.getProcessCode().substring(1, productionArrangements.getProcessCode().length() - 1).split(",");
|
||||
for (String processCode : processCodes) {
|
||||
// 遍历工序
|
||||
List<BaseTechnologyBom> baseTechnologyBomList = baseTechnologyBomMapper.selectBaseTechnologyBomListByProcessCode(processCode.trim());
|
||||
if (baseTechnologyBomList != null && baseTechnologyBomList.size() > 0) {
|
||||
// 判断订单锁定的物料是否足够
|
||||
for (BaseTechnologyBom technologyBom : baseTechnologyBomList) {
|
||||
BaseKnife baseKnifeWrapper = new BaseKnife();
|
||||
baseKnifeWrapper.setPlanSheet(planSheet);
|
||||
baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode());
|
||||
List<BaseKnife> baseKnifeLockedList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
|
||||
if (baseKnifeLockedList.size() == technologyBom.getKnifeCount()) baseKnifeResultList.addAll(baseKnifeLockedList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String batchNum = "SCZBPC01";
|
||||
// 出库任务,进行基础物料的出库
|
||||
HashMap<Long, HashMap<String, List<BaseKnife>>> baseKnifeHashMapMap = new HashMap<>();
|
||||
|
||||
// 遍历构建map
|
||||
baseKnifeResultList.forEach(item -> {
|
||||
// 判断当前物料主键是否已经被收录
|
||||
baseKnifeHashMapMap.computeIfAbsent(item.getMbbBdMrlId(), k -> new HashMap<>());
|
||||
|
||||
// 判断当前库位编码是否已经被收录
|
||||
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).computeIfAbsent(item.getAreaCode(), k -> new ArrayList<>());
|
||||
|
||||
// 对当前台账对象进行收录
|
||||
baseKnifeHashMapMap.get(item.getMbbBdMrlId()).get(item.getAreaCode()).add(item);
|
||||
});
|
||||
|
||||
// 生成出库计划明细
|
||||
WmsOutPlan outPlanTemp = outPlan;
|
||||
baseKnifeHashMapMap.keySet().forEach(mdItemId -> {
|
||||
MdItem mdItemOutPlan = mdItemMapper.selectMdItemById(mdItemId);
|
||||
// 根据库位编码遍历
|
||||
baseKnifeHashMapMap.get(mdItemId).keySet().forEach(areaCode -> {
|
||||
// 获得库位对象
|
||||
WmStorageArea wmStorageAreaOutPlan = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(areaCode);
|
||||
|
||||
WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail();
|
||||
outPlanDetail.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
|
||||
outPlanDetail.setMdItemId(mdItemId);
|
||||
outPlanDetail.setMdItemCode(mdItemOutPlan.getItemCode());
|
||||
outPlanDetail.setMdItemName(mdItemOutPlan.getItemName());
|
||||
outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName());
|
||||
outPlanDetail.setPlannedQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
|
||||
outPlanDetail.setRealQuantity(baseKnifeHashMapMap.get(mdItemId).get(areaCode).size());
|
||||
outPlanDetail.setDetailBatchNum(batchNum);
|
||||
outPlanDetail.setWmStorageAreaId(wmStorageAreaOutPlan.getAreaId());
|
||||
outPlanDetail.setWmStorageAreaCode(wmStorageAreaOutPlan.getAreaCode());
|
||||
outPlanDetail.setWmStorageAreaName(wmStorageAreaOutPlan.getAreaName());
|
||||
outPlanDetail.setDetailState("1");
|
||||
outPlanDetail.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanMapper.insertWmsOutPlanDetail(outPlanDetail);
|
||||
|
||||
// 遍历台账对象
|
||||
baseKnifeHashMapMap.get(mdItemId).get(areaCode).forEach(item -> {
|
||||
// 构建出库计划明细实体
|
||||
WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity();
|
||||
wmsOutPlanDetailEntity.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
||||
wmsOutPlanDetailEntity.setBaseKnifeId(item.getBaseKnifeId());
|
||||
wmsOutPlanDetailEntity.setAreaCode(item.getAreaCode());
|
||||
wmsOutPlanDetailEntity.setItemOrProduct(item.getItemOrProduct());
|
||||
wmsOutPlanDetailEntity.setKnifeCode(item.getKnifeCode());
|
||||
wmsOutPlanDetailEntity.setKnifeName(item.getKnifeName());
|
||||
wmsOutPlanDetailEntity.setPlanSheet(item.getPlanSheet());
|
||||
wmsOutPlanDetailEntity.setKnifeLife(item.getKnifeLife());
|
||||
wmsOutPlanDetailEntity.setResetCount(item.getResetCount());
|
||||
wmsOutPlanDetailEntity.setKnifeUnit(item.getKnifeUnit());
|
||||
wmsOutPlanDetailEntity.setSafeStock(item.getKnifeType());
|
||||
wmsOutPlanDetailEntity.setStandardQuantity(item.getStandardQuantity());
|
||||
wmsOutPlanDetailEntity.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);
|
||||
});
|
||||
|
||||
// 生成出库任务
|
||||
WmsOutTask wmsOutTask = new WmsOutTask();
|
||||
wmsOutTask.setWmsOutPlanId(outPlanTemp.getWmsOutPlanId());
|
||||
wmsOutTask.setWmsOutPlanCode(outPlanTemp.getPlanCode());
|
||||
wmsOutTask.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
||||
// 出库类型 12组刀出库
|
||||
wmsOutTask.setWmsBusinessTypeId(12L);
|
||||
wmsOutTask.setTaskCode(generateTaskCode("CKT"));
|
||||
wmsOutTask.setTaskNumber(outPlanDetail.getPlannedQuantity());
|
||||
wmsOutTask.setOutNumber(outPlanDetail.getRealQuantity());
|
||||
wmsOutTask.setWmStorageAreaId(outPlanDetail.getWmStorageAreaId());
|
||||
wmsOutTask.setBatchNum(batchNum);
|
||||
wmsOutTask.setMdItemId(outPlanDetail.getMdItemId());
|
||||
wmsOutTask.setMdItemCode(outPlanDetail.getMdItemCode());
|
||||
wmsOutTask.setMdItemName(outPlanDetail.getMdItemName());
|
||||
wmsOutTask.setMdItemUnit(outPlanDetail.getMdItemUnit());
|
||||
wmsOutTask.setTaskState("0");
|
||||
wmsOutTask.setRecipientUsername("");
|
||||
wmsOutTask.setCreateTime(DateUtils.getNowDate());
|
||||
wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
|
||||
});
|
||||
});
|
||||
|
||||
productionArrangements.setStatus(1);
|
||||
productionArrangementsMapper.updateProductionArrangements(productionArrangements);
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@
|
||||
and STANDARD_QUANTITY = #{standardQuantity}
|
||||
</if>
|
||||
<if test="areaCode != null and areaCode != ''">
|
||||
and AREA_CODE = #{areaCode}
|
||||
and BK.AREA_CODE = #{areaCode}
|
||||
</if>
|
||||
<if test="knifeLife != null and knifeLife != ''">
|
||||
and KNIFE_LIFE = #{knifeLife}
|
||||
@ -652,7 +652,7 @@
|
||||
and MBB_BD_MRL_ID = #{mbbBdMrlId}
|
||||
</if>
|
||||
<if test="areaCode != null and areaCode != ''">
|
||||
and AREA_CODE = #{areaCode}
|
||||
and BK.AREA_CODE = #{areaCode}
|
||||
</if>
|
||||
<if test="isLocked != null">
|
||||
and IS_LOCKED = #{isLocked}
|
||||
|
@ -146,4 +146,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{processCode}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectBaseTechnologyBomListByProcessCode" parameterType="String" resultMap="BaseTechnologyBomResult">
|
||||
<include refid="selectBaseTechnologyBomVo"/>
|
||||
where process_code = #{processCode}
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ktg.mes.wm.mapper.ProductionArrangementsMapper">
|
||||
|
||||
<resultMap type="ProductionArrangements" id="ProductionArrangementsResult">
|
||||
<result property="productionArrangementsId" column="PRODUCTION_ARRANGEMENTS_ID" />
|
||||
<result property="planSheet" column="PLAN_SHEET" />
|
||||
<result property="processCode" column="PROCESS_CODE" />
|
||||
<result property="status" column="STATUS" />
|
||||
<result property="attr1" column="ATTR1" />
|
||||
<result property="attr2" column="ATTR2" />
|
||||
<result property="attr3" column="ATTR3" />
|
||||
<result property="attr4" column="ATTR4" />
|
||||
<result property="createBy" column="CREATE_BY" />
|
||||
<result property="createTime" column="CREATE_TIME" />
|
||||
<result property="updateBy" column="UPDATE_BY" />
|
||||
<result property="updateTime" column="UPDATE_TIME" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectProductionArrangementsVo">
|
||||
select PRODUCTION_ARRANGEMENTS_ID, PLAN_SHEET, PROCESS_CODE, STATUS, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME from PRODUCTION_ARRANGEMENTS
|
||||
</sql>
|
||||
|
||||
<select id="selectProductionArrangementsList" parameterType="ProductionArrangements" resultMap="ProductionArrangementsResult">
|
||||
<include refid="selectProductionArrangementsVo"/>
|
||||
<where>
|
||||
<if test="planSheet != null and planSheet != ''"> and PLAN_SHEET = #{planSheet}</if>
|
||||
<if test="processCode != null and processCode != ''"> and PROCESS_CODE = #{processCode}</if>
|
||||
<if test="status != null and status != ''"> and STATUS = #{status}</if>
|
||||
<if test="attr1 != null and attr1 != ''"> and ATTR1 = #{attr1}</if>
|
||||
<if test="attr2 != null and attr2 != ''"> and ATTR2 = #{attr2}</if>
|
||||
<if test="attr3 != null and attr3 != ''"> and ATTR3 = #{attr3}</if>
|
||||
<if test="attr4 != null and attr4 != ''"> and ATTR4 = #{attr4}</if>
|
||||
<if test="createBy != null and createBy != ''"> and CREATE_BY = #{createBy}</if>
|
||||
<if test="createTime != null and createTime != ''"> and CREATE_TIME = #{createTime}</if>
|
||||
<if test="updateBy != null and updateBy != ''"> and UPDATE_BY = #{updateBy}</if>
|
||||
<if test="updateTime != null and updateTime != ''"> and UPDATE_TIME = #{updateTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectProductionArrangementsByProductionArrangementsId" parameterType="String" resultMap="ProductionArrangementsResult">
|
||||
<include refid="selectProductionArrangementsVo"/>
|
||||
where PRODUCTION_ARRANGEMENTS_ID = #{productionArrangementsId}
|
||||
</select>
|
||||
|
||||
<select id="selectProductionArrangementsByPlanSheet" parameterType="String" resultMap="ProductionArrangementsResult">
|
||||
<include refid="selectProductionArrangementsVo"/>
|
||||
where PLAN_SHEET = #{planSheet}
|
||||
</select>
|
||||
|
||||
<insert id="insertProductionArrangements" parameterType="ProductionArrangements" useGeneratedKeys="true" keyProperty="productionArrangementsId">
|
||||
insert into PRODUCTION_ARRANGEMENTS
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="planSheet != null">PLAN_SHEET,</if>
|
||||
<if test="processCode != null">PROCESS_CODE,</if>
|
||||
<if test="status != null">STATUS,</if>
|
||||
<if test="attr1 != null">ATTR1,</if>
|
||||
<if test="attr2 != null">ATTR2,</if>
|
||||
<if test="attr3 != null">ATTR3,</if>
|
||||
<if test="attr4 != null">ATTR4,</if>
|
||||
<if test="createBy != null">CREATE_BY,</if>
|
||||
<if test="createTime != null">CREATE_TIME,</if>
|
||||
<if test="updateBy != null">UPDATE_BY,</if>
|
||||
<if test="updateTime != null">UPDATE_TIME,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="planSheet != null">#{planSheet},</if>
|
||||
<if test="processCode != null">#{processCode},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="attr1 != null">#{attr1},</if>
|
||||
<if test="attr2 != null">#{attr2},</if>
|
||||
<if test="attr3 != null">#{attr3},</if>
|
||||
<if test="attr4 != null">#{attr4},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateProductionArrangements" parameterType="ProductionArrangements">
|
||||
update PRODUCTION_ARRANGEMENTS
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="planSheet != null">PLAN_SHEET = #{planSheet},</if>
|
||||
<if test="processCode != null">PROCESS_CODE = #{processCode},</if>
|
||||
<if test="status != null">STATUS = #{status},</if>
|
||||
<if test="attr1 != null">ATTR1 = #{attr1},</if>
|
||||
<if test="attr2 != null">ATTR2 = #{attr2},</if>
|
||||
<if test="attr3 != null">ATTR3 = #{attr3},</if>
|
||||
<if test="attr4 != null">ATTR4 = #{attr4},</if>
|
||||
<if test="createBy != null">CREATE_BY = #{createBy},</if>
|
||||
<if test="createTime != null">CREATE_TIME = #{createTime},</if>
|
||||
<if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
|
||||
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
|
||||
</trim>
|
||||
where PRODUCTION_ARRANGEMENTS_ID = #{productionArrangementsId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteProductionArrangementsByProductionArrangementsId" parameterType="String">
|
||||
delete from PRODUCTION_ARRANGEMENTS where PRODUCTION_ARRANGEMENTS_ID = #{productionArrangementsId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteProductionArrangementsByProductionArrangementsIds" parameterType="String">
|
||||
delete from PRODUCTION_ARRANGEMENTS where PRODUCTION_ARRANGEMENTS_ID in
|
||||
<foreach item="productionArrangementsId" collection="array" open="(" separator="," close=")">
|
||||
#{productionArrangementsId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user