Commit 2f8b57f5 by liuyang

产品成材率

parent de5887cb
......@@ -281,7 +281,7 @@ public class ServiceHGSC004A extends ServiceBase {
*/
private void submitPlanEntity(HGSC004 hgsc004, Boolean flag, List<HGSC004A> hgsc004AList) {
List<String> inventCodes = hgsc004AList.stream().map(HGSC004A::getProductCode).collect(Collectors.toList());
List<HGPZ005> hgpz005List = HGPZTools.HgPz005.listByInventCodes(inventCodes);
List<HGPZ005> hgpz005List = HGPZTools.HgPz005.listByInventCodes(inventCodes);
//第一次全部提交
if(flag){
//主表
......@@ -295,6 +295,8 @@ public class ServiceHGSC004A extends ServiceBase {
//加工的才生成生产计划
mapA.put("inventSource", HGConstant.InventSource.JG);
hgsc004AList = dao.query(HGSC004A.QUERY_BY_MATERIAL_ID,mapA, 0, -999999);
inventCodes = hgsc004AList.stream().map(HGSC004A::getProductCode).collect(Collectors.toList());
hgpz005List = HGPZTools.HgPz005.listByInventCodes(inventCodes);
List<HGSC005A> hgsc005AList = new LinkedList<>();
for(HGSC004A hgsc004A : hgsc004AList){
//全部提交后的增加、修改
......
......@@ -39,8 +39,8 @@ public class ServiceHGSC013 extends ServiceEPBase {
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
if (queryMap.containsKey("contractDate")){
queryMap.put("contractDate", DateUtils.formatShort(queryMap.get("contractDate")));
if (queryMap.containsKey("receiptDate")){
queryMap.put("receiptDate", DateUtils.formatShort(queryMap.get("receiptDate")));
}
List<Map> list = DaoBase.getInstance().query("HGSC013.query", queryMap);
inInfo.set(EiConstant.resultBlock, list);
......
......@@ -4,150 +4,179 @@
<select id="query" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
select
h.company_code as "companyCode", <!-- 公司编码(预留) -->
h.company_name as "companyName", <!-- 公司名称(预留) -->
h.proj_code as "projCode", <!-- 项目编码(预留) -->
h.proj_name as "projName", <!-- 项目名称(预留) -->
ha.product_code as "productCode", <!-- 产品编号 -->
ha.product_name as "productName", <!-- 产品名称 -->
ha.spec as "spec", <!-- 规格 -->
ha.length as "length", <!-- 长 -->
ha.width as "width", <!-- 宽 -->
ha.thick as "thick", <!-- 厚 -->
ha.quantity as "quantity", <!-- 数量 -->
ha.single_weight as "singleWeight", <!-- 单重 -->
ha.total_weight as "totalWeight", <!-- 总重 -->
ha.DEPOSIT_DATE as "depositDate", <!-- 入库日期 -->
ha.INV_QTY as "invQty", <!-- 数量 -->
ha.INV_UNIT_WEIGHT as "invUnitWeight", <!-- 单重 -->
ha.INV_WEIGHT as "invWeight", <!-- 重量 -->
hb.product_code as "clproductCode" , <!-- 产品编号 -->
hb.product_name as "clproductName", <!-- 产品名称 -->
hb.spec as "clspec", <!-- 规格 -->
hb.length as "cllength", <!-- 长 -->
hb.width as "clwidth", <!-- 宽 -->
hb.thick as "clthick", <!-- 厚 -->
hb.quantity as "clquantity", <!-- 数量 -->
hb.total_weight as "cltotalWeight", <!-- 总重 -->
hb.RECEIPT_DATE as "receiptDate", <!-- 领料日期 -->
hb.INV_QTY as "llinvQty", <!-- 数量 -->
hb.INV_WEIGHT as "llinvWeight" <!-- 重量 -->
from hggp.hgsc004 h
join (
select
h.id , <!-- 主键 -->
h.company_code , <!-- 公司编码(预留) -->
h.company_name , <!-- 公司名称(预留) -->
h.proj_code , <!-- 项目编码(预留) -->
h.proj_name , <!-- 项目名称(预留) -->
h.parent_prod_code , <!-- 父节点-产品编码 -->
h.parent_prod_name , <!-- 父节点-产品名称 -->
h.material_id , <!-- 物料清单id -->
h.product_id , <!-- 产品id -->
h.product_type , <!-- 产品类别 -->
h.product_code , <!-- 产品编号 -->
h.product_name , <!-- 产品名称 -->
h.invent_type , <!-- 档案类型 -->
h.spec , <!-- 规格 -->
h.length , <!-- 长 -->
h.width , <!-- 宽 -->
h.thick , <!-- 厚 -->
h.quantity , <!-- 数量 -->
h.single_weight , <!-- 单重 -->
h.total_weight , <!-- 总重 -->
h.approval_status , <!-- 审批状态 0:待审;1:审核中;2:已审 -->
h.leaf , <!-- 是否有叶子节点 -->
h.sort , <!-- 排序字段 -->
h.lv , <!-- 层级 -->
k.DEPOSIT_DATE , <!-- 入库日期 -->
k.INV_QTY , <!-- 数量 -->
k.INV_UNIT_WEIGHT , <!-- 单重 -->
k.INV_WEIGHT <!-- 重量 -->
from hggp.hgsc004a h
left join hggp.hgkc003 k on h.company_code = k.COMPANY_CODE and h.proj_code = k.PROJ_CODE
and h.product_code = k.PRDT_CODE
and k.DELETE_FLAG = 0
where h.product_status = 1 and h.lv = 3
<isNotEmpty prepend=" AND " property="accountCode">
h.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
h.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
h.COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
h.proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
h.proj_name = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productCode">
h.product_code = #productCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositDate">
k.DEPOSIT_DATE = #depositDate#
</isNotEmpty>
) ha on h.id = ha.material_id
join (
select
h.id ,<!-- 主键 -->
h.company_code ,<!-- 公司编码(预留) -->
h.company_name ,<!-- 公司名称(预留) -->
h.proj_code ,<!-- 项目编码(预留) -->
h.proj_name ,<!-- 项目名称(预留) -->
h.parent_prod_code ,<!-- 父节点-产品编码 -->
h.parent_prod_name ,<!-- 父节点-产品名称 -->
h.material_id ,<!-- 物料清单id -->
h.product_id ,<!-- 产品id -->
h.product_type ,<!-- 产品类别 -->
h.product_code ,<!-- 产品编号 -->
h.product_name ,<!-- 产品名称 -->
h.invent_type ,<!-- 档案类型 -->
h.spec ,<!-- 规格 -->
h.length ,<!-- 长 -->
h.width ,<!-- 宽 -->
h.thick ,<!-- 厚 -->
h.quantity ,<!-- 数量 -->
h.single_weight ,<!-- 单重 -->
h.total_weight ,<!-- 总重 -->
h.approval_status ,<!-- 审批状态 0:待审;1:审核中;2:已审 -->
h.leaf ,<!-- 是否有叶子节点 -->
h.sort ,<!-- 排序字段 -->
h.lv , <!-- 层级 -->
k.RECEIPT_DATE ,<!-- 入库日期 -->
k.INV_QTY ,<!-- 数量 -->
k.INV_WEIGHT<!-- 重量 -->
from hggp.hgsc004a h
left join (
ha.company_code as "companyCode",
ha.company_name as "companyName",
ha.proj_code as "projCode",
ha.proj_name as "projName",
ha.product_code as "productCode",
ha.product_name as "productName",
ha.spec as "spec",
ha.length as "length",
ha.width as "width",
ha.thick as "thick",
ha.quantity as "quantity",
ha.single_weight as "singleWeight",
ha.total_weight as "totalWeight",
ha.DEPOSIT_DATE as "depositDate",
ha.INV_QTY as "invQty",
ha.INV_UNIT_WEIGHT as "invUnitWeight",
ha.INV_WEIGHT as "invWeight",
hb.product_code as "clproductCode" ,
hb.product_name as "clproductName",
hb.spec as "clspec",
hb.length as "cllength",
hb.width as "clwidth",
hb.thick as "clthick",
hb.quantity as "clquantity",
hb.total_weight as "cltotalWeight",
hb.RECEIPT_DATE as "receiptDate",
hb.INV_QTY as "llinvQty",
hb.INV_WEIGHT as "llinvWeight",
case when ifnull(ha.INV_WEIGHT,0)>0 and ifnull(hb.INV_WEIGHT,0)>0 then round((ifnull(ha.INV_WEIGHT,0)*1.0000) / (ifnull(hb.INV_WEIGHT,0)* 1.0000),4)*100 else 0 end "ccl"
from
(
select
k.COMPANY_CODE ,
k.PROJ_CODE ,
k1.RECEIPT_DATE ,<!-- 入库日期 -->
k.INVENT_CODE ,
sum(k.INV_QTY) as INV_QTY,<!-- 数量 -->
sum(k.INV_WEIGHT) as INV_WEIGHT<!-- 重量 -->
from hggp.hgkc008a k
join hggp.hgkc008 k1 on k.RECEIVE_ID = k1.id
where k.DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="accountCode">
k.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
k.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
k.COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
k.RECEIPT_DATE = #receiptDate#
</isNotEmpty>
group by k.COMPANY_CODE, k.PROJ_CODE, k1.RECEIPT_DATE, k.INVENT_CODE
) k on h.company_code = k.COMPANY_CODE
and h.proj_code = k.PROJ_CODE
and h.product_code = k.INVENT_CODE
where h.lv = 4 and h.product_status = 1
h.id ,
h.company_code ,
h.company_name ,
h.proj_code ,
h.proj_name ,
h.parent_prod_code ,
h.parent_prod_name ,
h.material_id ,
h.product_id ,
h.product_type ,
h.product_code ,
h.product_name ,
h.invent_type ,
h.spec ,
h.length ,
h.width ,
h.thick ,
h.quantity ,
h.single_weight ,
h.total_weight ,
h.approval_status ,
h.leaf ,
h.sort ,
h.lv ,
k.DEPOSIT_DATE ,
k.MAT_ID ,
k.INV_QTY ,
k.INV_UNIT_WEIGHT ,
k.INV_WEIGHT
from
hggp.hgsc004a h
left join hggp.hgkc003 k on
h.company_code = k.COMPANY_CODE
and h.proj_code = k.PROJ_CODE
and h.material_id = k.MAT_ID
and h.product_code = k.PRDT_CODE
and k.DELETE_FLAG = 0
and h.lv = 3
and h.product_status = 1
where 1=1
<isNotEmpty prepend=" AND " property="accountCode">
h.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
h.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
h.COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
h.proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
h.proj_name = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productCode">
h.product_code = #productCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositDate">
k.DEPOSIT_DATE = #depositDate#
</isNotEmpty>
) ha
join (
select
h.id ,
h.company_code ,
h.company_name ,
h.proj_code ,
h.proj_name ,
h.parent_prod_code ,
h.parent_prod_name ,
h.material_id ,
h.product_id ,
h.product_type ,
h.product_code ,
h.product_name ,
h.invent_type ,
h.spec ,
h.length ,
h.width ,
h.thick ,
h.quantity ,
h.single_weight ,
h.total_weight ,
h.approval_status ,
h.leaf ,
h.sort ,
h.lv ,
k.RECEIPT_DATE ,
k.MAT_ID ,
k.INV_QTY ,
k.INV_WEIGHT
from
hggp.hgsc004a h
left join (
select
k.COMPANY_CODE ,
k.PROJ_CODE ,
k.INVENT_CODE ,
k.MAT_ID,
k.MAT_DETAIL_ID,
k1.RECEIPT_DATE ,
sum(k.INV_QTY) as INV_QTY,
sum(k.INV_WEIGHT) as INV_WEIGHT
from
hggp.hgkc008a k
join hggp.hgkc008 k1 on
k.RECEIVE_ID = k1.id
where
k.DELETE_FLAG = 0
and k1.status = '1'
<isNotEmpty prepend=" AND " property="accountCode">
k.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
k.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
k.COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
k.RECEIPT_DATE = #receiptDate#
</isNotEmpty>
group by
k.COMPANY_CODE,
k.PROJ_CODE,
k1.RECEIPT_DATE,
k.INVENT_CODE ,
k.MAT_ID,
k.MAT_DETAIL_ID
) k on
h.company_code = k.COMPANY_CODE
and h.proj_code = k.PROJ_CODE
and h.product_code = k.INVENT_CODE
and h.material_id = k.MAT_ID
and h.ID = K.MAT_DETAIL_ID
and h.lv = 4
and h.product_status = 1
where 1=1
<isNotEmpty prepend=" AND " property="accountCode">
h.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
......@@ -160,8 +189,12 @@
<isNotEmpty prepend=" AND " property="inventCode">
h.product_code = #inventCode#
</isNotEmpty>
) hb on h.id = hb.material_id and ha.product_code = hb.parent_prod_code
order by h.id desc
) hb on
ha.company_code = hb.COMPANY_CODE
and ha.proj_code = hb.PROJ_CODE
and ha.product_code = hb.parent_prod_code
order by
ha.id desc
</select>
</sqlMap>
\ No newline at end of file
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