Commit 905b411e by liuyang

2024-10-09 物料清单生成模板

parent 21d71108
......@@ -8,6 +8,7 @@ import com.baosight.hggp.hg.pz.domain.HGPZ015;
import com.baosight.hggp.hg.pz.domain.HGPZ015A;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -79,14 +80,13 @@ public class ServiceHGPZ015 extends ServiceBase {
@Override
public EiInfo insert(EiInfo inInfo) {
HashMap map = new HashMap();
map.put("id",inInfo.getString("id"));
map.put("projCode",inInfo.getString("id"));
List<HGPZ015> query = DaoBase.getInstance().query("HGPZ015.query", map);
HGSC001 hpsc001 = HGSCTools.Hgsc001.getByCode(inInfo.getString("id"));
if (query.size() > 0) {
dao.delete("HGPZ015.delete",map);
dao.delete("HGPZ015A.delete",hpsc001.toMap());
dao.delete("HGPZ015.deleteByProjCode",map);
dao.delete("HGPZ015A.delete",map);
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
HGPZ015 hgpz015 = new HGPZ015();
// hgpz015.setId(Long.parseLong(inInfo.getString("id")));
......@@ -96,11 +96,18 @@ public class ServiceHGPZ015 extends ServiceBase {
hgpz015.setUpdatedTime(null);
DaoUtils.insert("HGPZ015.insert", hgpz015.toMap());
//模板物料清单
map.put("templateName", inInfo.getString("templateName"));
map.put("projCode", hpsc001.getProjCode());
List<HGPZ015A> hppz015AList = DaoBase.getInstance().query("HGPZ015A.queryMb", map);
List<HGSC004A> hppz015AList = DaoBase.getInstance().query("HGSC004A.query", new HashMap<String, Object>(){{
put("projCode", hpsc001.getProjCode());
}});
if (hppz015AList.size() > 0){
hppz015AList.forEach(hgpz015A -> DaoUtils.insert("HGPZ015A.insert", hgpz015A.toMap()));
hppz015AList.forEach(hgsc004A ->{
HGPZ015A hgpz015A = new HGPZ015A();
initHgpz015(hgpz015A,hgsc004A);
if (hgsc004A.getLeaf().toString().equals(inInfo.getString("templateName"))){
hgpz015A.setParentPrdtName("");
}
DaoUtils.insert("HGPZ015A.insert", hgpz015A);
});
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("生成产品模板成功!");
......@@ -208,4 +215,23 @@ public class ServiceHGPZ015 extends ServiceBase {
return eiInfo;
}
public void initHgpz015(HGPZ015A hgpz015A,HGSC004A hgsc004A){
hgpz015A.setProjCode(hgsc004A.getProjCode());
hgpz015A.setProjName(hgsc004A.getProjName());
hgpz015A.setParentId(hgsc004A.getParentProdCode());
hgpz015A.setParentPrdtName(hgsc004A.getParentProdName());
hgpz015A.setLeaf(hgsc004A.getLeaf().toString());
hgpz015A.setPrdtType(Integer.valueOf(hgsc004A.getProductType()));
hgpz015A.setInventRecordId(hgsc004A.getProductId());
hgpz015A.setPrdtCode(hgsc004A.getProductCode());
hgpz015A.setPrdtName(hgsc004A.getProductName());
hgpz015A.setSpec(hgsc004A.getSpec());
hgpz015A.setLength(hgsc004A.getLength());
hgpz015A.setWidth(hgsc004A.getWidth());
hgpz015A.setThick(hgsc004A.getThick());
hgpz015A.setLv(hgsc004A.getLv());
hgpz015A.setNum(hgsc004A.getQuantity());
hgpz015A.setUnitWt(hgsc004A.getSingleWeight());
hgpz015A.setTotalWt(hgsc004A.getTotalWeight());
}
}
......@@ -183,6 +183,10 @@
ID = #id#
</delete>
<delete id="deleteByProjCode">
DELETE FROM ${hggpSchema}.HGPZ015 WHERE PROJ_CODE = #projCode#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGPZ015
SET
......
......@@ -191,34 +191,6 @@
<include refid="order"/>
</select>
<select id="queryMb" parameterClass="java.util.HashMap" resultClass="com.baosight.hggp.hg.pz.domain.HGPZ015A">
SELECT
PROJ_CODE,
PARENT_PROD_CODE,
CASE WHEN LEAF = #templateName# THEN '' ELSE PARENT_PROD_NAME END as PARENT_PRDT_NAME,
LEAF,
SORT,
PRODUCT_TYPE,
PRODUCT_CODE,
PRODUCT_NAME,
MATERIAL_ID,
quantity,
single_weight,
total_weight,
APPROVAL_STATUS,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME,
LV,
SPEC,
LENGTH,
WIDTH,
THICK
FROM ${hggpSchema}.hgsc004a
where ACCOUNT_CODE=#accountCode# AND PROJ_CODE=#projCode#
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.hgpz015a WHERE 1=1
AND PARENT_ID NOT IN ('root')
......@@ -331,11 +303,11 @@
<!-- 删除 -->
<delete id="delete">
DELETE FROM ${hggpSchema}.hppz015a WHERE PROJ_CODE = #projCode#
DELETE FROM ${hggpSchema}.hgpz015a WHERE PROJ_CODE = #projCode#
</delete>
<update id="update">
UPDATE ${hggpSchema}.hppz015a
UPDATE ${hggpSchema}.hgpz015a
SET
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 预留 -->
DEP_CODE = #depCode#, <!-- 部门编码 预留 -->
......@@ -394,7 +366,7 @@
LV as "lv",
SPEC as "spec"
FROM
${hggpSchema}.hppz015a
${hggpSchema}.hgpz015a
WHERE 1=1
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment