Merge remote-tracking branch 'origin/master'

This commit is contained in:
liumingxiy 2024-11-15 16:32:18 +08:00
commit 90b81b421c
13 changed files with 528 additions and 105 deletions

View File

@ -19,9 +19,9 @@ import com.ktg.mes.wm.service.IWmsInTaskService;
import com.ktg.mes.wm.service.IWmsZdTaskService; import com.ktg.mes.wm.service.IWmsZdTaskService;
import com.ktg.system.domain.SysOperLog; import com.ktg.system.domain.SysOperLog;
import com.ktg.system.service.ISysOperLogService; import com.ktg.system.service.ISysOperLogService;
import org.codehaus.jackson.map.Serializers;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.ktg.common.annotation.Log; import com.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController; import com.ktg.common.core.controller.BaseController;
@ -305,6 +305,7 @@ public class BaseKnifeController extends BaseController {
@PostMapping("/open/productionArrangements/{planSheet}") @PostMapping("/open/productionArrangements/{planSheet}")
@ResponseBody @ResponseBody
@Transactional
public AjaxResult productionArrangements(@PathVariable String planSheet, @RequestBody List<String> processCodeList) { public AjaxResult productionArrangements(@PathVariable String planSheet, @RequestBody List<String> processCodeList) {
// 检查计划单是否已存在 // 检查计划单是否已存在
@ -554,11 +555,11 @@ public class BaseKnifeController extends BaseController {
// 生成组装任务 // 生成组装任务
WmsZdTask wmsZdTask = new WmsZdTask(); WmsZdTask wmsZdTask = new WmsZdTask();
wmsZdTask.setmProductId(mdItem.getItemId()); wmsZdTask.setmProductId(mdItem.getItemId());
wmsZdTask.setAttr4(planSheet); wmsZdTask.setPlanSheet(planSheet);
wmsZdTask.setCode(techBom.getProcessCode()); wmsZdTask.setCode(generateTaskCode(techBom.getProcessCode()));
wmsZdTask.setName(techBom.getProcessName()); wmsZdTask.setName(techBom.getProcessName());
wmsZdTask.setProductIdQty(count); wmsZdTask.setProductIdQty(count);
wmsZdTask.setAttr1(bomRouteList.get(0).getBomRouteId()); wmsZdTask.setBomId(bomRouteList.get(0).getBomRouteId());
wmsZdTask.setCreateTime(DateUtils.getNowDate()); wmsZdTask.setCreateTime(DateUtils.getNowDate());
zdTaskService.insertWmsZdTask(wmsZdTask); zdTaskService.insertWmsZdTask(wmsZdTask);
msg = "生产准备验证成功!缺少物料已生成组装任务!"; msg = "生产准备验证成功!缺少物料已生成组装任务!";
@ -647,6 +648,7 @@ public class BaseKnifeController extends BaseController {
baseKnife.setStandardQuantity("1"); baseKnife.setStandardQuantity("1");
baseKnife.setKnifeLife(100); baseKnife.setKnifeLife(100);
baseKnife.setKnifeFineState(1); baseKnife.setKnifeFineState(1);
baseKnife.setIsValid(1);
// 判断是否需要锁定整刀 // 判断是否需要锁定整刀
if (lockedFlag) { if (lockedFlag) {
baseKnife.setIsLocked(1); baseKnife.setIsLocked(1);
@ -699,7 +701,7 @@ public class BaseKnifeController extends BaseController {
wmsBaseKnife.setKnifeFineState(2); wmsBaseKnife.setKnifeFineState(2);
wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime()); wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime()); wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime());
wmsBaseKnife.setAttr1(baseKnife.getBaseKnifeId()); wmsBaseKnife.setParentId(baseKnife.getBaseKnifeId());
wmsBaseKnife.setPlanSheet(zdTask.getAttr4()); wmsBaseKnife.setPlanSheet(zdTask.getAttr4());
baseKnifeListOutPlan.add(wmsBaseKnife); baseKnifeListOutPlan.add(wmsBaseKnife);
baseKnifeService.updateBaseKnife(wmsBaseKnife); baseKnifeService.updateBaseKnife(wmsBaseKnife);
@ -828,8 +830,6 @@ public class BaseKnifeController extends BaseController {
wmsInTask.setPlanInStatus("1"); wmsInTask.setPlanInStatus("1");
wmsInTaskService.insertWmsInTask(wmsInTask); wmsInTaskService.insertWmsInTask(wmsInTask);
// 更新数量
mdItemService.updateMdItem(mdItem);
// 更新组装任务 // 更新组装任务
zdTask.setStatus("1"); zdTask.setStatus("1");
@ -846,14 +846,6 @@ public class BaseKnifeController extends BaseController {
public TableDataInfo list(BaseKnife baseKnife) { public TableDataInfo list(BaseKnife baseKnife) {
startPage(); startPage();
List<BaseKnife> list = baseKnifeService.selectBaseKnifeList(baseKnife); List<BaseKnife> list = baseKnifeService.selectBaseKnifeList(baseKnife);
list.forEach(item -> {
// 查询基础物料
if ("PRODUCT".equals(item.getItemOrProduct())) {
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setAttr1(item.getBaseKnifeId());
item.setBaseKnifeList(baseKnifeService.selectBaseKnifeList(baseKnifeWrapper));
}
});
return getDataTable(list); return getDataTable(list);
} }
@ -878,6 +870,15 @@ public class BaseKnifeController extends BaseController {
return AjaxResult.success(baseKnifeService.selectBaseKnifeByBaseKnifeId(baseKnifeId)); return AjaxResult.success(baseKnifeService.selectBaseKnifeByBaseKnifeId(baseKnifeId));
} }
/**
* 查询台账RFID是否重复
*/
@PreAuthorize("@ss.hasPermi('md:baseKnife:query')")
@GetMapping(value = "/isDuplicateRfid/{rfid}")
public AjaxResult isDuplicateRfid(@PathVariable("rfid") String rfid) {
return AjaxResult.success(baseKnifeService.isDuplicateRfid(rfid));
}
/** /**
* 新增工具台账 * 新增工具台账
*/ */

View File

@ -102,6 +102,8 @@ public class BaseKnife extends BaseEntity {
@Excel(name = "是否锁定") @Excel(name = "是否锁定")
private Integer isLocked; private Integer isLocked;
private Long zdTaskId;
/** /**
* 库区编码 * 库区编码
*/ */
@ -157,6 +159,12 @@ public class BaseKnife extends BaseEntity {
@Excel(name = "预留字段4") @Excel(name = "预留字段4")
private String attr4; private String attr4;
@Excel(name = "父物料id")
private Long parentId;
@Excel(name = "是否有效")
private Integer isValid;
/** /**
* 物料产品信息 * 物料产品信息
*/ */
@ -383,6 +391,30 @@ public class BaseKnife extends BaseEntity {
this.inInfoList = inInfoList; this.inInfoList = inInfoList;
} }
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public Long getZdTaskId() {
return zdTaskId;
}
public void setZdTaskId(Long zdTaskId) {
this.zdTaskId = zdTaskId;
}
@Override @Override
public String toString() { public String toString() {
return "BaseKnife{" + return "BaseKnife{" +

View File

@ -2,6 +2,7 @@ package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.BaseKnife; import com.ktg.mes.md.domain.BaseKnife;
import com.ktg.mes.md.domain.MdItem; import com.ktg.mes.md.domain.MdItem;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -104,4 +105,14 @@ public interface BaseKnifeMapper {
); );
long countBaseKnife(@Param("mbbBdMrlId") Long mbbBdMrlId); long countBaseKnife(@Param("mbbBdMrlId") Long mbbBdMrlId);
/**
* 查询台账RFID是否重复
*
* @param rfid 物料产品列表
* @return 结果
*/
public Boolean isDuplicateRfid(String rfid);
List<BaseKnife> selectBaseKnifeNotValidList(BaseKnife baseKnifeWrapper);
} }

View File

@ -60,4 +60,12 @@ public interface IBaseKnifeService
public int deleteBaseKnifeByBaseKnifeId(Long baseKnifeId); public int deleteBaseKnifeByBaseKnifeId(Long baseKnifeId);
public int resetBaseKnifeByBaseKnifeId(Long baseKnifeId); public int resetBaseKnifeByBaseKnifeId(Long baseKnifeId);
/**
* 查询台账RFID是否重复
*
* @param rfid rfid
* @return 结果
*/
public Boolean isDuplicateRfid(String rfid);
} }

View File

@ -119,6 +119,13 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService {
wmsInPlanDetailEntityQuery.setKnifeId(nowBaseKnife.getBaseKnifeId()); wmsInPlanDetailEntityQuery.setKnifeId(nowBaseKnife.getBaseKnifeId());
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntityQuery); List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntityQuery);
nowBaseKnife.setInInfoList(wmsInPlanDetailEntityList); nowBaseKnife.setInInfoList(wmsInPlanDetailEntityList);
// 查询基础物料
if ("PRODUCT".equals(nowBaseKnife.getItemOrProduct())) {
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setParentId(nowBaseKnife.getBaseKnifeId());
nowBaseKnife.setBaseKnifeList(baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper));
}
}); });
return baseKnifeList; return baseKnifeList;
@ -182,4 +189,13 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService {
return baseKnifeMapper.resetBaseKnife(baseKnifeId); return baseKnifeMapper.resetBaseKnife(baseKnifeId);
} }
/**
* 查询台账RFID是否重复
*
* @param rfid rfid
* @return 结果
*/
public Boolean isDuplicateRfid(String rfid){
return baseKnifeMapper.isDuplicateRfid(rfid);
}
} }

