工艺管理测试修改

This commit is contained in:
weihongyang 2020-01-16 16:07:22 +08:00
parent 0e1eae73bc
commit 3d11e761bd
11 changed files with 119 additions and 44 deletions

View File

@ -25,4 +25,6 @@ public interface ProcessBomMapper extends Mapper<ProcessBom> {
void insertOrUpdate(List<ProcessBom> processBomList); void insertOrUpdate(List<ProcessBom> processBomList);
ProductProcessBomPo findProductAndProcessBomByProdBom(Integer productBomId); ProductProcessBomPo findProductAndProcessBomByProdBom(Integer productBomId);
Integer saveOrUpdate(ProcessBom processBom);
} }

View File

@ -24,12 +24,7 @@
</resultMap> </resultMap>
<resultMap id="ProcessBomDto" type="com.deer.wms.produce.manage.model.ProcessBomDto" extends="BaseResultMap"> <resultMap id="ProcessBomDto" type="com.deer.wms.produce.manage.model.ProcessBomDto" extends="BaseResultMap">
<result column="product_name" jdbcType="VARCHAR" property="productName" /> <result column="process_materials_id" jdbcType="INTEGER" property="processMaterialsId" />
<result column="product_specification" jdbcType="VARCHAR" property="productSpecification" />
<result column="unit_name" jdbcType="VARCHAR" property="unitName" />
<result column="product_process_name" jdbcType="VARCHAR" property="productProcessName" />
<result column="product_work_specification" jdbcType="VARCHAR" property="productWorkSpecification" />
<result column="process_content" jdbcType="VARCHAR" property="processContent" />
<collection property="processMaterialsBomDtoList" ofType="com.deer.wms.produce.manage.model.ProcessMaterialsBomDto"> <collection property="processMaterialsBomDtoList" ofType="com.deer.wms.produce.manage.model.ProcessMaterialsBomDto">
<result column="operator_id" jdbcType="INTEGER" property="operatorId" /> <result column="operator_id" jdbcType="INTEGER" property="operatorId" />
@ -46,6 +41,7 @@
<result column="memo" jdbcType="VARCHAR" property="memo" /> <result column="memo" jdbcType="VARCHAR" property="memo" />
<result column="company_id" jdbcType="INTEGER" property="companyId" /> <result column="company_id" jdbcType="INTEGER" property="companyId" />
<result column="materials_name" jdbcType="VARCHAR" property="materialsName" /> <result column="materials_name" jdbcType="VARCHAR" property="materialsName" />
<result column="process_materials_bom_id" jdbcType="INTEGER" property="processMaterialsBomId"/>
</collection> </collection>
</resultMap> </resultMap>
@ -74,7 +70,7 @@
<select id="findListById" resultMap="ProcessBomDto"> <select id="findListById" resultMap="ProcessBomDto">
SELECT SELECT
mapb.id,mapb.process_name,mapb.process_apartment,mapb.process_step,mapb.process_content,mapab.code,mapab.specification,mapab.dosage,mami.materials_name,mamp.product_name,mamp.specification AS product_specification,u.unit_name,mappb.product_process_name,mapb.specification AS mapb.id,mapb.process_name,mapb.process_apartment,mapb.process_step,mapb.process_content,mapab.code,mapab.specification,mapab.dosage,mami.materials_name,mamp.product_name,mamp.specification AS product_specification,u.unit_name,mappb.product_process_name,mapb.specification AS
product_work_specification,mapb.process_content product_work_specification,mapab.id AS process_materials_id,mapab.id AS process_materials_bom_id,mapab.materials_id
FROM mt_alone_product_process_bom mappb FROM mt_alone_product_process_bom mappb
LEFT JOIN mt_alone_process_bom mapb ON mappb.id = mapb.product_process_id LEFT JOIN mt_alone_process_bom mapb ON mappb.id = mapb.product_process_id
LEFT JOIN mt_alone_process_materials_bom mapab ON mapb.id = mapab.process_bom_id LEFT JOIN mt_alone_process_materials_bom mapab ON mapb.id = mapab.process_bom_id
@ -182,4 +178,10 @@
</where> ORDER BY procbom.process_step </where> ORDER BY procbom.process_step
</select> </select>
<insert id="saveOrUpdate" parameterType="com.deer.wms.produce.manage.model.ProcessBom" useGeneratedKeys="true" keyProperty="id">
REPLACE INTO mt_alone_process_bom
(id, update_time, process_name, product_process_id, process_content, process_step, process_apartment)
VALUES (#{id}, #{updateTime}, #{processName}, #{productProcessId}, #{processContent}, #{processStep}, #{processApartment})
</insert>
</mapper> </mapper>

View File

@ -97,8 +97,7 @@
</select> </select>
<select id="findListByTerm" resultMap="ProPrcessBomDTOResultMap"> <select id="findListByTerm" resultMap="ProPrcessBomDTOResultMap">
SELECT u.unit_name,mappb.id,mappb.product_process_name,mamp.product_code, mamp.product_name,mamp.specification,mapb.specification AS SELECT u.unit_name,mappb.id,mappb.product_process_name,mamp.product_code, mamp.product_name,mappb.specification AS work_specification,mamp.specification,mapb.process_content, COUNT(mapb.process_step) process_step
work_specification,mapb.process_content, COUNT(mapb.process_step) process_step
FROM mt_alone_product_process_bom mappb FROM mt_alone_product_process_bom mappb
LEFT JOIN mt_alone_machining_product mamp ON mappb.product_id = mamp.id LEFT JOIN mt_alone_machining_product mamp ON mappb.product_id = mamp.id
LEFT JOIN mt_alone_process_bom mapb ON mapb.product_process_id = mappb.id LEFT JOIN mt_alone_process_bom mapb ON mapb.product_process_id = mappb.id
@ -112,7 +111,7 @@
) )
</if> </if>
<if test="companyId != null"> <if test="companyId != null">
AND mapb.company_id = #{companyId} AND mappb.company_id = #{companyId}
</if> </if>
</where> </where>
GROUP BY mapb.product_process_id GROUP BY mapb.product_process_id
@ -157,7 +156,7 @@
</select> </select>
<select id="findDataById" resultMap="ProPrcessBomDTOResultMap"> <select id="findDataById" resultMap="ProPrcessBomDTOResultMap">
SELECT mappb.id,mamp.id AS machining_product_id,mamp.product_name,mappb.specification,u.unit_name,mappb.product_process_name,mamp.specification AS work_specification,mappb.process_content SELECT mappb.id,mamp.id AS machining_product_id,mamp.product_name,mappb.specification AS work_specification,u.unit_name,mappb.product_process_name,mamp.specification,mappb.process_content
FROM mt_alone_product_process_bom mappb FROM mt_alone_product_process_bom mappb
LEFT JOIN mt_alone_machining_product mamp ON mappb.product_id = mamp.id LEFT JOIN mt_alone_machining_product mamp ON mappb.product_id = mamp.id
LEFT JOIN unit u ON mamp.unit_id = u.unit_id LEFT JOIN unit u ON mamp.unit_id = u.unit_id

