Merge remote-tracking branch 'origin/master'

This commit is contained in:
liumingxiy 2024-11-11 17:34:54 +08:00
commit ed19d0cfd7
7 changed files with 54 additions and 27 deletions

View File

@ -127,13 +127,11 @@ public class BaseKnifeController extends BaseController
@PostMapping("/open/checkForAlignment")
@ResponseBody
public AjaxResult checkForAlignment(@RequestBody String json) {
// 检查请求json是否正确
List<BaseTechnologyBom> technologyBomList = JSON.parseArray(json, BaseTechnologyBom.class);
public AjaxResult checkForAlignment(@RequestBody List<String> processCodeList) {
// 获取工艺bom
List<BaseTechnologyBom> technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomListByProcessCodeList(processCodeList);
if (technologyBomList.isEmpty() || technologyBomList.size() == 1 && technologyBomList.get(0).getKnifeCode() == null)
return AjaxResult.error("未检测到工艺bom项");
// 记录请求数据
technologyBomList.forEach(baseTechnologyBom -> baseTechnologyBomService.insertBaseTechnologyBom(baseTechnologyBom));
// 构建日志
SysOperLog operLog = new SysOperLog();
@ -145,7 +143,7 @@ public class BaseKnifeController extends BaseController
operLog.setOperLocation("上游系统");
operLog.setOperUrl("/mes/md/baseKnife/open/checkForAlignment");
operLog.setMethod("com.ktg.mes.md.controller.BaseKnifeController.checkForAlignment()");
operLog.setOperParam(json);
operLog.setOperParam(JSON.toJSONString(processCodeList));
operLog.setStatus(1);
operLog.setOperTime(new Date());
@ -304,18 +302,28 @@ public class BaseKnifeController extends BaseController
}
@PostMapping("/open/productionArrangements")
@PostMapping("/open/productionArrangements/{planCode}")
@ResponseBody
public AjaxResult productionArrangements(@RequestBody String json) {
// 验证请求数据
List<BaseTechnologyBom> technologyBomList = JSON.parseArray(json, BaseTechnologyBom.class);
public AjaxResult productionArrangements(@PathVariable String planCode, @RequestBody List<String> processCodeList) {
// 检查计划单是否已存在
BaseKnife baseKnifePlan = new BaseKnife();
baseKnifePlan.setPlanSheet(planCode);
if (!baseKnifeService.selectBaseKnifeList(baseKnifePlan).isEmpty())
return AjaxResult.error("该计划单已存在,请更换重试");
// 验证bom工艺
List<BaseTechnologyBom> technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomListByProcessCodeList(processCodeList);
if (technologyBomList.isEmpty() || technologyBomList.size() == 1 && technologyBomList.get(0).getKnifeCode() == null)
return AjaxResult.error("未检测到工艺bom项");
technologyBomList.forEach(baseTechnologyBom -> baseTechnologyBomService.insertBaseTechnologyBom(baseTechnologyBom));
// 记录数据修改
List<BaseKnife> baseKnifeOriginList = new ArrayList<>();
// 参数列表
Map<String, Object> params = new HashMap<>();
params.put("planCode", planCode);
params.put("processCodeList", processCodeList);
// 构建日志
SysOperLog operLog = new SysOperLog();
operLog.setTitle("生产准备");
@ -326,7 +334,7 @@ public class BaseKnifeController extends BaseController
operLog.setOperLocation("上游系统");
operLog.setOperUrl("/mes/md/baseKnife/open/productionArrangements");
operLog.setMethod("com.ktg.mes.md.controller.BaseKnifeController.productionArrangements()");
operLog.setOperParam(json);
operLog.setOperParam(JSON.toJSONString(params));
operLog.setStatus(1);
operLog.setOperTime(new Date());
// 接口返回信息
@ -429,7 +437,7 @@ public class BaseKnifeController extends BaseController
countMap.put(item.getKnifeCode(), countMap.get(item.getKnifeCode()) + 1);
// 记录源数据然后锁定
baseKnifeOriginList.add(item);
item.setPlanSheet(techBom.getTechnologyBomId());
item.setPlanSheet(planCode);
item.setIsLocked(1);
item.setLockedStartTime(techBom.getLockedStartTime());
item.setLockedEndTime(techBom.getLockedEndTime());
@ -535,9 +543,10 @@ public class BaseKnifeController extends BaseController
return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode());
}
// 生成组装任务
WmsZdTask wmsZdTask = new WmsZdTask();
wmsZdTask.setmProductId(mdItem.getItemId());
wmsZdTask.setAttr4(techBom.getTechnologyBomId());
wmsZdTask.setAttr4(planCode);
wmsZdTask.setCode(techBom.getProcessCode());
wmsZdTask.setName(techBom.getProcessName());
wmsZdTask.setProductIdQty(count);
@ -594,16 +603,13 @@ public class BaseKnifeController extends BaseController
// attr4 组装任务所属计划单 如果为空则是手动组装任务不需要锁定
if (zdTask.getAttr4() != null){
lockedFlag = true;
technologyBom = baseTechnologyBomService.selectBaseTechnologyBomByTechnologyBomId(zdTask.getAttr4());
} else {
technologyBom.setFigureCode(zdTask.getCode());
}
// 出库基础物料 根据图号查询出库计划如果不存在生成计划存在则往计划中添加任务
WmsOutPlan outPlan = wmsOutPlanMapper.selectWmsOutPlanByPlanCode(technologyBom.getFigureCode());
WmsOutPlan outPlan = wmsOutPlanMapper.selectWmsOutPlanByPlanCode(zdTask.getAttr4());
if (outPlan == null){
WmsOutPlan outPlanTemp = new WmsOutPlan();
outPlanTemp.setPlanCode(technologyBom.getFigureCode());
outPlanTemp.setPlanCode(zdTask.getAttr4());
outPlanTemp.setWmsBusinessTypeId(12L);
outPlanTemp.setPlanState("1");
outPlanTemp.setPlanType("ZDCK");
@ -679,6 +685,7 @@ public class BaseKnifeController extends BaseController
wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime());
wmsBaseKnife.setAttr1(baseKnife.getBaseKnifeId());
wmsBaseKnife.setPlanSheet(zdTask.getAttr4());
baseKnifeListOutPlan.add(wmsBaseKnife);
baseKnifeService.updateBaseKnife(wmsBaseKnife);
bomCount--;
@ -748,13 +755,13 @@ public class BaseKnifeController extends BaseController
}
// 整刀入库计划, 根据图号查询入库计划如果不存在生成计划存在则往计划中添加任务
WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(technologyBom.getFigureCode());
WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(zdTask.getAttr4());
if (wmsInPlan == null){
WmsInPlan wmsInPlanTemp = new WmsInPlan();
wmsInPlanTemp.setState("1");
wmsInPlanTemp.setSourceType("SGLR");
wmsInPlanTemp.setCellCode(zdTask.getAttr3());
wmsInPlanTemp.setPlanCode(technologyBom.getFigureCode());
wmsInPlanTemp.setPlanCode(zdTask.getAttr4());
wmsInPlanTemp.setRelBillCode("组装单据");
wmsInPlanTemp.setPlanTypeId("13");
wmsInPlanTemp.setCreateBy(getUsername());
@ -792,7 +799,7 @@ public class BaseKnifeController extends BaseController
MdItem mdItem = mdItemService.selectMdItemById(zdTask.getmProductId());
WmsInTask wmsInTask = new WmsInTask();
wmsInTask.setPlanInId(wmsInPlan.getPlanId().toString());
wmsInTask.setPlanInCode(generateTaskCode(wmsInPlan.getPlanCode()));
wmsInTask.setPlanInCode(wmsInPlan.getPlanCode());
wmsInTask.setMaterialCode(mdItem.getItemCode());
wmsInTask.setTaskInQuantity(zdTask.getProductIdQty());
wmsInTask.setActualInQuantity(zdTask.getProductIdQty());

View File

@ -58,4 +58,6 @@ public interface BaseTechnologyBomMapper
* @return 结果
*/
public int deleteBaseTechnologyBomByTechnologyBomIds(String[] technologyBomIds);
List<BaseTechnologyBom> selectBaseTechnologyBomListByProcessCodeList(List<String> processCodeList);
}

