完成同一图号的组装任务的出入库记录合并
This commit is contained in:
parent
1b79b79082
commit
3d21743a37
@ -329,6 +329,7 @@ public class BaseKnifeController extends BaseController
|
|||||||
operLog.setOperParam(json);
|
operLog.setOperParam(json);
|
||||||
operLog.setStatus(1);
|
operLog.setStatus(1);
|
||||||
operLog.setOperTime(new Date());
|
operLog.setOperTime(new Date());
|
||||||
|
// 接口返回信息
|
||||||
String msg = "生产准备验证成功!";
|
String msg = "生产准备验证成功!";
|
||||||
|
|
||||||
// 记录所需物料数量的map
|
// 记录所需物料数量的map
|
||||||
@ -351,6 +352,7 @@ public class BaseKnifeController extends BaseController
|
|||||||
return AjaxResult.error("物料台账查询错误", techBom.getKnifeCode());
|
return AjaxResult.error("物料台账查询错误", techBom.getKnifeCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询复合条件的台账
|
||||||
baseKnifeWrapper.setMbbBdMrlId(mdItemTemp.getItemId());
|
baseKnifeWrapper.setMbbBdMrlId(mdItemTemp.getItemId());
|
||||||
baseKnifeWrapper.setIsLocked(0);
|
baseKnifeWrapper.setIsLocked(0);
|
||||||
List<BaseKnife> tempList = this.baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
|
List<BaseKnife> tempList = this.baseKnifeService.selectBaseKnifeList(baseKnifeWrapper);
|
||||||
@ -573,6 +575,7 @@ public class BaseKnifeController extends BaseController
|
|||||||
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(zdTask.getAttr1());
|
BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(zdTask.getAttr1());
|
||||||
BaseKnife baseKnifeWrapper = new BaseKnife();
|
BaseKnife baseKnifeWrapper = new BaseKnife();
|
||||||
List<BaseKnife> baseKnifeList = new ArrayList<>();
|
List<BaseKnife> baseKnifeList = new ArrayList<>();
|
||||||
|
// 遍历组装整刀需要的bom物料
|
||||||
for (MbbProduBom mbbProduBom : bomRoute.getMbbProduBomList()) {
|
for (MbbProduBom mbbProduBom : bomRoute.getMbbProduBomList()) {
|
||||||
baseKnifeWrapper.setMbbBdMrlId(mbbProduBom.getMdItemId());
|
baseKnifeWrapper.setMbbBdMrlId(mbbProduBom.getMdItemId());
|
||||||
baseKnifeWrapper.setIsLocked(0);
|
baseKnifeWrapper.setIsLocked(0);
|
||||||
@ -588,6 +591,7 @@ public class BaseKnifeController extends BaseController
|
|||||||
// 查询工艺bom
|
// 查询工艺bom
|
||||||
BaseTechnologyBom technologyBom = new BaseTechnologyBom();
|
BaseTechnologyBom technologyBom = new BaseTechnologyBom();
|
||||||
Boolean lockedFlag = false;
|
Boolean lockedFlag = false;
|
||||||
|
// attr4 组装任务所属计划单, 如果为空则是手动组装任务不需要锁定
|
||||||
if (zdTask.getAttr4() != null){
|
if (zdTask.getAttr4() != null){
|
||||||
lockedFlag = true;
|
lockedFlag = true;
|
||||||
technologyBom = baseTechnologyBomService.selectBaseTechnologyBomByTechnologyBomId(zdTask.getAttr4());
|
technologyBom = baseTechnologyBomService.selectBaseTechnologyBomByTechnologyBomId(zdTask.getAttr4());
|
||||||
@ -595,15 +599,19 @@ public class BaseKnifeController extends BaseController
|
|||||||
technologyBom.setFigureCode(zdTask.getCode());
|
technologyBom.setFigureCode(zdTask.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 出库基础物料
|
// 出库基础物料, 根据图号查询出库计划,如果不存在生成计划,存在则往计划中添加任务
|
||||||
WmsOutPlan outPlan = new WmsOutPlan();
|
WmsOutPlan outPlan = wmsOutPlanMapper.selectWmsOutPlanByPlanCode(technologyBom.getFigureCode());
|
||||||
outPlan.setPlanCode(technologyBom.getFigureCode());
|
if (outPlan == null){
|
||||||
outPlan.setWmsBusinessTypeId(12L);
|
WmsOutPlan outPlanTemp = new WmsOutPlan();
|
||||||
outPlan.setPlanState("1");
|
outPlanTemp.setPlanCode(technologyBom.getFigureCode());
|
||||||
outPlan.setPlanType("ZDCK");
|
outPlanTemp.setWmsBusinessTypeId(12L);
|
||||||
outPlan.setCreateBy(getUsername());
|
outPlanTemp.setPlanState("1");
|
||||||
outPlan.setCreateTime(DateUtils.getNowDate());
|
outPlanTemp.setPlanType("ZDCK");
|
||||||
wmsOutPlanMapper.insertWmsOutPlan(outPlan);
|
outPlanTemp.setCreateBy(getUsername());
|
||||||
|
outPlanTemp.setCreateTime(DateUtils.getNowDate());
|
||||||
|
wmsOutPlanMapper.insertWmsOutPlan(outPlanTemp);
|
||||||
|
outPlan = outPlanTemp;
|
||||||
|
}
|
||||||
|
|
||||||
// 锁定物料
|
// 锁定物料
|
||||||
Boolean outPlanFlag = true;
|
Boolean outPlanFlag = true;
|
||||||
@ -621,6 +629,7 @@ public class BaseKnifeController extends BaseController
|
|||||||
baseKnife.setStandardQuantity("1");
|
baseKnife.setStandardQuantity("1");
|
||||||
baseKnife.setKnifeLife(100);
|
baseKnife.setKnifeLife(100);
|
||||||
baseKnife.setKnifeFineState(0);
|
baseKnife.setKnifeFineState(0);
|
||||||
|
// 判断是否需要锁定整刀
|
||||||
if (lockedFlag) {
|
if (lockedFlag) {
|
||||||
baseKnife.setIsLocked(1);
|
baseKnife.setIsLocked(1);
|
||||||
baseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
|
baseKnife.setLockedStartTime(technologyBom.getLockedStartTime());
|
||||||
@ -661,7 +670,7 @@ public class BaseKnifeController extends BaseController
|
|||||||
wmsOutPlanDetailList.add(outPlanDetail);
|
wmsOutPlanDetailList.add(outPlanDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 锁定物料
|
// 锁定基础 物料
|
||||||
int bomCount = mbbProduBom.getStandardDosage();
|
int bomCount = mbbProduBom.getStandardDosage();
|
||||||
for (BaseKnife wmsBaseKnife : baseKnifeList){
|
for (BaseKnife wmsBaseKnife : baseKnifeList){
|
||||||
if (bomCount > 0){
|
if (bomCount > 0){
|
||||||
@ -673,6 +682,7 @@ public class BaseKnifeController extends BaseController
|
|||||||
baseKnifeListOutPlan.add(wmsBaseKnife);
|
baseKnifeListOutPlan.add(wmsBaseKnife);
|
||||||
baseKnifeService.updateBaseKnife(wmsBaseKnife);
|
baseKnifeService.updateBaseKnife(wmsBaseKnife);
|
||||||
bomCount--;
|
bomCount--;
|
||||||
|
// 记录刀片重置次数
|
||||||
resetCount += wmsBaseKnife.getResetCount();
|
resetCount += wmsBaseKnife.getResetCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -699,11 +709,12 @@ public class BaseKnifeController extends BaseController
|
|||||||
wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);
|
wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 出库任务
|
// 生成出库任务
|
||||||
WmsOutTask wmsOutTask = new WmsOutTask();
|
WmsOutTask wmsOutTask = new WmsOutTask();
|
||||||
wmsOutTask.setWmsOutPlanId(outPlan.getWmsOutPlanId());
|
wmsOutTask.setWmsOutPlanId(outPlan.getWmsOutPlanId());
|
||||||
wmsOutTask.setWmsOutPlanCode(outPlan.getPlanCode());
|
wmsOutTask.setWmsOutPlanCode(generateTaskCode(outPlan.getPlanCode()));
|
||||||
wmsOutTask.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
wmsOutTask.setWmsOutPlanDetailId(outPlanDetail.getWmsOutPlanDetailId());
|
||||||
|
// 出库类型 12组刀出库
|
||||||
wmsOutTask.setWmsBusinessTypeId(12L);
|
wmsOutTask.setWmsBusinessTypeId(12L);
|
||||||
wmsOutTask.setTaskCode(outPlan.getPlanCode());
|
wmsOutTask.setTaskCode(outPlan.getPlanCode());
|
||||||
wmsOutTask.setTaskNumber(outPlanDetail.getPlannedQuantity());
|
wmsOutTask.setTaskNumber(outPlanDetail.getPlannedQuantity());
|
||||||
@ -726,16 +737,18 @@ public class BaseKnifeController extends BaseController
|
|||||||
mdItemService.updateMdItem(mdItem);
|
mdItemService.updateMdItem(mdItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 整刀入库计划
|
// 整刀入库计划, 根据图号查询入库计划,如果不存在生成计划,存在则往计划中添加任务
|
||||||
WmsInPlan wmsInPlan = new WmsInPlan();
|
WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(technologyBom.getFigureCode());
|
||||||
wmsInPlan.setState("1");
|
if (wmsInPlan == null){
|
||||||
wmsInPlan.setSourceType("SGLR");
|
WmsInPlan wmsInPlanTemp = new WmsInPlan();
|
||||||
wmsInPlan.setCellCode(zdTask.getAttr3());
|
wmsInPlanTemp.setState("1");
|
||||||
wmsInPlan.setPlanCode(technologyBom.getFigureCode());
|
wmsInPlanTemp.setSourceType("SGLR");
|
||||||
wmsInPlan.setRelBillCode("组装单据");
|
wmsInPlanTemp.setCellCode(zdTask.getAttr3());
|
||||||
wmsInPlan.setPlanTypeId("13");
|
wmsInPlanTemp.setPlanCode(technologyBom.getFigureCode());
|
||||||
wmsInPlan.setCreateBy(getUsername());
|
wmsInPlanTemp.setRelBillCode("组装单据");
|
||||||
wmsInPlan.setCreateTime(DateUtils.getNowDate());
|
wmsInPlanTemp.setPlanTypeId("13");
|
||||||
|
wmsInPlanTemp.setCreateBy(getUsername());
|
||||||
|
wmsInPlanTemp.setCreateTime(DateUtils.getNowDate());
|
||||||
|
|
||||||
// 入库任务明细
|
// 入库任务明细
|
||||||
List<WmsInPlanDetails> wmsInPlanDetailsList = new ArrayList<>();
|
List<WmsInPlanDetails> wmsInPlanDetailsList = new ArrayList<>();
|
||||||
@ -747,8 +760,23 @@ public class BaseKnifeController extends BaseController
|
|||||||
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);
|
||||||
|
wmsInPlanService.insertWmsInPlan(wmsInPlanTemp);
|
||||||
|
wmsInPlan = wmsInPlanTemp;
|
||||||
|
} else {
|
||||||
|
// 入库任务明细
|
||||||
|
List<WmsInPlanDetails> wmsInPlanDetailsList = wmsInPlan.getWmsInPlanDetailsList();
|
||||||
|
WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails();
|
||||||
|
wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString());
|
||||||
|
wmsInPlanDetails.setBatch(batchNum);
|
||||||
|
wmsInPlanDetails.setCellId("1");
|
||||||
|
wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString());
|
||||||
|
wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString());
|
||||||
|
wmsInPlanDetails.setPlanInStatus("0");
|
||||||
|
wmsInPlanDetailsList.add(wmsInPlanDetails);
|
||||||
wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailsList);
|
wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailsList);
|
||||||
wmsInPlanService.insertWmsInPlan(wmsInPlan);
|
wmsInPlanService.updateWmsInPlan(wmsInPlan);
|
||||||
|
}
|
||||||
|
|
||||||
// 入库任务
|
// 入库任务
|
||||||
MdItem mdItem = mdItemService.selectMdItemById(zdTask.getmProductId());
|
MdItem mdItem = mdItemService.selectMdItemById(zdTask.getmProductId());
|
||||||
|
@ -101,4 +101,6 @@ public interface WmsOutPlanMapper {
|
|||||||
);
|
);
|
||||||
|
|
||||||
WmsOutPlanDetail selectWmsOutPlanDetailById(Long wmsOutPlanDetailId);
|
WmsOutPlanDetail selectWmsOutPlanDetailById(Long wmsOutPlanDetailId);
|
||||||
|
|
||||||
|
WmsOutPlan selectWmsOutPlanByPlanCode(String figureCode);
|
||||||
}
|
}
|
||||||
|
@ -84,4 +84,6 @@ public interface WmsInPlanMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteWmsInPlanDetailsByPlanId(String planId);
|
public int deleteWmsInPlanDetailsByPlanId(String planId);
|
||||||
|
|
||||||
|
WmsInPlan selectWmsInPlanByPlanCode(String planCode);
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@ public interface IWmsInPlanService
|
|||||||
*/
|
*/
|
||||||
public WmsInPlan selectWmsInPlanByPlanId(String planId);
|
public WmsInPlan selectWmsInPlanByPlanId(String planId);
|
||||||
|
|
||||||
|
WmsInPlan selectWmsInPlanByPlanCode(String planCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询入库计划列表
|
* 查询入库计划列表
|
||||||
*
|
*
|
||||||
@ -58,4 +60,5 @@ public interface IWmsInPlanService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteWmsInPlanByPlanId(String planId);
|
public int deleteWmsInPlanByPlanId(String planId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,11 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
|
|||||||
return wmsInPlanMapper.selectWmsInPlanByPlanId(planId);
|
return wmsInPlanMapper.selectWmsInPlanByPlanId(planId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WmsInPlan selectWmsInPlanByPlanCode(String planCode) {
|
||||||
|
return wmsInPlanMapper.selectWmsInPlanByPlanCode(planCode);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询入库计划列表
|
* 查询入库计划列表
|
||||||
*
|
*
|
||||||
|
@ -390,4 +390,47 @@
|
|||||||
FROM WMS_OUT_PLAN_DETAIL
|
FROM WMS_OUT_PLAN_DETAIL
|
||||||
WHERE WMS_OUT_PLAN_DETAIL_ID = #{wmsOutPlanDetailId};
|
WHERE WMS_OUT_PLAN_DETAIL_ID = #{wmsOutPlanDetailId};
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectWmsOutPlanByPlanCode" resultMap="WmsOutPlanWmsOutPlanDetailResult">
|
||||||
|
select a.WMS_OUT_PLAN_ID,
|
||||||
|
a.PLAN_CODE,
|
||||||
|
a.WMS_BUSINESS_TYPE_ID,
|
||||||
|
a.PLAN_STATE,
|
||||||
|
a.PLAN_TYPE,
|
||||||
|
a.RECIPIENT_USERNAME,
|
||||||
|
a.REMARK,
|
||||||
|
a.ATTR1,
|
||||||
|
a.ATTR2,
|
||||||
|
a.ATTR3,
|
||||||
|
a.ATTR4,
|
||||||
|
a.CREATE_BY,
|
||||||
|
a.CREATE_TIME,
|
||||||
|
a.UPDATE_BY,
|
||||||
|
a.UPDATE_TIME,
|
||||||
|
b.WMS_OUT_PLAN_DETAIL_ID as sub_WMS_OUT_PLAN_DETAIL_ID,
|
||||||
|
b.WMS_OUT_PLAN_ID as sub_WMS_OUT_PLAN_ID,
|
||||||
|
b.MD_ITEM_ID as sub_MD_ITEM_ID,
|
||||||
|
b.MD_ITEM_CODE as sub_MD_ITEM_CODE,
|
||||||
|
b.MD_ITEM_NAME as sub_MD_ITEM_NAME,
|
||||||
|
b.MD_ITEM_UNIT as sub_MD_ITEM_UNIT,
|
||||||
|
b.PLANNED_QUANTITY as sub_PLANNED_QUANTITY,
|
||||||
|
b.REAL_QUANTITY as sub_REAL_QUANTITY,
|
||||||
|
b.DETAIL_BATCH_NUM as sub_DETAIL_BATCH_NUM,
|
||||||
|
b.WM_STORAGE_AREA_ID as sub_WM_STORAGE_AREA_ID,
|
||||||
|
b.WM_STORAGE_AREA_CODE as sub_WM_STORAGE_AREA_CODE,
|
||||||
|
b.WM_STORAGE_AREA_NAME as sub_WM_STORAGE_AREA_NAME,
|
||||||
|
b.DETAIL_STATE as sub_DETAIL_STATE,
|
||||||
|
b.REMARK as sub_REMARK,
|
||||||
|
b.ATTR1 as sub_ATTR1,
|
||||||
|
b.ATTR2 as sub_ATTR2,
|
||||||
|
b.ATTR3 as sub_ATTR3,
|
||||||
|
b.ATTR4 as sub_ATTR4,
|
||||||
|
b.CREATE_BY as sub_CREATE_BY,
|
||||||
|
b.CREATE_TIME as sub_CREATE_TIME,
|
||||||
|
b.UPDATE_BY as sub_UPDATE_BY,
|
||||||
|
b.UPDATE_TIME as sub_UPDATE_TIME
|
||||||
|
from WMS_OUT_PLAN a
|
||||||
|
left join WMS_OUT_PLAN_DETAIL b on b.WMS_OUT_PLAN_ID = a.WMS_OUT_PLAN_ID
|
||||||
|
where a.PLAN_CODE = #{planCode}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -175,6 +175,55 @@
|
|||||||
where a.PLAN_ID = #{planId}
|
where a.PLAN_ID = #{planId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectWmsInPlanByPlanCode" parameterType="String" resultMap="WmsInPlanWmsInPlanDetailsResult">
|
||||||
|
select a.PLAN_ID,
|
||||||
|
a.STATE,
|
||||||
|
a.SOURCE_TYPE,
|
||||||
|
a.WARE_ID,
|
||||||
|
a.CELL_CODE,
|
||||||
|
a.WORK_ORDER_CODE,
|
||||||
|
a.EXPECT_DATE,
|
||||||
|
a.PUBLISH_NAME,
|
||||||
|
a.PUBLISH_TIME,
|
||||||
|
a.CLOSER_ID,
|
||||||
|
a.CLOSE_TIME,
|
||||||
|
a.REL_BILL_CODE,
|
||||||
|
a.CREATE_BY,
|
||||||
|
a.CREATE_TIME,
|
||||||
|
a.UPDATE_TIME,
|
||||||
|
a.UPDATE_BY,
|
||||||
|
a.REMARK,
|
||||||
|
a.CUSTOMER_ID,
|
||||||
|
a.PO_CODE,
|
||||||
|
a.DEPARTMENT_ID,
|
||||||
|
a.CONTRACT_NO,
|
||||||
|
a.SUPPLIER_ID,
|
||||||
|
a.BUSINESS_TYPE_ID,
|
||||||
|
a.SRC_OUT_TASK_ID,
|
||||||
|
a.IS_ACTIVE,
|
||||||
|
a.IS_DELETE,
|
||||||
|
a.PLAN_CODE,
|
||||||
|
a.PLAN_TYPE_ID,
|
||||||
|
b.DETAILS_ID as sub_DETAILS_ID,
|
||||||
|
b.PLAN_ID as sub_PLAN_ID,
|
||||||
|
b.MATERIAL_ID as sub_MATERIAL_ID,
|
||||||
|
b.BATCH as sub_BATCH,
|
||||||
|
b.CELL_ID as sub_CELL_ID,
|
||||||
|
b.QUANTITY as sub_QUANTITY,
|
||||||
|
b.QUANTITY_IN as sub_QUANTITY_IN,
|
||||||
|
b.PLAN_IN_STATUS as sub_PLAN_IN_STATUS,
|
||||||
|
b.REMARK as sub_REMARK,
|
||||||
|
b.CREATE_BY as sub_CREATE_BY,
|
||||||
|
b.CREATE_TIME as sub_CREATE_TIME,
|
||||||
|
b.UPDATE_BY as sub_UPDATE_BY,
|
||||||
|
b.UPDATE_TIME as sub_UPDATE_TIME,
|
||||||
|
b.IS_ACTIVY as sub_IS_ACTIVY,
|
||||||
|
b.IS_DELETE as sub_IS_DELETE
|
||||||
|
from WMS_IN_PLAN a
|
||||||
|
left join WMS_IN_PLAN_DETAILS b on b.PLAN_ID = a.PLAN_ID
|
||||||
|
where a.PLAN_CODE = #{planCode}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertWmsInPlan" parameterType="WmsInPlan" useGeneratedKeys="true" keyProperty="planId">
|
<insert id="insertWmsInPlan" parameterType="WmsInPlan" useGeneratedKeys="true" keyProperty="planId">
|
||||||
insert into WMS_IN_PLAN
|
insert into WMS_IN_PLAN
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
Loading…
Reference in New Issue
Block a user