diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/BaseKnifeController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/BaseKnifeController.java index d481884..5f6b4e1 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/controller/BaseKnifeController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/BaseKnifeController.java @@ -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>> 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>> 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); diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/InventoryBatchController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/InventoryBatchController.java new file mode 100644 index 0000000..92f92fa --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/InventoryBatchController.java @@ -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 result = new ArrayList<>(); + + WmsOutTask wmsOutTaskWrapper = new WmsOutTask(); + wmsOutTaskWrapper.setBatchNum(inventoryBatch.getBatchNum()); + wmsOutTaskWrapper.setMdItemCode(inventoryBatch.getMdItemCode()); + List 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 list = baseKnifeService.selectBaseKnifeList(baseKnife); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/InventoryBatch.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/InventoryBatch.java new file mode 100644 index 0000000..34b92cf --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/InventoryBatch.java @@ -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; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/BaseTechnologyBomMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/BaseTechnologyBomMapper.java index 889bf53..faf9253 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/BaseTechnologyBomMapper.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/BaseTechnologyBomMapper.java @@ -60,4 +60,6 @@ public interface BaseTechnologyBomMapper public int deleteBaseTechnologyBomByTechnologyBomIds(String[] technologyBomIds); List selectBaseTechnologyBomListByProcessCodeList(List processCodeList); + + List selectBaseTechnologyBomListByProcessCode(String processCode); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/ProductionArrangementsController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/ProductionArrangementsController.java new file mode 100644 index 0000000..6b6e369 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/ProductionArrangementsController.java @@ -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 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 list = productionArrangementsService.selectProductionArrangementsList(productionArrangements); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/ProductionArrangements.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/ProductionArrangements.java new file mode 100644 index 0000000..f5db7ba --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/ProductionArrangements.java @@ -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(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/ProductionArrangementsMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/ProductionArrangementsMapper.java new file mode 100644 index 0000000..dcab11f --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/ProductionArrangementsMapper.java @@ -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 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); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IProductionArrangementsService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IProductionArrangementsService.java new file mode 100644 index 0000000..8b57531 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IProductionArrangementsService.java @@ -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 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); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/ProductionArrangementsServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/ProductionArrangementsServiceImpl.java new file mode 100644 index 0000000..24924e5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/ProductionArrangementsServiceImpl.java @@ -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 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); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsZdTaskServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsZdTaskServiceImpl.java index 866e2c9..6fa74a6 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsZdTaskServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsZdTaskServiceImpl.java @@ -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 wmsOutPlanDetailList = new ArrayList<>(); List 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>> 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>> 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 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 wmsOutPlanDetailList = new ArrayList<>(); -// List 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 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 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 baseKnifeResultList = new ArrayList<>(); + + // 获取订单记录 + ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet); + String[] processCodes = productionArrangements.getProcessCode().substring(1, productionArrangements.getProcessCode().length() - 1).split(","); + for (String processCode : processCodes) { + // 遍历工序 + List 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 baseKnifeLockedList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper); + if (baseKnifeLockedList.size() == technologyBom.getKnifeCount()) baseKnifeResultList.addAll(baseKnifeLockedList); + } + } + } + + String batchNum = "SCZBPC01"; + // 出库任务,进行基础物料的出库 + HashMap>> 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); + } } diff --git a/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml b/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml index 7d83a82..bbce0ac 100644 --- a/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/BaseKnifeMapper.xml @@ -138,7 +138,7 @@ and STANDARD_QUANTITY = #{standardQuantity} - and AREA_CODE = #{areaCode} + and BK.AREA_CODE = #{areaCode} and KNIFE_LIFE = #{knifeLife} @@ -652,7 +652,7 @@ and MBB_BD_MRL_ID = #{mbbBdMrlId} - and AREA_CODE = #{areaCode} + and BK.AREA_CODE = #{areaCode} and IS_LOCKED = #{isLocked} diff --git a/ktg-mes/src/main/resources/mapper/md/BaseTechnologyBomMapper.xml b/ktg-mes/src/main/resources/mapper/md/BaseTechnologyBomMapper.xml index 8c86575..b3f436e 100644 --- a/ktg-mes/src/main/resources/mapper/md/BaseTechnologyBomMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/BaseTechnologyBomMapper.xml @@ -146,4 +146,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{processCode} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/wm/ProductionArrangementsMapper.xml b/ktg-mes/src/main/resources/mapper/wm/ProductionArrangementsMapper.xml new file mode 100644 index 0000000..4631337 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/ProductionArrangementsMapper.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + select PRODUCTION_ARRANGEMENTS_ID, PLAN_SHEET, PROCESS_CODE, STATUS, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME from PRODUCTION_ARRANGEMENTS + + + + + + + + + + insert into PRODUCTION_ARRANGEMENTS + + PLAN_SHEET, + PROCESS_CODE, + STATUS, + ATTR1, + ATTR2, + ATTR3, + ATTR4, + CREATE_BY, + CREATE_TIME, + UPDATE_BY, + UPDATE_TIME, + + + #{planSheet}, + #{processCode}, + #{status}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update PRODUCTION_ARRANGEMENTS + + PLAN_SHEET = #{planSheet}, + PROCESS_CODE = #{processCode}, + STATUS = #{status}, + ATTR1 = #{attr1}, + ATTR2 = #{attr2}, + ATTR3 = #{attr3}, + ATTR4 = #{attr4}, + CREATE_BY = #{createBy}, + CREATE_TIME = #{createTime}, + UPDATE_BY = #{updateBy}, + UPDATE_TIME = #{updateTime}, + + where PRODUCTION_ARRANGEMENTS_ID = #{productionArrangementsId} + + + + delete from PRODUCTION_ARRANGEMENTS where PRODUCTION_ARRANGEMENTS_ID = #{productionArrangementsId} + + + + delete from PRODUCTION_ARRANGEMENTS where PRODUCTION_ARRANGEMENTS_ID in + + #{productionArrangementsId} + + + \ No newline at end of file