View File

@ -2,6 +2,8 @@ package com.ktg.mes.wm.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -100,6 +102,9 @@ public class WmsZdTaskController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody WmsZdTask wmsZdTask) public AjaxResult add(@RequestBody WmsZdTask wmsZdTask)
{ {
if (UserConstants.NOT_UNIQUE.equals(wmsZdTaskService.checkTaskCodeUnique(wmsZdTask))) {
return AjaxResult.error("新增物料" + wmsZdTask.getCode() + "失败,任务编码已存在");
}
return toAjax(wmsZdTaskService.insertWmsZdTask(wmsZdTask)); return toAjax(wmsZdTaskService.insertWmsZdTask(wmsZdTask));
} }

View File

@ -17,7 +17,7 @@ public class WmsZdTask extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 主键 */ /** 主键 */
private String wmsZdTaskId; private Long wmsZdTaskId;
/** 编码 */ /** 编码 */
@Excel(name = "编码") @Excel(name = "编码")
@ -50,6 +50,17 @@ public class WmsZdTask extends BaseEntity
@Excel(name = "已完成数量") @Excel(name = "已完成数量")
private Integer qtyOk; private Integer qtyOk;
private Long bomId;
private String itemName;
private String areaName;
private Long areaId;
private String processCode;
/** 预留字段1 */ /** 预留字段1 */
@Excel(name = "预留字段1") @Excel(name = "预留字段1")
private Long attr1; private Long attr1;
@ -72,12 +83,14 @@ public class WmsZdTask extends BaseEntity
@Excel(name = "完成状态") @Excel(name = "完成状态")
private String status; private String status;
public void setWmsZdTaskId(String wmsZdTaskId) private Long technologyBomId;
public void setWmsZdTaskId(Long wmsZdTaskId)
{ {
this.wmsZdTaskId = wmsZdTaskId; this.wmsZdTaskId = wmsZdTaskId;
} }
public String getWmsZdTaskId() public Long getWmsZdTaskId()
{ {
return wmsZdTaskId; return wmsZdTaskId;
} }
@ -207,6 +220,54 @@ public class WmsZdTask extends BaseEntity
this.planSheet = planSheet; this.planSheet = planSheet;
} }
public Long getTechnologyBomId() {
return technologyBomId;
}
public void setTechnologyBomId(Long technologyBomId) {
this.technologyBomId = technologyBomId;
}
public Long getBomId() {
return bomId;
}
public void setBomId(Long bomId) {
this.bomId = bomId;
}
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public String getAreaName() {
return areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public Long getAreaId() {
return areaId;
}
public void setAreaId(Long areaId) {
this.areaId = areaId;
}
public String getProcessCode() {
return processCode;
}
public void setProcessCode(String processCode) {
this.processCode = processCode;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List; import java.util.List;
import com.ktg.mes.wm.domain.WmsInTask; import com.ktg.mes.wm.domain.WmsInTask;
import com.ktg.mes.wm.domain.WmsZdTask;
/** /**
* 入库任务Mapper接口 * 入库任务Mapper接口

View File

@ -58,4 +58,6 @@ public interface WmsZdTaskMapper
* @return 结果 * @return 结果
*/ */
public int deleteWmsZdTaskByWmsZdTaskIds(String[] wmsZdTaskIds); public int deleteWmsZdTaskByWmsZdTaskIds(String[] wmsZdTaskIds);
WmsZdTask checkTaskCodeUnique(WmsZdTask wmsZdTask);
} }

View File

@ -64,4 +64,6 @@ public interface IWmsZdTaskService
AjaxResult createOutTaskByWmsZdTask(WmsZdTask wmsZdTask); AjaxResult createOutTaskByWmsZdTask(WmsZdTask wmsZdTask);
AjaxResult createInTaskByWmsZdTask(WmsZdTask wmsZdTask); AjaxResult createInTaskByWmsZdTask(WmsZdTask wmsZdTask);
String checkTaskCodeUnique(WmsZdTask wmsZdTask);
} }

View File

@ -3,8 +3,10 @@ package com.ktg.mes.wm.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.ktg.common.constant.UserConstants;
import com.ktg.common.core.domain.AjaxResult; import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.utils.DateUtils; import com.ktg.common.utils.DateUtils;
import com.ktg.common.utils.StringUtils;
import com.ktg.generator.util.MultiModuleCodeGenerator; import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.md.domain.*; import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.*; import com.ktg.mes.md.mapper.*;
@ -25,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ktg.mes.wm.mapper.WmsZdTaskMapper; import com.ktg.mes.wm.mapper.WmsZdTaskMapper;
import com.ktg.mes.wm.service.IWmsZdTaskService; import com.ktg.mes.wm.service.IWmsZdTaskService;
import org.springframework.transaction.annotation.Transactional;
import static com.ktg.common.utils.SecurityUtils.getUsername; import static com.ktg.common.utils.SecurityUtils.getUsername;
import static com.ktg.generator.util.MultiModuleCodeGenerator.generateTaskCode; import static com.ktg.generator.util.MultiModuleCodeGenerator.generateTaskCode;
@ -58,7 +61,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
private WmStorageAreaMapper wmStorageAreaMapper; private WmStorageAreaMapper wmStorageAreaMapper;
@Autowired @Autowired
private WmsInPlanMapper wmsInPlanMapper; private IWmsInPlanService wmsInPlanService;
@Autowired @Autowired
private WmsInTaskMapper wmsInTaskMapper; private WmsInTaskMapper wmsInTaskMapper;
@ -149,11 +152,12 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
} }
@Override @Override
@Transactional
public AjaxResult createOutTaskByWmsZdTask(WmsZdTask zdTask) { public AjaxResult createOutTaskByWmsZdTask(WmsZdTask zdTask) {
String batchNum = "ZZPC001"; String batchNum = "ZZPC001";
// 判断物料是否充足 // 判断物料是否充足
BomRoute bomRoute = bomRouteMapper.selectBomRouteByBomRouteId(zdTask.getAttr1()); BomRoute bomRoute = bomRouteMapper.selectBomRouteByBomRouteId(zdTask.getBomId());
BaseKnife baseKnifeWrapper = new BaseKnife(); BaseKnife baseKnifeWrapper = new BaseKnife();
List<BaseKnife> baseKnifeList = new ArrayList<>(); List<BaseKnife> baseKnifeList = new ArrayList<>();
@ -172,15 +176,27 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
List<WmsOutPlanDetail> wmsOutPlanDetailList = new ArrayList<>(); List<WmsOutPlanDetail> wmsOutPlanDetailList = new ArrayList<>();
List<BaseKnife> baseKnifeListOutPlan = new ArrayList<>(); List<BaseKnife> baseKnifeListOutPlan = new ArrayList<>();
// 查询工艺bom
BaseTechnologyBom technologyBom = new BaseTechnologyBom(); BaseTechnologyBom technologyBom = new BaseTechnologyBom();
Boolean lockedFlag = false;
// attr4 组装任务所属计划单 如果为空则是手动组装任务不需要锁定
if (zdTask.getPlanSheet() != null) {
lockedFlag = true;
BaseTechnologyBom technologyBomWrapper = new BaseTechnologyBom();
technologyBomWrapper.setProcessCode(zdTask.getProcessCode());
MdItem mdItemTemp = mdItemMapper.selectMdItemById(zdTask.getmProductId());
technologyBomWrapper.setKnifeCode(mdItemTemp.getItemCode());
technologyBom = baseTechnologyBomMapper.selectBaseTechnologyBomList(technologyBomWrapper).get(0);
}
// 出库基础物料 根据图号查询出库计划如果不存在生成计划存在则往计划中添加任务 // 出库基础物料 根据图号查询出库计划如果不存在生成计划存在则往计划中添加任务
WmsOutPlan outPlan = wmsOutPlanMapper.selectWmsOutPlanByPlanCode(zdTask.getAttr4()); WmsOutPlan outPlan = wmsOutPlanMapper.selectWmsOutPlanByPlanCode(zdTask.getPlanSheet());
if (outPlan == null){ if (outPlan == null) {
// 构建新的出库计划 // 构建新的出库计划
WmsOutPlan outPlanTemp = new WmsOutPlan(); WmsOutPlan outPlanTemp = new WmsOutPlan();
outPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4()); outPlanTemp.setPlanCode(zdTask.getPlanSheet() == null ? zdTask.getCode() : zdTask.getPlanSheet());
outPlanTemp.setWmsBusinessTypeId(12L); // 组刀出库
outPlanTemp.setWmsBusinessTypeId(16L);
outPlanTemp.setPlanState("1"); outPlanTemp.setPlanState("1");
outPlanTemp.setPlanType("ZDCK"); outPlanTemp.setPlanType("ZDCK");
outPlanTemp.setCreateBy(getUsername()); outPlanTemp.setCreateBy(getUsername());
@ -189,52 +205,98 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
outPlan = outPlanTemp; outPlan = outPlanTemp;
} }
// 出库任务 // 锁定物料
for (MbbProduBom mbbProduBom : bomRoute.getMbbProduBomList()) { Boolean outPlanFlag = true;
// 出库任务进行基础物料的出库 for (int i = 0; i < zdTask.getProductIdQty(); i++) {
MdItem mdItemOutPlan = mdItemMapper.selectMdItemById(mbbProduBom.getMdItemId()); // 构建整刀
WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail(); BaseKnife baseKnife = new BaseKnife();
outPlanDetail.setWmsOutPlanId(outPlan.getWmsOutPlanId()); MdItem mdItem = mdItemMapper.selectMdItemById(zdTask.getmProductId());
outPlanDetail.setMdItemId(mbbProduBom.getMdItemId()); baseKnife.setMbbBdMrlId(zdTask.getmProductId());
outPlanDetail.setMdItemCode(mdItemOutPlan.getItemCode()); baseKnife.setKnifeCode(mdItem.getItemCode());
outPlanDetail.setMdItemName(mdItemOutPlan.getItemName()); baseKnife.setKnifeName(mdItem.getItemName());
outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName()); baseKnife.setKnifeUnit(mdItem.getUnitName());
outPlanDetail.setPlannedQuantity(mbbProduBom.getStandardDosage() * zdTask.getProductIdQty()); baseKnife.setKnifeType(mdItem.getItemTypeName());
outPlanDetail.setRealQuantity(mbbProduBom.getStandardDosage() * zdTask.getProductIdQty()); WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(zdTask.getAreaId());
outPlanDetail.setDetailBatchNum(batchNum); baseKnife.setAreaCode(wmStorageArea.getAreaCode());
// 查询库位信息 baseKnife.setSafeStock(mdItem.getMinStock());
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(zdTask.getAttr3()); baseKnife.setStandardQuantity("1");
outPlanDetail.setWmStorageAreaId(wmStorageArea.getAreaId()); baseKnife.setKnifeLife(100);
outPlanDetail.setWmStorageAreaCode(wmStorageArea.getAreaCode()); baseKnife.setKnifeFineState(1);
outPlanDetail.setWmStorageAreaName(wmStorageArea.getAreaName()); baseKnife.setIsValid(1);
outPlanDetail.setDetailState("1"); // 判断是否需要锁定整刀
wmsOutPlanDetailList.add(outPlanDetail); if (lockedFlag) {
baseKnife.setIsLocked(1);
baseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
baseKnife.setLockedEndTime(technologyBom.getLockedEndTime());
} else {
baseKnife.setIsLocked(0);
}
// attr4 计划编码 整刀
baseKnife.setPlanSheet(zdTask.getPlanSheet());
baseKnife.setZdTaskId(zdTask.getWmsZdTaskId());
baseKnife.setItemOrProduct("PRODUCT");
baseKnife.setCreateBy(getUsername());
baseKnife.setCreateTime(DateUtils.getNowDate());
baseKnifeMapper.insertBaseKnife(baseKnife);
// 查询未锁定的物料 // 锁定物料
baseKnifeWrapper.setMbbBdMrlId(mbbProduBom.getMdItemId()); int resetCount = 0;
baseKnifeWrapper.setIsLocked(0); for (MbbProduBom mbbProduBom : bomRoute.getMbbProduBomList()) {
baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper); // 查询未锁定的物料
baseKnifeWrapper.setMbbBdMrlId(mbbProduBom.getMdItemId());
baseKnifeWrapper.setIsLocked(0);
baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
// 锁定基础 物料 if (outPlanFlag) {
int bomCount = mbbProduBom.getStandardDosage(); // 出库任务进行基础物料的出库
for (BaseKnife wmsBaseKnife : baseKnifeList){ MdItem mdItemOutPlan = mdItemMapper.selectMdItemById(mbbProduBom.getMdItemId());
if (bomCount > 0){ WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail();
wmsBaseKnife.setIsLocked(1); outPlanDetail.setWmsOutPlanId(outPlan.getWmsOutPlanId());
wmsBaseKnife.setKnifeFineState(2); outPlanDetail.setMdItemId(mbbProduBom.getMdItemId());
wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime()); outPlanDetail.setMdItemCode(mdItemOutPlan.getItemCode());
wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime()); outPlanDetail.setMdItemName(mdItemOutPlan.getItemName());
// wmsBaseKnife.setAttr1(baseKnife.getBaseKnifeId()); outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName());
wmsBaseKnife.setPlanSheet(zdTask.getAttr4()); outPlanDetail.setPlannedQuantity(mbbProduBom.getStandardDosage() * zdTask.getProductIdQty());
baseKnifeListOutPlan.add(wmsBaseKnife); outPlanDetail.setRealQuantity(mbbProduBom.getStandardDosage() * zdTask.getProductIdQty());
baseKnifeMapper.updateBaseKnife(wmsBaseKnife); outPlanDetail.setDetailBatchNum(batchNum);
bomCount--; // 查询库位信息
wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(zdTask.getAreaId());
outPlanDetail.setWmStorageAreaId(wmStorageArea.getAreaId());
outPlanDetail.setWmStorageAreaCode(wmStorageArea.getAreaCode());
outPlanDetail.setWmStorageAreaName(wmStorageArea.getAreaName());
outPlanDetail.setDetailState("1");
wmsOutPlanDetailList.add(outPlanDetail);
}
// 锁定基础 物料
int bomCount = mbbProduBom.getStandardDosage();
for (BaseKnife wmsBaseKnife : baseKnifeList) {
if (bomCount > 0) {
wmsBaseKnife.setZdTaskId(zdTask.getWmsZdTaskId());
wmsBaseKnife.setIsLocked(1);
wmsBaseKnife.setKnifeFineState(2);
wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime());
wmsBaseKnife.setParentId(baseKnife.getBaseKnifeId());
wmsBaseKnife.setPlanSheet(zdTask.getPlanSheet());
baseKnifeListOutPlan.add(wmsBaseKnife);
baseKnifeMapper.updateBaseKnife(wmsBaseKnife);
bomCount--;
// 记录刀片重置次数
resetCount += wmsBaseKnife.getResetCount();
}
} }
} }
// 更新重置次数
outPlanFlag = false;
baseKnife.setResetCount(resetCount - 1);
baseKnifeMapper.updateBaseKnife(baseKnife);
} }
// 出库 // 出库
int i = 0; int i = 0;
for (WmsOutPlanDetail outPlanDetail : wmsOutPlanDetailList){ for (WmsOutPlanDetail outPlanDetail : wmsOutPlanDetailList) {
wmsOutPlanMapper.insertWmsOutPlanDetail(outPlanDetail); wmsOutPlanMapper.insertWmsOutPlanDetail(outPlanDetail);
// 出库计划明细绑定实体 // 出库计划明细绑定实体
@ -280,56 +342,166 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
wmsOutTaskMapper.insertWmsOutTask(wmsOutTask); wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
} }
// 更新组装任务 // 更新组装任务
zdTask.setStatus("1"); zdTask.setStatus("1");
zdTask.setQtyOk(zdTask.getProductIdQty()); // zdTask.setQtyOk(zdTask.getProductIdQty());
wmsZdTaskMapper.updateWmsZdTask(zdTask); wmsZdTaskMapper.updateWmsZdTask(zdTask);
return AjaxResult.success(); 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();
} }
@Override @Override
@Transactional
public AjaxResult createInTaskByWmsZdTask(WmsZdTask zdTask) { public AjaxResult createInTaskByWmsZdTask(WmsZdTask zdTask) {
String batchNum = "ZZPC001"; String batchNum = "ZZPC001";
BaseTechnologyBom technologyBom = new BaseTechnologyBom();
for (int i = 0; i < zdTask.getProductIdQty(); i++) {
// 构建整刀
BaseKnife baseKnife = new BaseKnife();
MdItem mdItem = mdItemMapper.selectMdItemById(zdTask.getmProductId());
baseKnife.setMbbBdMrlId(zdTask.getmProductId());
baseKnife.setKnifeCode(mdItem.getItemCode());
baseKnife.setKnifeName(mdItem.getItemName());
baseKnife.setKnifeUnit(mdItem.getUnitName());
baseKnife.setKnifeType(mdItem.getItemTypeName());
// attr3 库位编码
baseKnife.setAreaCode(zdTask.getAttr3());
baseKnife.setSafeStock(mdItem.getMinStock());
baseKnife.setStandardQuantity("1");
baseKnife.setKnifeLife(100);
baseKnife.setKnifeFineState(1);
// 判断是否需要锁定整刀
baseKnife.setIsLocked(1);
baseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
baseKnife.setLockedEndTime(technologyBom.getLockedEndTime());
// attr4 计划编码 整刀
baseKnife.setPlanSheet(zdTask.getAttr4());
baseKnife.setItemOrProduct("PRODUCT");
baseKnife.setCreateBy(getUsername());
baseKnife.setCreateTime(DateUtils.getNowDate());
baseKnifeMapper.insertBaseKnife(baseKnife);
}
// 整刀入库计划, 根据图号查询入库计划如果不存在生成计划存在则往计划中添加任务 // 整刀入库计划, 根据图号查询入库计划如果不存在生成计划存在则往计划中添加任务
WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanCode(zdTask.getAttr4()); WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(zdTask.getAreaId());
if (wmsInPlan == null){ WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(zdTask.getPlanSheet());
if (wmsInPlan == null) {
WmsInPlan wmsInPlanTemp = new WmsInPlan(); WmsInPlan wmsInPlanTemp = new WmsInPlan();
wmsInPlanTemp.setState("1"); wmsInPlanTemp.setState("1");
wmsInPlanTemp.setSourceType("SGLR"); wmsInPlanTemp.setSourceType("SGLR");
wmsInPlanTemp.setCellCode(zdTask.getAttr3()); wmsInPlanTemp.setCellCode(wmStorageArea.getAreaCode());
wmsInPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4()); wmsInPlanTemp.setPlanCode(zdTask.getPlanSheet() == null ? zdTask.getCode() : zdTask.getPlanSheet());
wmsInPlanTemp.setRelBillCode("组装单据"); wmsInPlanTemp.setRelBillCode("组装单据");
wmsInPlanTemp.setPlanTypeId("13"); wmsInPlanTemp.setPlanTypeId("13");
wmsInPlanTemp.setCreateBy(getUsername()); wmsInPlanTemp.setCreateBy(getUsername());
@ -340,13 +512,13 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails(); WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails();
wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString()); wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString());
wmsInPlanDetails.setBatch(batchNum); wmsInPlanDetails.setBatch(batchNum);
wmsInPlanDetails.setCellId(1L); wmsInPlanDetails.setCellId(wmStorageArea.getAreaId());
wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString());
wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString());
wmsInPlanDetails.setPlanInStatus("0"); wmsInPlanDetails.setPlanInStatus("0");
wmsInPlanDetailsList.add(wmsInPlanDetails); wmsInPlanDetailsList.add(wmsInPlanDetails);
wmsInPlanTemp.setWmsInPlanDetailsList(wmsInPlanDetailsList); wmsInPlanTemp.setWmsInPlanDetailsList(wmsInPlanDetailsList);
wmsInPlanMapper.insertWmsInPlan(wmsInPlanTemp); wmsInPlanService.insertWmsInPlan(wmsInPlanTemp);
wmsInPlan = wmsInPlanTemp; wmsInPlan = wmsInPlanTemp;
} else { } else {
// 入库任务明细 // 入库任务明细
@ -354,36 +526,61 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails(); WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails();
wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString()); wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString());
wmsInPlanDetails.setBatch(batchNum); wmsInPlanDetails.setBatch(batchNum);
wmsInPlanDetails.setCellId(1L); wmsInPlanDetails.setCellId(wmStorageArea.getAreaId());
wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString());
wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString());
wmsInPlanDetails.setPlanInStatus("0"); wmsInPlanDetails.setPlanInStatus("0");
wmsInPlanDetailsList.add(wmsInPlanDetails); wmsInPlanDetailsList.add(wmsInPlanDetails);
wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailsList); wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailsList);
wmsInPlanMapper.updateWmsInPlan(wmsInPlan); wmsInPlanService.updateWmsInPlan(wmsInPlan);
} }
// 入库任务 // 入库任务
MdItem mdItem = mdItemMapper.selectMdItemById(zdTask.getmProductId()); MdItem mdItem = mdItemMapper.selectMdItemById(zdTask.getmProductId());
WmsInTask wmsInTask = new WmsInTask(); WmsInTask wmsInTask = new WmsInTask();
wmsInTask.setTaskInCode(MultiModuleCodeGenerator.generateTaskCode("RKT")); // 生成任务号
String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT");
wmsInTask.setTaskInCode(taskInCode);
wmsInTask.setPlanInId(wmsInPlan.getPlanId().toString()); wmsInTask.setPlanInId(wmsInPlan.getPlanId().toString());
wmsInTask.setPlanInCode(wmsInPlan.getPlanCode()); wmsInTask.setPlanInCode(wmsInPlan.getPlanCode());
wmsInTask.setMaterialCode(mdItem.getItemCode()); wmsInTask.setMaterialCode(mdItem.getItemCode());
wmsInTask.setTaskInQuantity(zdTask.getProductIdQty()); wmsInTask.setTaskInQuantity(zdTask.getProductIdQty());
wmsInTask.setActualInQuantity(zdTask.getProductIdQty()); wmsInTask.setActualInQuantity(zdTask.getProductIdQty());
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaCode(zdTask.getAttr3());
wmsInTask.setCellTgt(wmStorageArea.getAreaId()); wmsInTask.setCellTgt(wmStorageArea.getAreaId());
wmsInTask.setBatch(batchNum); wmsInTask.setBatch(batchNum);
wmsInTask.setMaterialId(zdTask.getmProductId().toString()); wmsInTask.setMaterialId(zdTask.getmProductId().toString());
wmsInTask.setPlanTypeId("9"); wmsInTask.setPlanTypeId("9");
wmsInTask.setPlanInStatus("1"); wmsInTask.setPlanInStatus("1");
wmsInTask.setCreateBy(getUsername());
wmsInTask.setCreateTime(DateUtils.getNowDate());
wmsInTaskMapper.insertWmsInTask(wmsInTask); wmsInTaskMapper.insertWmsInTask(wmsInTask);
// 刀台账设为有效
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setZdTaskId(zdTask.getWmsZdTaskId());
baseKnifeWrapper.setMbbBdMrlId(zdTask.getmProductId());
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeNotValidList(baseKnifeWrapper);
baseKnifeList.forEach(baseKnife -> {
baseKnife.setIsValid(0);
baseKnife.setCreateTime(DateUtils.getNowDate());
baseKnifeMapper.updateBaseKnife(baseKnife);
});
// 更新组装任务 // 更新组装任务
zdTask.setStatus("2"); zdTask.setStatus("2");
zdTask.setQtyOk(zdTask.getProductIdQty()); zdTask.setQtyOk(zdTask.getProductIdQty());
wmsZdTaskMapper.updateWmsZdTask(zdTask); wmsZdTaskMapper.updateWmsZdTask(zdTask);
return AjaxResult.success(); return AjaxResult.success();
} }
@Override
public String checkTaskCodeUnique(WmsZdTask wmsZdTask) {
WmsZdTask zdTask = wmsZdTaskMapper.checkTaskCodeUnique(wmsZdTask);
Long zdTaskId = wmsZdTask.getWmsZdTaskId() == null ? -1L : wmsZdTask.getWmsZdTaskId();
if (StringUtils.isNotNull(zdTask) && zdTask.getWmsZdTaskId().longValue() != zdTaskId.longValue()) {
return UserConstants.NOT_UNIQUE;
} else {
return UserConstants.UNIQUE;
}
}
} }