View File

@ -90,6 +90,7 @@ public class MachiningProduct {
/** /**
* 规格 * 规格
*/ */
@Column(name = "specification")
private String specification; private String specification;
/** /**

View File

@ -25,6 +25,26 @@ public class ProcessBomDto extends ProcessBom{
private String processContent; private String processContent;
private Integer processId;
private Integer processMaterialsId;
public Integer getProcessMaterialsId() {
return processMaterialsId;
}
public void setProcessMaterialsId(Integer processMaterialsId) {
this.processMaterialsId = processMaterialsId;
}
public Integer getProcessId() {
return processId;
}
public void setProcessId(Integer processId) {
this.processId = processId;
}
public String getProductName() { public String getProductName() {
return productName; return productName;
} }

View File

@ -62,6 +62,8 @@ public class ProcessBomParams extends QueryParams {
*/ */
private List<ProcessMaterialsBomParams> processMaterialsBomParamsList; private List<ProcessMaterialsBomParams> processMaterialsBomParamsList;
private Integer processId;
@Override @Override
public String toString() { public String toString() {
return "ProcessBomParams{" + return "ProcessBomParams{" +
@ -77,10 +79,19 @@ public class ProcessBomParams extends QueryParams {
", processApartment='" + processApartment + '\'' + ", processApartment='" + processApartment + '\'' +
", processName='" + processName + '\'' + ", processName='" + processName + '\'' +
", processMaterialsBomParamsList=" + processMaterialsBomParamsList + ", processMaterialsBomParamsList=" + processMaterialsBomParamsList +
", processId=" + processId +
", processBomVoList=" + processBomVoList + ", processBomVoList=" + processBomVoList +
'}'; '}';
} }
public Integer getProcessId() {
return processId;
}
public void setProcessId(Integer processId) {
this.processId = processId;
}
public List<ProcessMaterialsBomParams> getProcessMaterialsBomParamsList() { public List<ProcessMaterialsBomParams> getProcessMaterialsBomParamsList() {
return processMaterialsBomParamsList; return processMaterialsBomParamsList;
} }

View File

@ -19,6 +19,28 @@ public class ProcessMaterialsBomDto extends ProcessMaterialsBom {
private String companyName; private String companyName;
private Integer processMaterialsBomId;
private Integer materialsId;
@Override
public Integer getMaterialsId() {
return materialsId;
}
@Override
public void setMaterialsId(Integer materialsId) {
this.materialsId = materialsId;
}
public Integer getProcessMaterialsBomId() {
return processMaterialsBomId;
}
public void setProcessMaterialsBomId(Integer processMaterialsBomId) {
this.processMaterialsBomId = processMaterialsBomId;
}
public Integer getProductProcessId() { public Integer getProductProcessId() {
return productProcessId; return productProcessId;
} }

View File

@ -46,6 +46,10 @@ public class ProcessMaterialsBomParams extends QueryParams {
*/ */
private Double dosage; private Double dosage;
private Integer processMaterialsBomId;
private Integer unitId;
@Override @Override
public String toString() { public String toString() {
return "ProcessMaterialsBomParams{" + return "ProcessMaterialsBomParams{" +
@ -60,6 +64,22 @@ public class ProcessMaterialsBomParams extends QueryParams {
'}'; '}';
} }
public Integer getUnitId() {
return unitId;
}
public void setUnitId(Integer unitId) {
this.unitId = unitId;
}
public Integer getProcessMaterialsBomId() {
return processMaterialsBomId;
}
public void setProcessMaterialsBomId(Integer processMaterialsBomId) {
this.processMaterialsBomId = processMaterialsBomId;
}
public Integer getId() { public Integer getId() {
return id; return id;
} }

View File

@ -60,7 +60,7 @@ public class ProductProcessBomParams extends QueryParams {
private Integer machiningProductId; private Integer machiningProductId;
private String memo;
@Override @Override
public String toString() { public String toString() {
@ -78,6 +78,14 @@ public class ProductProcessBomParams extends QueryParams {
'}'; '}';
} }
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
public Integer getMachiningProductId() { public Integer getMachiningProductId() {
return machiningProductId; return machiningProductId;
} }

View File

@ -68,23 +68,24 @@ public class ProductProcessBomServiceImpl extends AbstractService<ProductProcess
ProductProcessBom productProcessBom = new ProductProcessBom(); ProductProcessBom productProcessBom = new ProductProcessBom();
productProcessBom.setCreateTime(params.getCreateTime()); productProcessBom.setCreateTime(params.getCreateTime());
productProcessBom.setCompanyId(params.getCompanyId()); productProcessBom.setCompanyId(params.getCompanyId());
productProcessBom.setSpecification(params.getSpecification()); productProcessBom.setSpecification(params.getWorkSpecification());
productProcessBom.setProductId(params.getProductId()); productProcessBom.setProductId(params.getProductId());
productProcessBom.setProcessContent(params.getProcessContent()); productProcessBom.setProcessContent(params.getProcessContent());
productProcessBom.setProductProcessName(params.getProductProcessName()); productProcessBom.setProductProcessName(params.getProductProcessName());
productProcessBomMapper.insert(productProcessBom);
productProcessBomMapper.insertSelective(productProcessBom);
for (ProcessBomParams processBomParams:params.getProcessBomParamsList()) { for (ProcessBomParams processBomParams:params.getProcessBomParamsList()) {
ProcessBom processBom = new ProcessBom(); ProcessBom processBom = new ProcessBom();
processBom.setCreateTime(new Date()); processBom.setCreateTime(new Date());
processBom.setProcessName(processBomParams.getProcessName()); processBom.setProcessName(processBomParams.getProcessName());
processBom.setProductProcessId(productProcessBom.getId()); processBom.setProductProcessId(productProcessBom.getId());
processBom.setSpecification(params.getSpecification()); processBom.setSpecification(processBomParams.getSpecification());
processBom.setProcessContent(params.getProcessContent()); processBom.setProcessContent(processBomParams.getProcessContent());
processBom.setProcessStep(processBomParams.getProcessStep()); processBom.setProcessStep(processBomParams.getProcessStep());
processBom.setMemo(processBomParams.getMemo()); processBom.setMemo(processBomParams.getMemo());
processBom.setCompanyId(params.getCompanyId()); processBom.setCompanyId(params.getCompanyId());
processBom.setProcessApartment(processBomParams.getProcessApartment()); processBom.setProcessApartment(processBomParams.getProcessApartment());
processBomMapper.insert(processBom); processBomMapper.insertSelective(processBom);
for (ProcessMaterialsBomParams processMaterialsBomParams:processBomParams.getProcessMaterialsBomParamsList()) { for (ProcessMaterialsBomParams processMaterialsBomParams:processBomParams.getProcessMaterialsBomParamsList()) {
processMaterialsBomParams.setProcessBomId(processBom.getId()); processMaterialsBomParams.setProcessBomId(processBom.getId());
} }
@ -97,9 +98,11 @@ public class ProductProcessBomServiceImpl extends AbstractService<ProductProcess
processMaterialsBom.setProcessBomId(processMaterialsBomParams.getProcessBomId()); processMaterialsBom.setProcessBomId(processMaterialsBomParams.getProcessBomId());
processMaterialsBom.setMaterialsId(processMaterialsBomParams.getMaterialsId()); processMaterialsBom.setMaterialsId(processMaterialsBomParams.getMaterialsId());
processMaterialsBom.setCode(processMaterialsBomParams.getCode()); processMaterialsBom.setCode(processMaterialsBomParams.getCode());
processMaterialsBom.setSpecification(params.getSpecification()); processMaterialsBom.setSpecification(processMaterialsBomParams.getSpecification());
processMaterialsBom.setDosage(processMaterialsBomParams.getDosage().floatValue()); processMaterialsBom.setDosage(processMaterialsBomParams.getDosage().floatValue());
processMaterialsBom.setUnitId(processMaterialsBomParams.getUnitId());
processMaterialsBom.setCompanyId(params.getCompanyId()); processMaterialsBom.setCompanyId(params.getCompanyId());
processMaterialsBomList.add(processMaterialsBom); processMaterialsBomList.add(processMaterialsBom);
} }
} }
@ -109,21 +112,18 @@ public class ProductProcessBomServiceImpl extends AbstractService<ProductProcess
@Override @Override
public void updateProductProcessBom(ProductProcessBomParams params) { public void updateProductProcessBom(ProductProcessBomParams params) {
System.out.println(params.toString());
ProductProcessBom productProcessBom = new ProductProcessBom(); ProductProcessBom productProcessBom = new ProductProcessBom();
productProcessBom.setId(params.getId()); productProcessBom.setId(params.getId());
productProcessBom.setSpecification(params.getSpecification()); productProcessBom.setSpecification(params.getWorkSpecification());
productProcessBom.setProcessContent(params.getProcessContent()); productProcessBom.setProcessContent(params.getProcessContent());
productProcessBom.setProductProcessName(params.getProductProcessName()); productProcessBom.setProductProcessName(params.getProductProcessName());
productProcessBomMapper.updateByPrimaryKeySelective(productProcessBom); productProcessBomMapper.updateByPrimaryKeySelective(productProcessBom);
MachiningProduct machiningProduct = new MachiningProduct();
machiningProduct.setSpecification(params.getWorkSpecification());
machiningProduct.setId(params.getMachiningProductId());
machiningProductMapper.updateByPrimaryKeySelective(machiningProduct);
List<ProcessBom> processBomList = new ArrayList<>(); List<ProcessBom> processBomList = new ArrayList<>();
for (ProcessBomParams processBomParams:params.getProcessBomParamsList()) { for (ProcessBomParams processBomParams:params.getProcessBomParamsList()) {
ProcessBom processBom = new ProcessBom(); ProcessBom processBom = new ProcessBom();
processBom.setId(processBomParams.getId()); processBom.setId(processBomParams.getProcessId());
processBom.setUpdateTime(new Date()); processBom.setUpdateTime(new Date());
processBom.setProcessName(processBomParams.getProcessName()); processBom.setProcessName(processBomParams.getProcessName());
processBom.setProductProcessId(processBomParams.getProductProcessId()); processBom.setProductProcessId(processBomParams.getProductProcessId());
@ -131,21 +131,27 @@ public class ProductProcessBomServiceImpl extends AbstractService<ProductProcess
processBom.setProcessContent(processBomParams.getProcessContent()); processBom.setProcessContent(processBomParams.getProcessContent());
processBom.setProcessStep(processBomParams.getProcessStep()); processBom.setProcessStep(processBomParams.getProcessStep());
processBom.setProcessApartment(processBomParams.getProcessApartment()); processBom.setProcessApartment(processBomParams.getProcessApartment());
processBomList.add(processBom); processBomMapper.saveOrUpdate(processBom);
System.out.println("id="+ processBom.getId());
for (ProcessMaterialsBomParams processMaterialsBomParams:processBomParams.getProcessMaterialsBomParamsList()) {
processMaterialsBomParams.setProcessBomId(processBom.getId());
} }
processBomMapper.insertOrUpdate(processBomList); // processBomList.add(processBom);
}
// processBomMapper.insertOrUpdate(processBomList);
List<ProcessMaterialsBom> processMaterialsBomList = new ArrayList<>(); List<ProcessMaterialsBom> processMaterialsBomList = new ArrayList<>();
for (int i=0;i<params.getProcessBomParamsList().size();i++) { for (int i=0;i<params.getProcessBomParamsList().size();i++) {
for (ProcessMaterialsBomParams processMaterialsBomParams:params.getProcessBomParamsList().get(i).getProcessMaterialsBomParamsList()){ for (ProcessMaterialsBomParams processMaterialsBomParams:params.getProcessBomParamsList().get(i).getProcessMaterialsBomParamsList()){
ProcessMaterialsBom processMaterialsBom = new ProcessMaterialsBom(); ProcessMaterialsBom processMaterialsBom = new ProcessMaterialsBom();
processMaterialsBom.setId(processMaterialsBomParams.getId()); processMaterialsBom.setId(processMaterialsBomParams.getProcessMaterialsBomId());
processMaterialsBom.setUpdateTime(new Date()); processMaterialsBom.setUpdateTime(new Date());
processMaterialsBom.setProcessBomId(processMaterialsBomParams.getProcessBomId()); processMaterialsBom.setProcessBomId(processMaterialsBomParams.getProcessBomId());
processMaterialsBom.setMaterialsId(processMaterialsBomParams.getMaterialsId()); processMaterialsBom.setMaterialsId(processMaterialsBomParams.getMaterialsId());
processMaterialsBom.setCode(processMaterialsBomParams.getCode()); processMaterialsBom.setCode(processMaterialsBomParams.getCode());
processMaterialsBom.setSpecification(params.getSpecification()); processMaterialsBom.setSpecification(processMaterialsBomParams.getSpecification());
processMaterialsBom.setDosage(processMaterialsBomParams.getDosage().floatValue()); processMaterialsBom.setDosage(processMaterialsBomParams.getDosage().floatValue());
processMaterialsBom.setUnitId(processMaterialsBomParams.getUnitId());
processMaterialsBomList.add(processMaterialsBom); processMaterialsBomList.add(processMaterialsBom);
} }
} }

View File

@ -1,16 +0,0 @@
package com.deer.wms.produce.manage.web;
/**
* @Author: weihongyang
* @Date: 2019/10/18 16:54
* @Version 1.0
*/
public class Test {
public static void main(String[] args){
String s = "qwe";
int i = 1;
s = s + i;
System.out.println(s);
}
}