View File

@ -58,4 +58,6 @@ public interface IBaseTechnologyBomService
* @return 结果
*/
public int deleteBaseTechnologyBomByTechnologyBomId(String technologyBomId);
List<BaseTechnologyBom> selectBaseTechnologyBomListByProcessCodeList(List<String> processCodeList);
}

View File

@ -1,5 +1,6 @@
package com.ktg.mes.md.service.impl;
import java.util.Collections;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -93,4 +94,9 @@ public class BaseTechnologyBomServiceImpl implements IBaseTechnologyBomService
{
return baseTechnologyBomMapper.deleteBaseTechnologyBomByTechnologyBomId(technologyBomId);
}
@Override
public List<BaseTechnologyBom> selectBaseTechnologyBomListByProcessCodeList(List<String> processCodeList) {
return baseTechnologyBomMapper.selectBaseTechnologyBomListByProcessCodeList(processCodeList);
}
}

View File

@ -93,12 +93,10 @@
BK.CREATE_BY,
BK.CREATE_TIME,
BK.UPDATE_BY,
BK.UPDATE_TIME,
BTB.FIGURE_CODE PLAN_SHEET
BK.UPDATE_TIME
from BASE_KNIFE BK
LEFT JOIN MD_ITEM MI on BK.MBB_BD_MRL_ID = MI.ITEM_ID
LEFT JOIN MD_ITEM_TYPE MIT ON MI.ITEM_TYPE_ID = MIT.ITEM_TYPE_ID
LEFT JOIN BASE_TECHNOLOGY_BOM BTB ON BTB.TECHNOLOGY_BOM_ID = BK.PLAN_SHEET
</sql>
<select id="selectBaseKnifeList" parameterType="BaseKnife" resultMap="BaseKnifeResult">
@ -143,6 +141,9 @@
<if test="itemOrProduct != null and itemOrProduct != ''">
and BK.ITEM_OR_PRODUCT = #{itemOrProduct}
</if>
<if test="planSheet != null and planSheet != ''">
and BK.plan_sheet = #{planSheet}
</if>
<if test="remark != null and remark != ''">
and BK.REMARK = #{remark}
</if>
@ -171,6 +172,7 @@
and BK.UPDATE_TIME = #{updateTime}
</if>
</where>
order by create_time desc
</select>
<select id="selectBaseKnifeByBaseKnifeId" parameterType="String" resultMap="BaseKnifeMdItemResult">

View File

@ -138,4 +138,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{technologyBomId}
</foreach>
</delete>
<select id="selectBaseTechnologyBomListByProcessCodeList" parameterType="String" resultMap="BaseTechnologyBomResult">
<include refid="selectBaseTechnologyBomVo"/>
where process_code in
<foreach item="processCode" collection="list" open="(" separator="," close=")">
#{processCode}
</foreach>
</select>
</mapper>

View File

@ -31,10 +31,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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,
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, btb.figure_code plan_sheet
wzt.UPDATE_BY, wzt.UPDATE_TIME, wzt.STATUS, mi.item_name attr2
from WMS_ZD_TASK wzt
left join md_item mi on wzt.m_product_id = mi.item_id
left join base_technology_bom btb on btb.technology_bom_id = wzt.attr4
</sql>
<select id="selectWmsZdTaskList" parameterType="WmsZdTask" resultMap="WmsZdTaskResult">
@ -58,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null and updateTime != ''"> and UPDATE_TIME = #{updateTime}</if>
<if test="status != null and status != ''"> and STATUS = #{status}</if>
</where>
order by create_time desc
</select>
<select id="selectWmsZdTaskByWmsZdTaskId" parameterType="String" resultMap="WmsZdTaskResult">