View File

@ -22,6 +22,9 @@
<result property="planSheet" column="PLAN_SHEET"/> <result property="planSheet" column="PLAN_SHEET"/>
<result property="resetCount" column="RESET_COUNT"/> <result property="resetCount" column="RESET_COUNT"/>
<result property="itemOrProduct" column="ITEM_OR_PRODUCT"/> <result property="itemOrProduct" column="ITEM_OR_PRODUCT"/>
<result property="parentId" column="PARENT_ID"/>
<result property="isValid" column="IS_VALID"/>
<result property="zdTaskId" column="ZD_TASK_ID"/>
<result property="remark" column="REMARK"/> <result property="remark" column="REMARK"/>
<result property="attr1" column="ATTR1"/> <result property="attr1" column="ATTR1"/>
<result property="attr2" column="ATTR2"/> <result property="attr2" column="ATTR2"/>
@ -70,7 +73,7 @@
<sql id="selectBaseKnifeVo"> <sql id="selectBaseKnifeVo">
SELECT BK.BASE_KNIFE_ID, SELECT BK.BASE_KNIFE_ID,
BK.MBB_BD_MRL_ID, BK.MBB_BD_MRL_ID,
RFID, BK.RFID,
MI.ITEM_CODE AS KNIFE_CODE, MI.ITEM_CODE AS KNIFE_CODE,
MI.ITEM_NAME AS KNIFE_NAME, MI.ITEM_NAME AS KNIFE_NAME,
MI.UNIT_NAME AS KNIFE_UNIT, MI.UNIT_NAME AS KNIFE_UNIT,
@ -86,6 +89,9 @@
BK.RESET_COUNT, BK.RESET_COUNT,
BK.ITEM_OR_PRODUCT, BK.ITEM_OR_PRODUCT,
BK.PLAN_SHEET, BK.PLAN_SHEET,
BK.PARENT_ID,
BK.IS_VALID,
BK.ZD_TASK_ID,
BK.REMARK, BK.REMARK,
BK.ATTR1, BK.ATTR1,
BK.ATTR2, BK.ATTR2,
@ -103,6 +109,7 @@
<select id="selectBaseKnifeList" parameterType="BaseKnife" resultMap="BaseKnifeResult"> <select id="selectBaseKnifeList" parameterType="BaseKnife" resultMap="BaseKnifeResult">
<include refid="selectBaseKnifeVo"/> <include refid="selectBaseKnifeVo"/>
<where> <where>
IS_VALID = 0
<if test="mbbBdMrlId != null and mbbBdMrlId != ''"> <if test="mbbBdMrlId != null and mbbBdMrlId != ''">
and MBB_BD_MRL_ID = #{mbbBdMrlId} and MBB_BD_MRL_ID = #{mbbBdMrlId}
</if> </if>
@ -145,6 +152,12 @@
<if test="planSheet != null and planSheet != ''"> <if test="planSheet != null and planSheet != ''">
and BK.plan_sheet = #{planSheet} and BK.plan_sheet = #{planSheet}
</if> </if>
<if test="parentId != null and parentId != ''">
and BK.parent_id = #{parentId}
</if>
<if test="zdTaskId != null and zdTaskId != ''">
and BK.zd_task_id = #{zdTaskId}
</if>
<if test="remark != null and remark != ''"> <if test="remark != null and remark != ''">
and BK.REMARK = #{remark} and BK.REMARK = #{remark}
</if> </if>
@ -176,6 +189,19 @@
order by create_time desc order by create_time desc
</select> </select>
<select id="selectBaseKnifeNotValidList" parameterType="BaseKnife" resultMap="BaseKnifeResult">
<include refid="selectBaseKnifeVo"/>
<where>
IS_VALID = 1
<if test="mbbBdMrlId != null and mbbBdMrlId != ''">
and MBB_BD_MRL_ID = #{mbbBdMrlId}
</if>
<if test="zdTaskId != null and zdTaskId != ''">
and BK.zd_task_id = #{zdTaskId}
</if>
</where>
</select>
<select id="selectBaseKnifeByBaseKnifeId" parameterType="Long" resultMap="BaseKnifeMdItemResult"> <select id="selectBaseKnifeByBaseKnifeId" parameterType="Long" resultMap="BaseKnifeMdItemResult">
select a.BASE_KNIFE_ID select a.BASE_KNIFE_ID
, a.MBB_BD_MRL_ID , a.MBB_BD_MRL_ID
@ -192,6 +218,9 @@
, a.RESET_COUNT , a.RESET_COUNT
, a.ITEM_OR_PRODUCT , a.ITEM_OR_PRODUCT
, a.PLAN_SHEET , a.PLAN_SHEET
, a.PARENT_ID
, a.IS_VALID
, a.ZD_TASK_ID
, a.REMARK , a.REMARK
, a.ATTR1 , a.ATTR1
, a.ATTR2 , a.ATTR2
@ -348,6 +377,15 @@
<if test="itemOrProduct != null"> <if test="itemOrProduct != null">
item_or_product, item_or_product,
</if> </if>
<if test="parentId != null">
parent_id,
</if>
<if test="isValid != null">
is_valid,
</if>
<if test="zdTaskId != null">
zd_task_id,
</if>
<if test="remark != null"> <if test="remark != null">
REMARK, REMARK,
</if> </if>
@ -428,6 +466,15 @@
<if test="itemOrProduct != null"> <if test="itemOrProduct != null">
#{itemOrProduct}, #{itemOrProduct},
</if> </if>
<if test="parentId != null">
#{parentId},
</if>
<if test="isValid != null">
#{isValid},
</if>
<if test="zdTaskId != null">
#{zdTaskId},
</if>
<if test="remark != null"> <if test="remark != null">
#{remark}, #{remark},
</if> </if>
@ -512,6 +559,15 @@
<if test="itemOrProduct != null"> <if test="itemOrProduct != null">
item_or_product = #{itemOrProduct}, item_or_product = #{itemOrProduct},
</if> </if>
<if test="parentId != null">
parent_id = #{parentId},
</if>
<if test="isValid != null">
is_valid = #{isValid},
</if>
<if test="zdTaskId != null">
zd_task_id = #{zdTaskId},
</if>
<if test="remark != null"> <if test="remark != null">
REMARK = #{remark}, REMARK = #{remark},
</if> </if>
@ -642,4 +698,10 @@
and (KNIFE_FINE_STATE = 0 OR KNIFE_FINE_STATE = 1) and (KNIFE_FINE_STATE = 0 OR KNIFE_FINE_STATE = 1)
</where> </where>
</select> </select>
<select id="isDuplicateRfid" parameterType="String" resultType="boolean">
SELECT COUNT(1)
FROM BASE_KNIFE
WHERE RFID = #{value}
</select>
</mapper> </mapper>

