rev:配粉开单时,软废库存选择根据产品对应PG粉维护的库存等级去选择
This commit is contained in:
@@ -164,10 +164,12 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
JSONArray ivts = new JSONArray();
|
JSONArray ivts = new JSONArray();
|
||||||
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
|
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
|
||||||
.addParam("mater_ids",allmaterialId)
|
.addParam("mater_ids",allmaterialId)
|
||||||
|
.addParam("product_material_id",material_id)
|
||||||
|
.addParam("set_type","01")
|
||||||
.addParam("is_active",value_is_active)
|
.addParam("is_active",value_is_active)
|
||||||
.addParam("quality_scode","02")
|
.addParam("quality_scode","02")
|
||||||
.addParam("workorder_id",workorder_id)
|
.addParam("workorder_id",workorder_id)
|
||||||
.addParam("flag","22")
|
.addParam("flag","23")
|
||||||
.process().getResultJSONArray(0);
|
.process().getResultJSONArray(0);
|
||||||
for(int j=0;j<now_ivts.size();j++){
|
for(int j=0;j<now_ivts.size();j++){
|
||||||
JSONObject jo = now_ivts.getJSONObject(j);
|
JSONObject jo = now_ivts.getJSONObject(j);
|
||||||
@@ -1607,10 +1609,12 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
for(int i=0;i<MaterialSets.size();i++){
|
for(int i=0;i<MaterialSets.size();i++){
|
||||||
JSONObject MaterialSet = MaterialSets.getJSONObject(i);
|
JSONObject MaterialSet = MaterialSets.getJSONObject(i);
|
||||||
String set_material_id = MaterialSet.getString("set_material_id");
|
String set_material_id = MaterialSet.getString("set_material_id");
|
||||||
|
String set_prior_level = MaterialSet.getString("set_prior_level");
|
||||||
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
|
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
|
||||||
.addParam("material_id",set_material_id)
|
.addParam("material_id",set_material_id)
|
||||||
.addParam("workorder_id",workorder_id)
|
.addParam("workorder_id",workorder_id)
|
||||||
.addParam("is_active",value_is_active)
|
.addParam("is_active",value_is_active)
|
||||||
|
.addParam("set_prior_level",set_prior_level)
|
||||||
.addParam("quality_scode","02")
|
.addParam("quality_scode","02")
|
||||||
.addParam("flag","22")
|
.addParam("flag","22")
|
||||||
.process().getResultJSONArray(0);
|
.process().getResultJSONArray(0);
|
||||||
@@ -2935,9 +2939,11 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
|
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
|
||||||
.addParam("mater_ids",allmaterialId)
|
.addParam("mater_ids",allmaterialId)
|
||||||
.addParam("is_active",value_is_active)
|
.addParam("is_active",value_is_active)
|
||||||
|
.addParam("product_material_id",material_id)
|
||||||
|
.addParam("set_type","02")
|
||||||
.addParam("quality_scode","02")
|
.addParam("quality_scode","02")
|
||||||
.addParam("workorder_id",workorder_id)
|
.addParam("workorder_id",workorder_id)
|
||||||
.addParam("flag","22")
|
.addParam("flag","23")
|
||||||
.process().getResultJSONArray(0);
|
.process().getResultJSONArray(0);
|
||||||
for(int j=0;j<now_ivts.size();j++){
|
for(int j=0;j<now_ivts.size();j++){
|
||||||
JSONObject jo = now_ivts.getJSONObject(j);
|
JSONObject jo = now_ivts.getJSONObject(j);
|
||||||
@@ -3294,9 +3300,11 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
for(int i=0;i<MaterialSets.size();i++){
|
for(int i=0;i<MaterialSets.size();i++){
|
||||||
JSONObject MaterialSet = MaterialSets.getJSONObject(i);
|
JSONObject MaterialSet = MaterialSets.getJSONObject(i);
|
||||||
String set_material_id = MaterialSet.getString("set_material_id");
|
String set_material_id = MaterialSet.getString("set_material_id");
|
||||||
|
String set_prior_level = MaterialSet.getString("set_prior_level");
|
||||||
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
|
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
|
||||||
.addParam("material_id",set_material_id)
|
.addParam("material_id",set_material_id)
|
||||||
.addParam("is_active",value_is_active)
|
.addParam("is_active",value_is_active)
|
||||||
|
.addParam("set_prior_level",set_prior_level)
|
||||||
.addParam("quality_scode","02")
|
.addParam("quality_scode","02")
|
||||||
.addParam("workorder_id",workorder_id)
|
.addParam("workorder_id",workorder_id)
|
||||||
.addParam("flag","22")
|
.addParam("flag","22")
|
||||||
@@ -4617,9 +4625,11 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
|
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
|
||||||
.addParam("mater_ids",allmaterialId)
|
.addParam("mater_ids",allmaterialId)
|
||||||
.addParam("is_active",value_is_active)
|
.addParam("is_active",value_is_active)
|
||||||
|
.addParam("product_material_id",material_id)
|
||||||
|
.addParam("set_type","02")
|
||||||
.addParam("quality_scode","02")
|
.addParam("quality_scode","02")
|
||||||
.addParam("workorder_id",workorder_id)
|
.addParam("workorder_id",workorder_id)
|
||||||
.addParam("flag","9")
|
.addParam("flag","92")
|
||||||
.process().getResultJSONArray(0);
|
.process().getResultJSONArray(0);
|
||||||
|
|
||||||
for(int j=0;j<now_ivts.size();j++){
|
for(int j=0;j<now_ivts.size();j++){
|
||||||
@@ -5007,9 +5017,11 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
for(int i=0;i<MaterialSets.size();i++){
|
for(int i=0;i<MaterialSets.size();i++){
|
||||||
JSONObject MaterialSet = MaterialSets.getJSONObject(i);
|
JSONObject MaterialSet = MaterialSets.getJSONObject(i);
|
||||||
String set_material_id = MaterialSet.getString("set_material_id");
|
String set_material_id = MaterialSet.getString("set_material_id");
|
||||||
|
String set_prior_level = MaterialSet.getString("set_prior_level");
|
||||||
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
|
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
|
||||||
.addParam("material_id",set_material_id)
|
.addParam("material_id",set_material_id)
|
||||||
.addParam("is_active",value_is_active)
|
.addParam("is_active",value_is_active)
|
||||||
|
.addParam("set_prior_level",set_prior_level)
|
||||||
.addParam("quality_scode","02")
|
.addParam("quality_scode","02")
|
||||||
.addParam("workorder_id",workorder_id)
|
.addParam("workorder_id",workorder_id)
|
||||||
.addParam("flag","9")
|
.addParam("flag","9")
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
输入.material_code TYPEAS s_string
|
输入.material_code TYPEAS s_string
|
||||||
输入.is_need_manage TYPEAS s_string
|
输入.is_need_manage TYPEAS s_string
|
||||||
输入.formingtype_id TYPEAS s_string
|
输入.formingtype_id TYPEAS s_string
|
||||||
|
输入.product_material_id TYPEAS s_string
|
||||||
输入.item_material_id TYPEAS s_string
|
输入.item_material_id TYPEAS s_string
|
||||||
输入.is_active TYPEAS s_string
|
输入.is_active TYPEAS s_string
|
||||||
输入.workorder_id TYPEAS s_string
|
输入.workorder_id TYPEAS s_string
|
||||||
@@ -29,6 +30,7 @@
|
|||||||
输入.is_pure TYPEAS s_string
|
输入.is_pure TYPEAS s_string
|
||||||
输入.set_type TYPEAS s_string
|
输入.set_type TYPEAS s_string
|
||||||
输入.set_material_id TYPEAS s_string
|
输入.set_material_id TYPEAS s_string
|
||||||
|
输入.set_prior_level TYPEAS s_string
|
||||||
输入.material_type_id TYPEAS f_string
|
输入.material_type_id TYPEAS f_string
|
||||||
输入.mater_ids TYPEAS f_string
|
输入.mater_ids TYPEAS f_string
|
||||||
|
|
||||||
@@ -179,6 +181,105 @@
|
|||||||
AND FormulaDtl3.ivt_level = structivt.ivt_level
|
AND FormulaDtl3.ivt_level = structivt.ivt_level
|
||||||
AND FormulaDtl3.quality_scode = structivt.quality_scode
|
AND FormulaDtl3.quality_scode = structivt.quality_scode
|
||||||
)
|
)
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
|
AND structivt.sum_qty > 0
|
||||||
|
OPTION 输入.material_id <> ""
|
||||||
|
structivt.material_id = 输入.material_id
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.mater_ids <> ""
|
||||||
|
structivt.material_id in 输入.mater_ids
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.is_active <> ""
|
||||||
|
structivt.is_active = 输入.is_active
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.quality_scode <> ""
|
||||||
|
structivt.quality_scode = 输入.quality_scode
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.prior_level <> ""
|
||||||
|
structivt.ivt_level <= 输入.prior_level
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.set_prior_level <> ""
|
||||||
|
structivt.ivt_level = 输入.set_prior_level
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.is_pure <> ""
|
||||||
|
stockmaterialext.is_pure = 输入.is_pure
|
||||||
|
ENDOPTION
|
||||||
|
ORDER BY structivt.material_id,structivt.ivt_level desc, structivt.pcsn, structivt.sum_qty desc
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "23"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
structivt.*,
|
||||||
|
mb.material_name,
|
||||||
|
mb.material_code,
|
||||||
|
mb.material_type_id,
|
||||||
|
stockmaterialext.is_need_move,
|
||||||
|
CASE
|
||||||
|
|
||||||
|
WHEN FormulaDtl3.used__qty > 0 THEN
|
||||||
|
structivt.sum_qty - FormulaDtl3.used__qty ELSE structivt.sum_qty
|
||||||
|
END AS sum_ivt_qty
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
SUM( ivt.canuse_qty ) AS sum_qty,
|
||||||
|
ivt.qty_unit_id,
|
||||||
|
ivt.qty_unit_name,
|
||||||
|
ivt.material_id,
|
||||||
|
ivt.pcsn,
|
||||||
|
ivt.is_active,
|
||||||
|
ivt.ivt_level,
|
||||||
|
ivt.quality_scode
|
||||||
|
FROM
|
||||||
|
st_ivt_structivt ivt
|
||||||
|
INNER JOIN (
|
||||||
|
SELECT * FROM md_pd_productmaterialset ms WHERE ms.material_id = 输入.product_material_id AND ms.set_type = 输入.set_type
|
||||||
|
) a ON ivt.material_id = a.set_material_id AND ivt.ivt_level = a.set_prior_level
|
||||||
|
GROUP BY
|
||||||
|
ivt.material_id,
|
||||||
|
ivt.pcsn,
|
||||||
|
ivt.is_active,
|
||||||
|
ivt.ivt_level,
|
||||||
|
ivt.quality_scode,
|
||||||
|
ivt.qty_unit_id,
|
||||||
|
ivt.qty_unit_name
|
||||||
|
) structivt
|
||||||
|
LEFT JOIN md_me_materialbase mb ON mb.material_id = structivt.material_id
|
||||||
|
LEFT JOIN md_me_stockmaterialext stockmaterialext ON mb.material_id = stockmaterialext.material_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
SUM( FormulaDtl2.formula_qty - FormulaDtl2.put_qty ) AS used__qty,
|
||||||
|
FormulaDtl2.material_id,
|
||||||
|
FormulaDtl2.pcsn,
|
||||||
|
FormulaDtl2.is_active,
|
||||||
|
FormulaDtl2.ivt_level,
|
||||||
|
FormulaDtl2.quality_scode
|
||||||
|
FROM
|
||||||
|
PDM_BI_FormulaDtl FormulaDtl2
|
||||||
|
LEFT JOIN PDM_BI_Formula Formula2 ON FormulaDtl2.formula_id = Formula2.formula_id
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
|
AND FormulaDtl2.STATUS <> '99'
|
||||||
|
OPTION 输入.workorder_id <> ""
|
||||||
|
Formula2.workorder_id <> 输入.workorder_id
|
||||||
|
ENDOPTION
|
||||||
|
GROUP BY
|
||||||
|
FormulaDtl2.material_id,
|
||||||
|
FormulaDtl2.pcsn,
|
||||||
|
FormulaDtl2.is_active,
|
||||||
|
FormulaDtl2.ivt_level,
|
||||||
|
FormulaDtl2.quality_scode
|
||||||
|
) FormulaDtl3 ON (
|
||||||
|
FormulaDtl3.material_id = structivt.material_id
|
||||||
|
AND FormulaDtl3.pcsn = structivt.pcsn
|
||||||
|
AND FormulaDtl3.is_active = structivt.is_active
|
||||||
|
AND FormulaDtl3.ivt_level = structivt.ivt_level
|
||||||
|
AND FormulaDtl3.quality_scode = structivt.quality_scode
|
||||||
|
)
|
||||||
WHERE
|
WHERE
|
||||||
1 = 1
|
1 = 1
|
||||||
AND structivt.sum_qty > 0
|
AND structivt.sum_qty > 0
|
||||||
@@ -459,6 +560,104 @@
|
|||||||
AND FormulaDtl3.ivt_level = structivt.ivt_level
|
AND FormulaDtl3.ivt_level = structivt.ivt_level
|
||||||
AND FormulaDtl3.quality_scode = structivt.quality_scode
|
AND FormulaDtl3.quality_scode = structivt.quality_scode
|
||||||
)
|
)
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
|
AND structivt.sum_qty > 0
|
||||||
|
OPTION 输入.material_id <> ""
|
||||||
|
structivt.material_id = 输入.material_id
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.mater_ids <> ""
|
||||||
|
structivt.material_id in 输入.mater_ids
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.is_active <> ""
|
||||||
|
structivt.is_active = 输入.is_active
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.quality_scode <> ""
|
||||||
|
structivt.quality_scode = 输入.quality_scode
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.prior_level <> ""
|
||||||
|
structivt.ivt_level <= 输入.prior_level
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.set_prior_level <> ""
|
||||||
|
structivt.ivt_level = 输入.set_prior_level
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.is_pure <> ""
|
||||||
|
stockmaterialext.is_pure = 输入.is_pure
|
||||||
|
ENDOPTION
|
||||||
|
ORDER BY structivt.material_id,structivt.ivt_level desc, sum_ivt_qty
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "92"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
structivt.*,
|
||||||
|
mb.material_name,
|
||||||
|
mb.material_code,
|
||||||
|
mb.material_type_id,
|
||||||
|
stockmaterialext.is_need_move,
|
||||||
|
CASE
|
||||||
|
WHEN FormulaDtl3.used__qty > 0 THEN
|
||||||
|
structivt.sum_qty - FormulaDtl3.used__qty ELSE structivt.sum_qty
|
||||||
|
END AS sum_ivt_qty
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
SUM( ivt.canuse_qty ) AS sum_qty,
|
||||||
|
ivt.qty_unit_id,
|
||||||
|
ivt.qty_unit_name,
|
||||||
|
ivt.material_id,
|
||||||
|
ivt.pcsn,
|
||||||
|
ivt.is_active,
|
||||||
|
ivt.ivt_level,
|
||||||
|
ivt.quality_scode
|
||||||
|
FROM
|
||||||
|
st_ivt_structivt ivt
|
||||||
|
INNER JOIN (
|
||||||
|
SELECT * FROM md_pd_productmaterialset ms WHERE ms.material_id = 输入.product_material_id AND ms.set_type = 输入.set_type
|
||||||
|
) a ON ivt.material_id = a.set_material_id AND ivt.ivt_level = a.set_prior_level
|
||||||
|
GROUP BY
|
||||||
|
ivt.material_id,
|
||||||
|
ivt.pcsn,
|
||||||
|
ivt.is_active,
|
||||||
|
ivt.ivt_level,
|
||||||
|
ivt.quality_scode,
|
||||||
|
ivt.qty_unit_id,
|
||||||
|
ivt.qty_unit_name
|
||||||
|
) structivt
|
||||||
|
LEFT JOIN md_me_materialbase mb ON mb.material_id = structivt.material_id
|
||||||
|
LEFT JOIN md_me_stockmaterialext stockmaterialext ON mb.material_id = stockmaterialext.material_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
SUM( FormulaDtl2.formula_qty - FormulaDtl2.put_qty ) AS used__qty,
|
||||||
|
FormulaDtl2.material_id,
|
||||||
|
FormulaDtl2.pcsn,
|
||||||
|
FormulaDtl2.is_active,
|
||||||
|
FormulaDtl2.ivt_level,
|
||||||
|
FormulaDtl2.quality_scode
|
||||||
|
FROM
|
||||||
|
PDM_BI_FormulaDtl FormulaDtl2
|
||||||
|
LEFT JOIN PDM_BI_Formula Formula2 ON FormulaDtl2.formula_id = Formula2.formula_id
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
|
AND FormulaDtl2.STATUS <> '99'
|
||||||
|
OPTION 输入.workorder_id <> ""
|
||||||
|
Formula2.workorder_id <> 输入.workorder_id
|
||||||
|
ENDOPTION
|
||||||
|
GROUP BY
|
||||||
|
FormulaDtl2.material_id,
|
||||||
|
FormulaDtl2.pcsn,
|
||||||
|
FormulaDtl2.is_active,
|
||||||
|
FormulaDtl2.ivt_level,
|
||||||
|
FormulaDtl2.quality_scode
|
||||||
|
) FormulaDtl3 ON (
|
||||||
|
FormulaDtl3.material_id = structivt.material_id
|
||||||
|
AND FormulaDtl3.pcsn = structivt.pcsn
|
||||||
|
AND FormulaDtl3.is_active = structivt.is_active
|
||||||
|
AND FormulaDtl3.ivt_level = structivt.ivt_level
|
||||||
|
AND FormulaDtl3.quality_scode = structivt.quality_scode
|
||||||
|
)
|
||||||
WHERE
|
WHERE
|
||||||
1 = 1
|
1 = 1
|
||||||
AND structivt.sum_qty > 0
|
AND structivt.sum_qty > 0
|
||||||
|
|||||||
Reference in New Issue
Block a user