change - 提资单BOM修改时记录修改内容信息、修改导入模板

master
yinq 2 months ago
parent 563f076ae2
commit 143c71d16f

@ -119,6 +119,19 @@ public class MesRaiseCapitalBom extends BaseEntity {
private String materialSpec;
/**
* (1=;0=)
*/
private String updateFlag;
public String getUpdateFlag() {
return updateFlag;
}
public void setUpdateFlag(String updateFlag) {
this.updateFlag = updateFlag;
}
public String getMaterialCode() {
return materialCode;
}

@ -293,7 +293,7 @@ public class MesImportImpl implements IMesImportService {
if (rowT == null) {
continue; // 如果行为空,跳过
}
Cell cellT = rowT.getCell(2);
Cell cellT = rowT.getCell(0);
if (StringUtils.isNull(cellT)) {
throw new ServiceException("Excel格式错误");
}
@ -304,7 +304,7 @@ public class MesImportImpl implements IMesImportService {
throw new ServiceException("Excel格式错误:物料编号:" + productBom + "的信息不存在!");
}
i = i + 3;//标题下一行
i = i + 2;//标题下一行
MesRaiseCapitalBom selectBom = new MesRaiseCapitalBom();
selectBom.setMaterialId(productMaterial.getMaterialId());
selectBom.setMaterialBomDesc(productMaterial.getMaterialName());
@ -314,13 +314,14 @@ public class MesImportImpl implements IMesImportService {
finishedProductNameList.add(productMaterial.getMaterialName());
if (productBomList.size() > 0) {
MesRaiseCapitalBom mesMaterialBom = productBomList.get(0);
parentBomId = mesMaterialBom.getRaiseCapitalId();
MesRaiseCapitalBom materialBom = new MesRaiseCapitalBom();
materialBom.setParentId(mesMaterialBom.getRaiseCapitalId());
List<MesRaiseCapitalBom> mesMaterialBoms = mesRaiseCapitalBomService.selectMesRaiseCapitalBomList(materialBom);
for (MesRaiseCapitalBom bom : mesMaterialBoms) {
mesRaiseCapitalBomService.deleteMesRaiseCapitalBomByRaiseCapitalId(bom.getRaiseCapitalId());
}
throw new ServiceException(mesMaterialBom.getMaterialName() + "已存在!" + "任务编号:" + mesMaterialBom.getTaskCode());
// parentBomId = mesMaterialBom.getRaiseCapitalId();
// MesRaiseCapitalBom materialBom = new MesRaiseCapitalBom();
// materialBom.setParentId(mesMaterialBom.getRaiseCapitalId());
// List<MesRaiseCapitalBom> mesMaterialBoms = mesRaiseCapitalBomService.selectMesRaiseCapitalBomList(materialBom);
// for (MesRaiseCapitalBom bom : mesMaterialBoms) {
// mesRaiseCapitalBomService.deleteMesRaiseCapitalBomByRaiseCapitalId(bom.getRaiseCapitalId());
// }
} else {
MesRaiseCapitalBom materialBom = new MesRaiseCapitalBom();
materialBom.setTaskCode(taskCode);
@ -354,6 +355,7 @@ public class MesImportImpl implements IMesImportService {
materialCode = materialCodeCell.getStringCellValue();
}
Cell amountCell = rowC.getCell(5);
Cell brandCell = rowC.getCell(6);
if (StringUtils.isNotEmpty(materialCode)) {
MesBaseMaterialInfo materialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialCode(materialCode);
if (StringUtils.isNotNull(materialInfo)) {
@ -366,6 +368,9 @@ public class MesImportImpl implements IMesImportService {
materialBom.setActiveFlag("1");
materialBom.setStandardAmount(BigDecimal.valueOf(amountCell.getNumericCellValue()));
materialBom.setErpMaterialId(materialInfo.getErpId());
if (brandCell != null){
materialBom.setBrand(brandCell.getStringCellValue());
}
bomList.add(materialBom);
} else {
failureMsg.append("物料编号:").append(materialCode).append("|");

@ -3,6 +3,7 @@ package com.hw.mes.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.hw.common.core.constant.WfConstants;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
@ -96,6 +97,16 @@ public class MesRaiseCapitalBomServiceImpl implements IMesRaiseCapitalBomService
public int updateMesRaiseCapitalBom(MesRaiseCapitalBom mesRaiseCapitalBom) {
mesRaiseCapitalBom.setUpdateBy(SecurityUtils.getUsername());
mesRaiseCapitalBom.setUpdateTime(DateUtils.getNowDate());
//记录修改前内容
Long raiseCapitalId = mesRaiseCapitalBom.getRaiseCapitalId();
MesRaiseCapitalBom raiseCapitalBom = mesRaiseCapitalBomMapper.selectMesRaiseCapitalBomByRaiseCapitalId(raiseCapitalId);
if (!raiseCapitalBom.getMaterialCode().equals(mesRaiseCapitalBom.getMaterialCode())
|| !raiseCapitalBom.getStandardAmount().equals(mesRaiseCapitalBom.getStandardAmount())){
raiseCapitalBom.setUpdateFlag(WfConstants.PA_UPDATE_FLAG_YES);
mesRaiseCapitalBomMapper.insertMesRaiseCapitalBom(raiseCapitalBom);
mesRaiseCapitalBom.setRemark("已修改,原物料编号:" + raiseCapitalBom.getMaterialCode());
}
return mesRaiseCapitalBomMapper.updateMesRaiseCapitalBom(mesRaiseCapitalBom);
}
@ -126,6 +137,7 @@ public class MesRaiseCapitalBomServiceImpl implements IMesRaiseCapitalBomService
public void importRaiseCapitalBom(String taskCode) {
MesRaiseCapitalBom raiseCapitalBom = new MesRaiseCapitalBom();
raiseCapitalBom.setTaskCode(taskCode);
raiseCapitalBom.setUpdateFlag(WfConstants.PA_UPDATE_FLAG_NO);
List<MesRaiseCapitalBom> capitalBomList = mesRaiseCapitalBomMapper.selectMesRaiseCapitalBomList(raiseCapitalBom);
//TODO 异常处理

@ -29,6 +29,7 @@
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialSpec" column="material_spec"/>
<result property="updateFlag" column="update_flag"/>
</resultMap>
<sql id="selectMesRaiseCapitalBomVo">
@ -52,6 +53,7 @@
mrcb.brand,
mrcb.material_classfication,
mrcb.erp_material_id,
mrcb.update_flag,
mbmi.material_code,
mbmi.material_name,
mbmi.material_spec
@ -82,6 +84,7 @@
#{materialClassfication}
</if>
<if test="erpMaterialId != null ">and mrcb.erp_material_id = #{erpMaterialId}</if>
<if test="updateFlag != null and updateFlag != ''">and mrcb.update_flag = #{updateFlag}</if>
</where>
</select>
@ -114,6 +117,7 @@
<if test="brand != null">brand,</if>
<if test="materialClassfication != null">material_classfication,</if>
<if test="erpMaterialId != null">erp_material_id,</if>
<if test="updateFlag != null">update_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskCode != null and taskCode != ''">#{taskCode},</if>
@ -136,6 +140,7 @@
<if test="brand != null">#{brand},</if>
<if test="materialClassfication != null">#{materialClassfication},</if>
<if test="erpMaterialId != null">#{erpMaterialId},</if>
<if test="updateFlag != null">#{updateFlag},</if>
</trim>
</insert>
@ -162,6 +167,7 @@
<if test="brand != null">brand = #{brand},</if>
<if test="materialClassfication != null">material_classfication = #{materialClassfication},</if>
<if test="erpMaterialId != null">erp_material_id = #{erpMaterialId},</if>
<if test="updateFlag != null">update_flag = #{updateFlag},</if>
</trim>
where raise_capital_id = #{raiseCapitalId}
</update>

@ -86,6 +86,11 @@
<dict-tag :options="dict.type.active_flag" :value="scope.row.activeFlag"/>
</template>
</el-table-column>
<el-table-column label="修改标识" align="center" prop="updateFlag" v-if="columns[11].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.import_flag" :value="scope.row.updateFlag"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" v-if="columns[10].visible"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
@ -94,6 +99,7 @@
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-if="scope.row.updateFlag === '0'"
v-hasPermi="['mes:mesRaiseCapitalBom:edit']"
>修改
</el-button>
@ -111,6 +117,7 @@
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-if="scope.row.updateFlag === '0'"
v-hasPermi="['mes:mesRaiseCapitalBom:remove']"
>删除
</el-button>
@ -219,7 +226,7 @@ import selectMaterial from "@/views/mes/materialinfo/selectMaterial";
export default {
name: "MesRaiseCapitalBom",
dicts: ['active_flag', 'check_type'],
dicts: ['active_flag', 'check_type', 'import_flag'],
components: {
Treeselect,
'select-material': selectMaterial
@ -265,6 +272,7 @@ export default {
checkType: null,
projectId: null,
assembleTime: null,
updateFlag: null,
activeFlag: null,
brand: null,
materialClassfication: null,
@ -308,6 +316,7 @@ export default {
{key: 14, label: `更新时间`, visible: true},
{key: 15, label: `BOM说明`, visible: true},
{key: 16, label: `安装时长`, visible: true},
{key: 17, label: `修改标识`, visible: true},
],
//
TOP_FLAG: {

Loading…
Cancel
Save