View File

@ -21,6 +21,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="attr4" column="ATTR4" /> <result property="attr4" column="ATTR4" />
<result property="figureCode" column="figure_code" /> <result property="figureCode" column="figure_code" />
<result property="planSheet" column="plan_sheet" /> <result property="planSheet" column="plan_sheet" />
<result property="technologyBomId" column="technology_bom_id" />
<result property="bomId" column="bom_id" />
<result property="itemName" column="item_name" />
<result property="areaId" column="area_id" />
<result property="areaName" column="area_name" />
<result property="processCode" column="process_code" />
<result property="createBy" column="CREATE_BY" /> <result property="createBy" column="CREATE_BY" />
<result property="createTime" column="CREATE_TIME" /> <result property="createTime" column="CREATE_TIME" />
<result property="updateBy" column="UPDATE_BY" /> <result property="updateBy" column="UPDATE_BY" />
@ -31,9 +37,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectWmsZdTaskVo"> <sql id="selectWmsZdTaskVo">
select wzt.WMS_ZD_TASK_ID, wzt.CODE, wzt."name", wzt.M_PRODUCT_ID, wzt."product_id_qty", wzt.QTY, wzt.PLAN_OUT_ID, select wzt.WMS_ZD_TASK_ID, wzt.CODE, wzt."name", wzt.M_PRODUCT_ID, wzt."product_id_qty", wzt.QTY, wzt.PLAN_OUT_ID,
wzt.PLAN_OUT_TYPE, wzt.QTY_OK, wzt.REMARK, wzt.ATTR1, wzt.ATTR3, wzt.ATTR4, wzt.CREATE_BY, wzt.CREATE_TIME, wzt.PLAN_OUT_TYPE, wzt.QTY_OK, wzt.REMARK, wzt.ATTR1, wzt.ATTR3, wzt.ATTR4, wzt.CREATE_BY, wzt.CREATE_TIME,
wzt.UPDATE_BY, wzt.UPDATE_TIME, wzt.STATUS, mi.item_name attr2 wzt.UPDATE_BY, wzt.UPDATE_TIME, wzt.STATUS, mi.item_name item_name, wzt.technology_bom_id,
wzt.bom_id, wzt.area_id, wzt.plan_sheet, wzt.process_code, wsa.area_name as area_name
from WMS_ZD_TASK wzt from WMS_ZD_TASK wzt
left join md_item mi on wzt.m_product_id = mi.item_id left join md_item mi on wzt.m_product_id = mi.item_id
left join wm_storage_area wsa on wzt.area_id = wsa.area_id
</sql> </sql>
<select id="selectWmsZdTaskList" parameterType="WmsZdTask" resultMap="WmsZdTaskResult"> <select id="selectWmsZdTaskList" parameterType="WmsZdTask" resultMap="WmsZdTaskResult">
@ -45,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productIdQty != null and productIdQty != ''"> and "product_id_qty" = #{productIdQty}</if> <if test="productIdQty != null and productIdQty != ''"> and "product_id_qty" = #{productIdQty}</if>
<if test="planOutId != null and planOutId != ''"> and PLAN_OUT_ID = #{planOutId}</if> <if test="planOutId != null and planOutId != ''"> and PLAN_OUT_ID = #{planOutId}</if>
<if test="planOutType != null and planOutType != ''"> and PLAN_OUT_TYPE = #{planOutType}</if> <if test="planOutType != null and planOutType != ''"> and PLAN_OUT_TYPE = #{planOutType}</if>
<if test="technologyBomId != null and technologyBomId != ''"> and technology_bom_id = #{technologyBomId}</if>
<if test="qtyOk != null and qtyOk != ''"> and QTY_OK = #{qtyOk}</if> <if test="qtyOk != null and qtyOk != ''"> and QTY_OK = #{qtyOk}</if>
<if test="remark != null and remark != ''"> and REMARK = #{remark}</if> <if test="remark != null and remark != ''"> and REMARK = #{remark}</if>
<if test="attr1 != null and attr1 != ''"> and ATTR1 = #{attr1}</if> <if test="attr1 != null and attr1 != ''"> and ATTR1 = #{attr1}</if>
@ -81,6 +90,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="attr2 != null">ATTR2,</if> <if test="attr2 != null">ATTR2,</if>
<if test="attr3 != null">ATTR3,</if> <if test="attr3 != null">ATTR3,</if>
<if test="attr4 != null">ATTR4,</if> <if test="attr4 != null">ATTR4,</if>
<if test="technologyBomId != null">technology_bom_id,</if>
<if test="bomId != null">bom_id,</if>
<if test="areaId != null">area_id,</if>
<if test="processCode != null">process_code,</if>
<if test="planSheet != null">plan_sheet,</if>
<if test="createBy != null">CREATE_BY,</if> <if test="createBy != null">CREATE_BY,</if>
<if test="createTime != null">CREATE_TIME,</if> <if test="createTime != null">CREATE_TIME,</if>
<if test="updateBy != null">UPDATE_BY,</if> <if test="updateBy != null">UPDATE_BY,</if>
@ -101,6 +115,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="attr2 != null">#{attr2},</if> <if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if> <if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if> <if test="attr4 != null">#{attr4},</if>
<if test="technologyBomId != null">#{technologyBomId},</if>
<if test="bomId != null">#{bomId},</if>
<if test="areaId != null">#{areaId},</if>
<if test="processCode != null">#{processCode},</if>
<if test="planSheet != null">#{planSheet},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
@ -119,6 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="qty != null">QTY = #{qty},</if> <if test="qty != null">QTY = #{qty},</if>
<if test="planOutId != null">PLAN_OUT_ID = #{planOutId},</if> <if test="planOutId != null">PLAN_OUT_ID = #{planOutId},</if>
<if test="planOutType != null">PLAN_OUT_TYPE = #{planOutType},</if> <if test="planOutType != null">PLAN_OUT_TYPE = #{planOutType},</if>
<if test="areaId != null">area_id = #{areaId},</if>
<if test="qtyOk != null">QTY_OK = #{qtyOk},</if> <if test="qtyOk != null">QTY_OK = #{qtyOk},</if>
<if test="remark != null">REMARK = #{remark},</if> <if test="remark != null">REMARK = #{remark},</if>
<if test="attr1 != null">ATTR1 = #{attr1},</if> <if test="attr1 != null">ATTR1 = #{attr1},</if>
@ -143,4 +163,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{wmsZdTaskId} #{wmsZdTaskId}
</foreach> </foreach>
</delete> </delete>
<select id="checkTaskCodeUnique" parameterType="WmsZdTask" resultMap="WmsZdTaskResult">
<include refid="selectWmsZdTaskVo"/>
where code = #{code} limit 1
</select>
</mapper> </mapper>