rev:成品日报更新
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package org.nl.system.service.param;
|
||||
|
||||
import com.alicp.jetcache.anno.CacheType;
|
||||
import com.alicp.jetcache.anno.CacheUpdate;
|
||||
import com.alicp.jetcache.anno.Cached;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -39,6 +42,7 @@ public interface ISysParamService extends IService<Param> {
|
||||
*
|
||||
* @param param
|
||||
*/
|
||||
@CacheUpdate(name = "paramDataCode.", key = "#param.code", value = "#param")
|
||||
void update(Param param);
|
||||
|
||||
/**
|
||||
@@ -54,5 +58,6 @@ public interface ISysParamService extends IService<Param> {
|
||||
* @param code code
|
||||
* @return Param
|
||||
*/
|
||||
@Cached(name = "paramDataCode.", key = "#code", expire = 3600, cacheType = CacheType.REMOTE)
|
||||
Param findByCode(String code);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.system.service.param.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -40,6 +41,10 @@ public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> impl
|
||||
@Override
|
||||
public Page<Param> queryPage(Map whereJson, PageQuery page) {
|
||||
QueryWrapper<Param> queryWrapper = new QueryWrapper<>();
|
||||
String code = MapUtil.getStr(whereJson, "code");
|
||||
if (ObjectUtil.isNotEmpty(code)) {
|
||||
queryWrapper.likeRight("code", code).or().likeRight("name", code);
|
||||
}
|
||||
queryWrapper.orderBy(true, true, "create_time");
|
||||
Page<Param> paramPage = paramMapper.selectPage(page.build(), queryWrapper);
|
||||
return paramPage;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.customer_name TYPEAS f_string
|
||||
输入.storIds TYPEAS f_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
@@ -966,29 +967,10 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "19"
|
||||
QUERY
|
||||
SELECT
|
||||
SUM( ivt.canuse_qty ) / 1000 AS num,
|
||||
sub.customer_name
|
||||
FROM
|
||||
st_ivt_structivt ivt
|
||||
LEFT JOIN st_ivt_structattr attr ON ivt.struct_id = attr.struct_id
|
||||
INNER JOIN pdm_bi_subpackagerelationrecord sub ON sub.container_name = ivt.pcsn AND sub.package_box_sn = attr.storagevehicle_code
|
||||
WHERE
|
||||
ivt.canuse_qty > '0'
|
||||
|
||||
GROUP BY sub.customer_name
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "20"
|
||||
QUERY
|
||||
SELECT
|
||||
SUM( dis.plan_qty ) / 1000 AS num,
|
||||
sub.customer_name
|
||||
SUM( dis.plan_qty ) / 1000 AS num
|
||||
FROM
|
||||
( SELECT
|
||||
MIN( a.iostorinvdis_id ) AS iostorinvdis_id
|
||||
@@ -1008,7 +990,6 @@
|
||||
) AS a
|
||||
LEFT JOIN st_ivt_iostorinvdis dis ON dis.iostorinvdis_id = a.iostorinvdis_id
|
||||
LEFT JOIN st_ivt_iostorinv mst ON dis.iostorinv_id = mst.iostorinv_id
|
||||
INNER JOIN pdm_bi_subpackagerelationrecord sub ON sub.container_name = dis.pcsn AND sub.package_box_sn = dis.box_no AND sub.bill_id = dis.iostorinv_id
|
||||
LEFT JOIN st_ivt_structattr attr ON attr.struct_id = dis.struct_id
|
||||
|
||||
WHERE
|
||||
@@ -1020,8 +1001,28 @@
|
||||
AND CONCAT(DATE_FORMAT(NOW(), '%Y-%m-01'), ' 08:00:00') <= mst.confirm_time
|
||||
AND NOW() >= mst.confirm_time
|
||||
|
||||
GROUP BY sub.customer_name
|
||||
OPTION 输入.storIds <> ""
|
||||
mst.stor_id in 输入.storIds
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "19"
|
||||
QUERY
|
||||
SELECT
|
||||
SUM( ivt.canuse_qty ) / 1000 AS num
|
||||
FROM
|
||||
st_ivt_structivt ivt
|
||||
LEFT JOIN st_ivt_structattr attr ON ivt.struct_id = attr.struct_id
|
||||
WHERE
|
||||
ivt.canuse_qty > '0'
|
||||
|
||||
OPTION 输入.storIds <> ""
|
||||
attr.stor_id in 输入.storIds
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -459,30 +459,69 @@ public class AutoQueryProudDayData {
|
||||
String end_date = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("END_DATE").getValue();
|
||||
String nowDay = DateUtil.today().substring(8, 10);
|
||||
|
||||
if (end_date.equals(nowDay)) {
|
||||
if (Double.parseDouble(end_date) <= Double.parseDouble(nowDay)) {
|
||||
JSONArray Arrayobject6 = new JSONArray();
|
||||
|
||||
// 当日实时库存,根据客户分组
|
||||
List<JSONObject> todayCustIvtList = WQL.getWO("AUTOQUERYBILLINFO").addParam("flag", "19")
|
||||
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
// 所有仓库
|
||||
List<JSONObject> storAllArr = storTab.query("is_used = '1'").getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
// 当月入库量(调拨入库:默认1-21号),根据客户分组
|
||||
List<JSONObject> monthCustIvtList = WQL.getWO("AUTOQUERYBILLINFO").addParam("flag", "20")
|
||||
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
// B公司
|
||||
String in_B = storAllArr.stream()
|
||||
.filter(row -> row.getString("remark").equals("B"))
|
||||
.map(row -> row.getString("stor_id"))
|
||||
.collect(Collectors.joining("','"));
|
||||
|
||||
// C公司
|
||||
String in_C = storAllArr.stream()
|
||||
.filter(row -> row.getString("remark").equals("C"))
|
||||
.map(row -> row.getString("stor_id"))
|
||||
.collect(Collectors.joining("','"));
|
||||
|
||||
// B公司当前库存
|
||||
JSONObject jsonIvtB = WQL.getWO("AUTOQUERYBILLINFO").addParam("flag", "19").addParam("storIds", "('" + in_B + "')")
|
||||
.process().uniqueResult(0);
|
||||
|
||||
// C公司当前库存
|
||||
JSONObject jsonIvtC = WQL.getWO("AUTOQUERYBILLINFO").addParam("flag", "19").addParam("storIds", "('" + in_C + "')")
|
||||
.process().uniqueResult(0);
|
||||
|
||||
// B公司当月调拨入库
|
||||
JSONObject monthInB = WQL.getWO("AUTOQUERYBILLINFO").addParam("flag", "20").addParam("storIds", "('" + in_B + "')")
|
||||
.process().uniqueResult(0);
|
||||
|
||||
// C公司当月调拨入库
|
||||
JSONObject monthInC = WQL.getWO("AUTOQUERYBILLINFO").addParam("flag", "20").addParam("storIds", "('" + in_C + "')")
|
||||
.process().uniqueResult(0);
|
||||
|
||||
// ---- B公司 ----
|
||||
JSONObject CorpB = upMonthIvt(custB, todayCustIvtList, monthCustIvtList);
|
||||
JSONObject CorpB = upMonthIvt(jsonIvtB, monthInB);
|
||||
CorpB.put("Customer1", "B库存");
|
||||
Arrayobject6.add(CorpB);
|
||||
|
||||
// ---- C公司 ----
|
||||
JSONObject CorpC = upMonthIvt(custC, todayCustIvtList, monthCustIvtList);
|
||||
JSONObject CorpC = upMonthIvt(jsonIvtC,monthInC);
|
||||
CorpC.put("Customer1", "C库存");
|
||||
Arrayobject6.add(CorpC);
|
||||
|
||||
result.put("Arrayobject6",Arrayobject6);
|
||||
result.put("EndDate", getEndDate());
|
||||
} else {
|
||||
JSONArray Arrayobject6 = new JSONArray();
|
||||
|
||||
// B公司
|
||||
JSONObject CorpB = new JSONObject();
|
||||
CorpB.put("Customer1", "B库存");
|
||||
CorpB.put("Customerqty1", "X");
|
||||
Arrayobject6.add(CorpB);
|
||||
|
||||
// C公司
|
||||
JSONObject CorpC = new JSONObject();
|
||||
CorpC.put("Customer1", "C库存");
|
||||
CorpC.put("Customerqty1", "X");
|
||||
Arrayobject6.add(CorpC);
|
||||
|
||||
result.put("Arrayobject6",Arrayobject6);
|
||||
}
|
||||
result.put("EndDate", getEndDate());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -666,27 +705,16 @@ public class AutoQueryProudDayData {
|
||||
|
||||
|
||||
/**
|
||||
* 上月库存公共方法
|
||||
* @param cust 客户
|
||||
* @param todayCustIvtList 实时库存客户分组
|
||||
* @param monthCustIvtList 当月入库量客户分组
|
||||
*
|
||||
* @param jsonIvtB 实施库存
|
||||
* @param monthInB 当月调拨入库量
|
||||
* @return /
|
||||
*/
|
||||
public JSONObject upMonthIvt(String cust, List<JSONObject> todayCustIvtList, List<JSONObject> monthCustIvtList) {
|
||||
public JSONObject upMonthIvt(JSONObject jsonIvtB,JSONObject monthInB) {
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
double ivtCust = todayCustIvtList.stream()
|
||||
.filter(row -> cust.contains(row.getString("customer_name")))
|
||||
.map(row -> row.getDoubleValue("num"))
|
||||
.reduce(Double::sum).orElse(0.00);
|
||||
|
||||
double inIvtCust = monthCustIvtList.stream()
|
||||
.filter(row -> cust.contains(row.getString("customer_name")))
|
||||
.map(row -> row.getDoubleValue("num"))
|
||||
.reduce(Double::sum).orElse(0.00);
|
||||
|
||||
double subIvt = NumberUtil.sub(ivtCust, inIvtCust);
|
||||
double subIvt = NumberUtil.sub(jsonIvtB.getDoubleValue("num"), monthInB.getDoubleValue("num"));
|
||||
|
||||
result.put("Customerqty1", subIvt > 0 ? NumberUtil.round(subIvt, 2).toString() : "0");
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
LEFT JOIN md_cs_customerbase cust ON cust.cust_code = sub.customer_name
|
||||
WHERE
|
||||
1 = 1
|
||||
and ivt.canuse_qty > 0
|
||||
|
||||
OPTION 输入.stor_id <> ""
|
||||
attr.stor_id = 输入.stor_id
|
||||
|
||||
Reference in New Issue
Block a user