h.company_code as "companyCode", <!-- 公司编码(预留) -->
ha.company_code as "companyCode",
h.company_name as "companyName", <!-- 公司名称(预留) -->
ha.company_name as "companyName",
h.proj_code as "projCode", <!-- 项目编码(预留) -->
ha.proj_code as "projCode",
h.proj_name as "projName", <!-- 项目名称(预留) -->
ha.proj_name as "projName",
ha.product_code as "productCode", <!-- 产品编号 -->
ha.product_code as "productCode",
ha.product_name as "productName", <!-- 产品名称 -->
ha.product_name as "productName",
ha.spec as "spec", <!-- 规格 -->
ha.spec as "spec",
ha.length as "length", <!-- 长 -->
ha.length as "length",
ha.width as "width", <!-- 宽 -->
ha.width as "width",
ha.thick as "thick", <!-- 厚 -->
ha.thick as "thick",
ha.quantity as "quantity", <!-- 数量 -->
ha.quantity as "quantity",
ha.single_weight as "singleWeight", <!-- 单重 -->
ha.single_weight as "singleWeight",
ha.total_weight as "totalWeight", <!-- 总重 -->
ha.total_weight as "totalWeight",
ha.DEPOSIT_DATE as "depositDate", <!-- 入库日期 -->
ha.DEPOSIT_DATE as "depositDate",
ha.INV_QTY as "invQty", <!-- 数量 -->
ha.INV_QTY as "invQty",
ha.INV_UNIT_WEIGHT as "invUnitWeight", <!-- 单重 -->
ha.INV_UNIT_WEIGHT as "invUnitWeight",
ha.INV_WEIGHT as "invWeight", <!-- 重量 -->
ha.INV_WEIGHT as "invWeight",
hb.product_code as "clproductCode" , <!-- 产品编号 -->
hb.product_name as "clproductName", <!-- 产品名称 -->
hb.product_code as "clproductCode" ,
hb.spec as "clspec", <!-- 规格 -->
hb.product_name as "clproductName",
hb.length as "cllength", <!-- 长 -->
hb.spec as "clspec",
hb.width as "clwidth", <!-- 宽 -->
hb.length as "cllength",
hb.thick as "clthick", <!-- 厚 -->
hb.width as "clwidth",
hb.quantity as "clquantity", <!-- 数量 -->
hb.thick as "clthick",
hb.total_weight as "cltotalWeight", <!-- 总重 -->
hb.quantity as "clquantity",
hb.RECEIPT_DATE as "receiptDate", <!-- 领料日期 -->
hb.total_weight as "cltotalWeight",
hb.INV_QTY as "llinvQty", <!-- 数量 -->
hb.INV_WEIGHT as "llinvWeight" <!-- 重量 -->
hb.RECEIPT_DATE as "receiptDate",
from hggp.hgsc004 h
hb.INV_QTY as "llinvQty",
join (
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
select
h.id , <!-- 主键 -->
h.id ,
h.company_code , <!-- 公司编码(预留) -->
h.company_code ,
h.company_name , <!-- 公司名称(预留) -->
h.company_name ,
h.proj_code , <!-- 项目编码(预留) -->
h.proj_code ,
h.proj_name , <!-- 项目名称(预留) -->
h.proj_name ,
h.parent_prod_code , <!-- 父节点-产品编码 -->
h.parent_prod_code ,
h.parent_prod_name , <!-- 父节点-产品名称 -->
h.parent_prod_name ,
h.material_id , <!-- 物料清单id -->
h.material_id ,
h.product_id , <!-- 产品id -->
h.product_id ,
h.product_type , <!-- 产品类别 -->
h.product_type ,
h.product_code , <!-- 产品编号 -->
h.product_code ,
h.product_name , <!-- 产品名称 -->
h.product_name ,
h.invent_type , <!-- 档案类型 -->
h.invent_type ,
h.spec , <!-- 规格 -->
h.spec ,
h.length , <!-- 长 -->
h.length ,
h.width , <!-- 宽 -->
h.width ,
h.thick , <!-- 厚 -->
h.thick ,
h.quantity , <!-- 数量 -->
h.quantity ,
h.single_weight , <!-- 单重 -->
h.single_weight ,
h.total_weight , <!-- 总重 -->
h.total_weight ,
h.approval_status , <!-- 审批状态 0:待审;1:审核中;2:已审 -->
h.approval_status ,
h.leaf , <!-- 是否有叶子节点 -->
h.leaf ,
h.sort , <!-- 排序字段 -->
h.sort ,
h.lv , <!-- 层级 -->
h.lv ,
k.DEPOSIT_DATE , <!-- 入库日期 -->
k.DEPOSIT_DATE ,
k.INV_QTY , <!-- 数量 -->
k.MAT_ID ,
k.INV_UNIT_WEIGHT , <!-- 单重 -->
k.INV_QTY ,
k.INV_WEIGHT <!-- 重量 -->
k.INV_UNIT_WEIGHT ,
from hggp.hgsc004a h
k.INV_WEIGHT
left join hggp.hgkc003 k on h.company_code = k.COMPANY_CODE and h.proj_code = k.PROJ_CODE
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 h.product_code = k.PRDT_CODE
and k.DELETE_FLAG = 0
and k.DELETE_FLAG = 0
where h.product_status = 1 and h.lv = 3
and h.lv = 3
and h.product_status = 1
where 1=1
<isNotEmptyprepend=" AND "property="accountCode">
<isNotEmptyprepend=" AND "property="accountCode">
h.ACCOUNT_CODE = #accountCode#
h.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
</isNotEmpty>
...
@@ -89,48 +99,56 @@
...
@@ -89,48 +99,56 @@
<isNotEmptyprepend=" AND "property="depositDate">
<isNotEmptyprepend=" AND "property="depositDate">
k.DEPOSIT_DATE = #depositDate#
k.DEPOSIT_DATE = #depositDate#
</isNotEmpty>
</isNotEmpty>
) ha on h.id = ha.material_id
) ha
join (
join (
select
select
h.id ,<!-- 主键 -->
h.id ,
h.company_code ,<!-- 公司编码(预留) -->
h.company_code ,
h.company_name ,<!-- 公司名称(预留) -->
h.company_name ,
h.proj_code ,<!-- 项目编码(预留) -->
h.proj_code ,
h.proj_name ,<!-- 项目名称(预留) -->
h.proj_name ,
h.parent_prod_code ,<!-- 父节点-产品编码 -->
h.parent_prod_code ,
h.parent_prod_name ,<!-- 父节点-产品名称 -->
h.parent_prod_name ,
h.material_id ,<!-- 物料清单id -->
h.material_id ,
h.product_id ,<!-- 产品id -->
h.product_id ,
h.product_type ,<!-- 产品类别 -->
h.product_type ,
h.product_code ,<!-- 产品编号 -->
h.product_code ,
h.product_name ,<!-- 产品名称 -->
h.product_name ,
h.invent_type ,<!-- 档案类型 -->
h.invent_type ,
h.spec ,<!-- 规格 -->
h.spec ,
h.length ,<!-- 长 -->
h.length ,
h.width ,<!-- 宽 -->
h.width ,
h.thick ,<!-- 厚 -->
h.thick ,
h.quantity ,<!-- 数量 -->
h.quantity ,
h.single_weight ,<!-- 单重 -->
h.single_weight ,
h.total_weight ,<!-- 总重 -->
h.total_weight ,
h.approval_status ,<!-- 审批状态 0:待审;1:审核中;2:已审 -->
h.approval_status ,
h.leaf ,<!-- 是否有叶子节点 -->
h.leaf ,
h.sort ,<!-- 排序字段 -->
h.sort ,
h.lv , <!-- 层级 -->
h.lv ,
k.RECEIPT_DATE ,<!-- 入库日期 -->
k.RECEIPT_DATE ,
k.INV_QTY ,<!-- 数量 -->
k.MAT_ID ,
k.INV_WEIGHT<!-- 重量 -->
k.INV_QTY ,
from hggp.hgsc004a h
k.INV_WEIGHT
from
hggp.hgsc004a h
left join (
left join (
select
select
k.COMPANY_CODE ,
k.COMPANY_CODE ,
k.PROJ_CODE ,
k.PROJ_CODE ,
k1.RECEIPT_DATE ,<!-- 入库日期 -->
k.INVENT_CODE ,
k.INVENT_CODE ,
sum(k.INV_QTY) as INV_QTY,<!-- 数量 -->
k.MAT_ID,
sum(k.INV_WEIGHT) as INV_WEIGHT<!-- 重量 -->
k.MAT_DETAIL_ID,
from hggp.hgkc008a k
k1.RECEIPT_DATE ,
join hggp.hgkc008 k1 on k.RECEIVE_ID = k1.id
sum(k.INV_QTY) as INV_QTY,
where k.DELETE_FLAG = 0
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'
<isNotEmptyprepend=" AND "property="accountCode">
<isNotEmptyprepend=" AND "property="accountCode">
k.ACCOUNT_CODE = #accountCode#
k.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
</isNotEmpty>
...
@@ -143,11 +161,22 @@
...
@@ -143,11 +161,22 @@
<isNotEmptyprepend=" AND "property="receiptDate">
<isNotEmptyprepend=" AND "property="receiptDate">
k.RECEIPT_DATE = #receiptDate#
k.RECEIPT_DATE = #receiptDate#
</isNotEmpty>
</isNotEmpty>
group by k.COMPANY_CODE, k.PROJ_CODE, k1.RECEIPT_DATE, k.INVENT_CODE
group by
) k on h.company_code = k.COMPANY_CODE
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.proj_code = k.PROJ_CODE
and h.product_code = k.INVENT_CODE
and h.product_code = k.INVENT_CODE
where h.lv = 4 and h.product_status = 1
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
<isNotEmptyprepend=" AND "property="accountCode">
<isNotEmptyprepend=" AND "property="accountCode">
h.ACCOUNT_CODE = #accountCode#
h.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
</isNotEmpty>
...
@@ -160,8 +189,12 @@
...
@@ -160,8 +189,12 @@
<isNotEmptyprepend=" AND "property="inventCode">
<isNotEmptyprepend=" AND "property="inventCode">
h.product_code = #inventCode#
h.product_code = #inventCode#
</isNotEmpty>
</isNotEmpty>
) hb on h.id = hb.material_id and ha.product_code = hb.parent_prod_code