Merge branch 'master' of http://121.40.234.130:8899/root/lanzhouhailiang_one
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package org.nl.wms.autotask;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 自动清除日志(操作日志、异常日志)数据
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class CleanTask {
|
||||
private final ISysParamService paramService;
|
||||
|
||||
public void run() {
|
||||
//delete from sys_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10;
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
int days = Integer.parseInt(paramService.findByCode("task_day").getValue());
|
||||
taskTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
|
||||
|
||||
log.info("自动清理任务执行成功...!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -83,15 +83,6 @@ public class MaterialbaseController {
|
||||
return new ResponseEntity<>(MaterOptTypeEnum.getObj(materOpt_code), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/synchronize")
|
||||
@Log("物料同步")
|
||||
|
||||
//@PreAuthorize("@el.check('materialtype:list')")
|
||||
public ResponseEntity<Object> synchronize(@RequestBody Map whereJson) {
|
||||
materialBaseService.synchronize(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("查询产品系列类型")
|
||||
|
||||
@GetMapping("/getProductSeries")
|
||||
|
||||
@@ -88,8 +88,6 @@ public interface MaterialbaseService {
|
||||
*/
|
||||
JSONObject getMaterOptType(String materOpt_code);
|
||||
|
||||
void synchronize(Map whereJson);
|
||||
|
||||
JSONArray getProductSeries(String parent_class_id);
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ import java.util.Set;
|
||||
@Slf4j
|
||||
public class MaterialbaseServiceImpl implements MaterialbaseService {
|
||||
private final ClassstandardService classstandardService;
|
||||
//private final WmsToErpService wmsToErpService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
@@ -214,12 +213,6 @@ public class MaterialbaseServiceImpl implements MaterialbaseService {
|
||||
return MaterOptTypeEnum.getObj(materOpt_code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronize(Map whereJson) {
|
||||
/* wmsToErpService.getClassInfo(null);
|
||||
wmsToErpService.getMaterialInfo(null);*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getProductSeries(String parent_class_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
|
||||
|
||||
@@ -39,6 +39,7 @@ public class StructivtController {
|
||||
//@PreAuthorize("@el.check('structivt:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page, String[] product_area, String[] ivt_flag) {
|
||||
return new ResponseEntity<>(structivtService.queryAll(whereJson, page, product_area, ivt_flag), HttpStatus.OK);
|
||||
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
|
||||
@@ -28,10 +28,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -541,8 +538,9 @@ public class StructattrServiceImpl implements StructattrService {
|
||||
int createNum = whereJson.getIntValue("num");
|
||||
// 开始生成数
|
||||
int createNum_start = 1;
|
||||
|
||||
// 前缀
|
||||
String prefix = whereJson.getString("prefix");
|
||||
String prefix = "";
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonAttr)) {
|
||||
String struct_code = jsonAttr.getString("struct_code");
|
||||
@@ -559,6 +557,21 @@ public class StructattrServiceImpl implements StructattrService {
|
||||
createNum_start += Integer.parseInt(result);
|
||||
|
||||
prefix = struct_code.substring(0, firstIndex);
|
||||
} else {
|
||||
// 截取第一个 - 之前的数据集合
|
||||
|
||||
List<JSONObject> attrList = WQL.getWO("QST_STRUCT_ATTR").addParam("flag", "2").process()
|
||||
.getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
List<String> subStringList = attrList.stream()
|
||||
.filter(row -> row.getString("struct_code").contains("-"))
|
||||
.map(row -> row.getString("struct_code").substring(0, row.getString("struct_code").indexOf("-")))
|
||||
.distinct()
|
||||
.sorted()
|
||||
.filter(row -> row.matches("-?\\d+(\\.\\d+)?"))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
prefix = String.valueOf(Integer.parseInt(subStringList.get(subStringList.size() - 1)) + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -651,13 +664,16 @@ public class StructattrServiceImpl implements StructattrService {
|
||||
/*
|
||||
* 判断前缀是否存在
|
||||
*/
|
||||
List<JSONObject> attrList = attrTab.query("1 = 1").getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
List<JSONObject> attrList = WQL.getWO("QST_STRUCT_ATTR").addParam("flag", "2").process()
|
||||
.getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
// 截取第一个 - 之前的数据集合
|
||||
List<String> subStringList = attrList.stream()
|
||||
.filter(row -> row.getString("struct_code").contains("-"))
|
||||
.map(row -> row.getString("struct_code").substring(0, row.getString("struct_code").indexOf("-")))
|
||||
.distinct()
|
||||
.sorted()
|
||||
.filter(row -> row.matches("-?\\d+(\\.\\d+)?"))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 判断是否有相同的前缀
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3'
|
||||
|
||||
END AS sub_type,
|
||||
DATEDIFF( NOW(), ivt.instorage_time ) AS stock_age
|
||||
DATEDIFF( NOW(), sub.date_of_production ) AS stock_age
|
||||
|
||||
FROM
|
||||
ST_IVT_StructIvt ivt
|
||||
|
||||
@@ -86,5 +86,19 @@
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
struct.*
|
||||
FROM
|
||||
st_ivt_structattr struct
|
||||
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = struct.sect_id
|
||||
WHERE
|
||||
sect.sect_type_attr = '09'
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@@ -182,6 +182,7 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
}
|
||||
dtl.put("qty_unit_id", unit.getString("measure_unit_id"));
|
||||
dtl.put("qty_unit_name", unit.getString("unit_name"));
|
||||
dtl.put("package_box_sn", sub_jo.getString("package_box_sn"));
|
||||
dtl.put("qty", sub_jo.getString("net_weight"));
|
||||
dtls.add(dtl);
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -55,11 +55,13 @@
|
||||
SELECT
|
||||
task.*,
|
||||
md.class_name task_type_name,
|
||||
user.person_name AS create_name1,
|
||||
dict.label task_status_name,
|
||||
case when task.task_type like '0105%' then 'LK' ELSE task.product_area end AS final_product_area
|
||||
FROM
|
||||
sch_base_task task
|
||||
LEFT JOIN md_pb_classstandard md ON task.task_type = md.class_code
|
||||
LEFT JOIN sys_user user ON user.username = task.create_name
|
||||
LEFT JOIN sys_dict dict ON dict.`value` = task.task_status AND dict.`code` = 'task_status'
|
||||
WHERE
|
||||
1=1
|
||||
|
||||
@@ -295,4 +295,12 @@ public interface CheckOutBillService {
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(Map map, HttpServletResponse response, String[] stor_id, String[] bill_status, String[] bill_type) throws IOException;
|
||||
|
||||
/**
|
||||
* 更新是否超期
|
||||
* @param whereJson {
|
||||
* 主表数据
|
||||
* }
|
||||
*/
|
||||
JSONObject updataIsOverdue(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -340,57 +340,6 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "8"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
pp.CREATE_DATE AS receive_date,
|
||||
pp.VBILLCODE AS source_bill_code,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
class.class_desc,
|
||||
mb.material_id,
|
||||
pp.QTY AS receive_qty,
|
||||
( CASE WHEN a.real_qty IS NULL THEN pp.QTY ELSE ( pp.QTY - a.real_qty ) END ) AS need_qty,
|
||||
mu.unit_name AS qty_unit_name,
|
||||
'采购订单' AS source_type_name,
|
||||
mu.measure_unit_id AS qty_unit_id,
|
||||
pp.id AS source_billdtl_id,
|
||||
'PO' AS source_bill_type,
|
||||
'PCS_IF_PurchaseOrderProc' AS source_bill_table,
|
||||
pp.id AS base_billdtl_id,
|
||||
'PO' AS base_bill_type,
|
||||
'' AS base_bill_code,
|
||||
'PCS_IF_PurchaseOrderProc' AS base_bill_table
|
||||
FROM
|
||||
pcs_if_purchaseorderproc pp
|
||||
LEFT JOIN md_me_materialbase mb ON mb.ext_id = pp.ITEM_ID
|
||||
INNER JOIN md_pb_classstandard class ON class.class_id = mb.material_type_id
|
||||
INNER JOIN md_pb_measureunit mu ON mu.ext_id = pp.M_UNIT_ID
|
||||
LEFT JOIN ( SELECT dtl.source_billdtl_id, SUM( dtl.real_qty ) AS real_qty FROM st_ivt_iostorinvdtl dtl GROUP BY source_billdtl_id ) a ON a.source_billdtl_id = pp.id
|
||||
WHERE
|
||||
pp.proc_status IN ( '01', '02' )
|
||||
AND
|
||||
pp.DR='0'
|
||||
AND
|
||||
mb.material_type_id IN 输入.clsss_ids
|
||||
OPTION 输入.material_search <> ""
|
||||
(mb.material_code like 输入.material_search
|
||||
OR
|
||||
mb.material_name like 输入.material_search)
|
||||
ENDOPTION
|
||||
OPTION 输入.bill_code <> ""
|
||||
pp.VBILLCODE like 输入.bill_code
|
||||
ENDOPTION
|
||||
OPTION 输入.begin_time <> ""
|
||||
pp.CREATE_DATE >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
pp.CREATE_DATE <= 输入.end_time
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "9"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
|
||||
@@ -479,6 +479,10 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
||||
.addParam("flag", "3").addParam("stor_id", stor_id).addParam("in_stor_id",in_stor_id)
|
||||
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
// 查询不合格品来源字典
|
||||
List<JSONObject> dictList = WQL.getWO("QST_IVT_PRODUCTSCRAP").addParam("flag", "3")
|
||||
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
// 循环获取的数据
|
||||
ArrayList<JSONObject> resultList = new ArrayList<>();
|
||||
for (int i = 0; i < read.size(); i++) {
|
||||
@@ -488,10 +492,14 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
||||
String pcsn = list.get(0).toString();
|
||||
// sap批次号
|
||||
String sap_pcsn = list.get(1).toString();
|
||||
// 木箱号
|
||||
/* // 木箱号
|
||||
String box_no = list.get(2).toString();
|
||||
// 重量
|
||||
String qty = list.get(3).toString();
|
||||
String qty = list.get(3).toString();*/
|
||||
// 不合格品来源
|
||||
String fail_source = list.get(4).toString();
|
||||
// 不合格描述
|
||||
String remark = list.get(5).toString();
|
||||
|
||||
// 子卷号和批次号必须有一个不为空
|
||||
if (ObjectUtil.isEmpty(pcsn) && ObjectUtil.isEmpty(sap_pcsn)) {
|
||||
@@ -513,6 +521,22 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
||||
.filter(row -> row.getString("storagevehicle_code").equals(json.getString("storagevehicle_code")))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 匹配不合格品来源
|
||||
String value = "";
|
||||
List<JSONObject> label = dictList.stream()
|
||||
.filter(row -> row.getString("label").equals(fail_source))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (ObjectUtil.isNotEmpty(label)) {
|
||||
value = label.get(0).getString("value");
|
||||
}
|
||||
// 插入不合格品来源、不合格品描述
|
||||
String finalValue = value;
|
||||
boxList.forEach(row -> {
|
||||
row.put("fail_source", finalValue);
|
||||
row.put("remark",remark);
|
||||
});
|
||||
|
||||
resultList.addAll(boxList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,6 +131,7 @@ public class RecutPlanServiceImpl implements RecutPlanService {
|
||||
jsonDtl.put("plan_id", jsonMst.getLongValue("plan_id"));
|
||||
jsonDtl.put("seq_no", i);
|
||||
jsonDtl.put("material_id", json.getLongValue("material_id"));
|
||||
jsonDtl.put("package_box_sn", json.getLongValue("package_box_sn"));
|
||||
jsonDtl.put("pcsn", json.getString("sap_pcsn"));
|
||||
jsonDtl.put("qty_unit_id", json.getString("qty_unit_id"));
|
||||
jsonDtl.put("qty_unit_name", json.getString("qty_unit_name"));
|
||||
|
||||
@@ -98,11 +98,13 @@
|
||||
SELECT
|
||||
dtl.*,
|
||||
mater.material_code,
|
||||
mater.material_name
|
||||
mater.material_name,
|
||||
sub.package_box_sn
|
||||
FROM
|
||||
st_ivt_productplandtl dtl
|
||||
LEFT JOIN st_ivt_productplanmst mst ON mst.plan_id = dtl.plan_id
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = dtl.material_id
|
||||
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.sap_pcsn = dtl.pcsn
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.plan_id <> ""
|
||||
@@ -116,8 +118,7 @@
|
||||
OPTION 输入.status <> ""
|
||||
dtl.status = 输入.status
|
||||
ENDOPTION
|
||||
|
||||
order by dtl.seq_no
|
||||
order by sub.package_box_sn
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -109,4 +109,16 @@
|
||||
order by dtl.seq_no
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sys_dict
|
||||
WHERE
|
||||
code = 'FAIL_SOURCE'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -312,4 +312,11 @@ public class CheckOutBillController {
|
||||
public void download(@RequestParam Map map, HttpServletResponse response, String[] stor_id, String[] bill_status, String[] bill_type) throws IOException {
|
||||
checkOutBillService.download(map, response, stor_id, bill_status, bill_type);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/updataIsOverdue")
|
||||
@Log("更新是否超期")
|
||||
public ResponseEntity<Object> updataIsOverdue(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(checkOutBillService.updataIsOverdue(whereJson),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1022,6 +1022,32 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject updataIsOverdue(JSONObject whereJson) {
|
||||
// 出入库主表
|
||||
WQLObject mstTab = WQLObject.getWQLObject("st_ivt_iostorinv");
|
||||
// 出入库分配明细表
|
||||
WQLObject disTab = WQLObject.getWQLObject("st_ivt_iostorinvdis");
|
||||
|
||||
// 更新主表
|
||||
JSONObject jsonMst = mstTab.query("iostorinv_id = '" + whereJson.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
jsonMst.put("is_overdue", whereJson.getString("is_overdue"));
|
||||
mstTab.update(jsonMst);
|
||||
|
||||
// 计算超期数量
|
||||
List<JSONObject> disList = disTab.query("iostorinvdtl_id = '" + whereJson.getString("iostorinvdtl_id") + "' AND is_overdue = '1'")
|
||||
.getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
double overdue_qyt = disList.stream()
|
||||
.map(row -> row.getDoubleValue("plan_qty"))
|
||||
.reduce(Double::sum).orElse(0.00);
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("overdue_qyt",overdue_qyt);
|
||||
result.put("mst", jsonMst);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(JSONObject whereJson) {
|
||||
@@ -1290,11 +1316,12 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
dtl.put("work_status", "00");
|
||||
}
|
||||
|
||||
// 判断是否超期
|
||||
if (ivt2.getString("is_overdue").equals("1")) {
|
||||
dtl.put("work_status", "01");
|
||||
if (jo_mst.getString("is_overdue").equals("1")) {
|
||||
// 判断是否超期
|
||||
if (ivt2.getString("is_overdue").equals("1")) {
|
||||
dtl.put("work_status", "01");
|
||||
}
|
||||
}
|
||||
|
||||
wo_dis.insert(dtl);
|
||||
}
|
||||
//记录需锁定的仓位
|
||||
@@ -1358,9 +1385,12 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
}
|
||||
|
||||
// 判断是否超期
|
||||
if (jsonIvt.getString("is_overdue").equals("1")) {
|
||||
dtl.put("work_status", "01");
|
||||
if (jo_mst.getString("is_overdue").equals("1")) {
|
||||
if (jsonIvt.getString("is_overdue").equals("1")) {
|
||||
dtl.put("work_status", "01");
|
||||
}
|
||||
}
|
||||
|
||||
wo_dis.insert(dtl);
|
||||
|
||||
//记录需锁定的仓位 (如果此明细有相同物料的且子卷号不能为空的则在最后一个明细分配完成后锁定仓位)
|
||||
@@ -1534,6 +1564,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
dtl.put("is_issued", "0");
|
||||
dtl.put("plan_qty", ivt2.getDoubleValue("change_qty"));
|
||||
dtl.put("real_qty", ivt2.getDoubleValue("change_qty"));
|
||||
dtl.put("is_overdue", ivt2.getString("is_overdue"));
|
||||
dtl.put("instorage_time", ivt2.getString("instorage_time"));
|
||||
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt2.getString("sect_id") + "'").uniqueResult(0);
|
||||
@@ -1542,6 +1573,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
} else {
|
||||
dtl.put("work_status", "00");
|
||||
}
|
||||
|
||||
if (jo_mst.getString("is_overdue").equals("1")) {
|
||||
// 判断是否超期
|
||||
if (ivt2.getString("is_overdue").equals("1")) {
|
||||
dtl.put("work_status", "01");
|
||||
}
|
||||
}
|
||||
|
||||
wo_dis.insert(dtl);
|
||||
}
|
||||
//记录需锁定的仓位
|
||||
@@ -1594,6 +1633,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
dtl.put("is_issued", "0");
|
||||
dtl.put("plan_qty", jsonIvt.getDoubleValue("change_qty"));
|
||||
dtl.put("real_qty", jsonIvt.getDoubleValue("change_qty"));
|
||||
dtl.put("is_overdue", jsonIvt.getString("is_overdue"));
|
||||
dtl.put("instorage_time", jsonIvt.getString("instorage_time"));
|
||||
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
JSONObject jsonSect = wo_sect.query("sect_id = '" + jsonIvt.getString("sect_id") + "'").uniqueResult(0);
|
||||
@@ -1602,6 +1642,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
} else {
|
||||
dtl.put("work_status", "00");
|
||||
}
|
||||
|
||||
if (jo_mst.getString("is_overdue").equals("1")) {
|
||||
// 判断是否超期
|
||||
if (jsonIvt.getString("is_overdue").equals("1")) {
|
||||
dtl.put("work_status", "01");
|
||||
}
|
||||
}
|
||||
|
||||
wo_dis.insert(dtl);
|
||||
//记录需锁定的仓位
|
||||
Struct_map.put(jsonIvt.getString("struct_id"), jsonIvt);
|
||||
@@ -1658,6 +1706,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
json.put("is_issued", "0");
|
||||
json.put("plan_qty", ivt.getDoubleValue("change_qty"));
|
||||
json.put("real_qty", ivt.getDoubleValue("change_qty"));
|
||||
json.put("is_overdue", ivt.getString("is_overdue"));
|
||||
json.put("instorage_time", ivt.getString("instorage_time"));
|
||||
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt.getString("sect_id") + "'").uniqueResult(0);
|
||||
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
|
||||
@@ -1665,6 +1715,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
} else {
|
||||
json.put("work_status", "00");
|
||||
}
|
||||
|
||||
// 判断是否超期
|
||||
if (jo_mst.getString("is_overdue").equals("1")) {
|
||||
if (ivt.getString("is_overdue").equals("1")) {
|
||||
json.put("work_status", "01");
|
||||
}
|
||||
}
|
||||
|
||||
wo_dis.insert(json);
|
||||
|
||||
// 更新明细
|
||||
@@ -4384,6 +4442,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
dtl.put("is_issued", "0");
|
||||
dtl.put("plan_qty", ivt.getDoubleValue("change_qty"));
|
||||
dtl.put("real_qty", ivt.getDoubleValue("change_qty"));
|
||||
dtl.put("is_overdue", ivt.getString("is_overdue"));
|
||||
dtl.put("instorage_time", ivt.getString("instorage_time"));
|
||||
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt.getString("sect_id") + "'").uniqueResult(0);
|
||||
@@ -4392,6 +4451,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
} else {
|
||||
dtl.put("work_status", "00");
|
||||
}
|
||||
|
||||
// 判断是否超期
|
||||
if (jo_mst.getString("is_overdue").equals("1")) {
|
||||
if (ivt.getString("is_overdue").equals("1")) {
|
||||
dtl.put("work_status", "01");
|
||||
}
|
||||
}
|
||||
|
||||
wo_dis.insert(dtl);
|
||||
//记录需锁定的仓位
|
||||
Struct_map.put(ivt.getString("struct_id"), ivt);
|
||||
@@ -4453,6 +4520,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
json.put("is_issued", "0");
|
||||
json.put("plan_qty", ivt.getDoubleValue("change_qty"));
|
||||
json.put("real_qty", ivt.getDoubleValue("change_qty"));
|
||||
json.put("is_overdue", ivt.getString("is_overdue"));
|
||||
json.put("instorage_time", ivt.getString("instorage_time"));
|
||||
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt.getString("sect_id") + "'").uniqueResult(0);
|
||||
@@ -4461,6 +4529,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
} else {
|
||||
json.put("work_status", "00");
|
||||
}
|
||||
|
||||
// 判断是否超期
|
||||
if (jo_mst.getString("is_overdue").equals("1")) {
|
||||
if (ivt.getString("is_overdue").equals("1")) {
|
||||
json.put("work_status", "01");
|
||||
}
|
||||
}
|
||||
|
||||
wo_dis.insert(json);
|
||||
|
||||
// 更新明细
|
||||
@@ -4585,8 +4661,12 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
dis.put("bill_code", jo_mst.getString("bill_code"));
|
||||
dis.put("bill_table", "ST_IVT_IOStorInv");
|
||||
|
||||
if (dis.getString("is_overdue").equals("1")) {
|
||||
storPublicService.IOStor(dis, "12");
|
||||
if (jo_mst.getString("is_overdue").equals("1")) {
|
||||
if (dis.getString("is_overdue").equals("1")) {
|
||||
storPublicService.IOStor(dis, "12");
|
||||
} else {
|
||||
storPublicService.IOStor(dis, "21");
|
||||
}
|
||||
} else {
|
||||
storPublicService.IOStor(dis, "21");
|
||||
}
|
||||
@@ -4596,15 +4676,28 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
from_start.put("struct_id", dis.getString("struct_id"));
|
||||
from_start.put("lock_type", "1");
|
||||
from_start.put("is_overdue", dis.getString("is_overdue"));
|
||||
if (dis.getString("is_overdue").equals("1")) {
|
||||
from_start.put("storagevehicle_code", dis.getString("box_no"));
|
||||
|
||||
if (jo_mst.getString("is_overdue").equals("1")) {
|
||||
if (dis.getString("is_overdue").equals("1")) {
|
||||
from_start.put("storagevehicle_code", dis.getString("box_no"));
|
||||
} else {
|
||||
from_start.put("storagevehicle_code", "");
|
||||
}
|
||||
} else {
|
||||
from_start.put("storagevehicle_code", "");
|
||||
}
|
||||
|
||||
storPublicService.updateStructAndPoint(from_start);
|
||||
|
||||
if (dis.getString("is_overdue").equals("1")) {
|
||||
continue;
|
||||
// 更新分配明细执行状态为 - 99
|
||||
JSONObject jsonDis = wo_dis.query("iostorinvdis_id = '" + dis.getString("iostorinvdis_id") + "'").uniqueResult(0);
|
||||
jsonDis.put("work_status", "99");
|
||||
wo_dis.update(jsonDis);
|
||||
|
||||
if (jo_mst.getString("is_overdue").equals("1")) {
|
||||
if (dis.getString("is_overdue").equals("1")) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//查询对应明细
|
||||
@@ -4637,11 +4730,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
jsonSub.put("record_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
sub_record.insert(jsonSub);
|
||||
|
||||
// 更新分配明细执行状态为 - 99
|
||||
JSONObject jsonDis = wo_dis.query("iostorinvdis_id = '" + dis.getString("iostorinvdis_id") + "'").uniqueResult(0);
|
||||
jsonDis.put("work_status", "99");
|
||||
wo_dis.update(jsonDis);
|
||||
|
||||
// 更新对应任务为完成
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + jsonDis.getString("task_id") + "' and task_status < '07'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonTask)) {
|
||||
@@ -4664,7 +4752,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
}
|
||||
|
||||
JSONObject mst_row = mst_wql.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
|
||||
JSONArray dis_rows = dis_wql.query("iostorinv_id = '" + iostorinv_id + "' and is_overdue = '0'").getResultJSONArray(0);
|
||||
|
||||
JSONArray dis_rows = new JSONArray();
|
||||
|
||||
if (jo_mst.getString("is_overdue").equals("1")) {
|
||||
dis_rows = dis_wql.query("iostorinv_id = '" + iostorinv_id + "' and is_overdue = '0'").getResultJSONArray(0);
|
||||
} else {
|
||||
dis_rows = dis_wql.query("iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0);
|
||||
}
|
||||
|
||||
//生成手工入库单
|
||||
String new_iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
@@ -4767,7 +4862,13 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
if ("1003".equals(out_jo.getString("bill_type")) || "1006".equals(out_jo.getString("bill_type"))) {
|
||||
//如果为返检出库或者改切出库删除对应的包装关系
|
||||
JSONArray dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + iostorinv_id + "' and is_overdue = '0'").getResultJSONArray(0);
|
||||
JSONArray dis_rows = new JSONArray();
|
||||
if (jo_mst.getString("is_overdue").equals("1")) {
|
||||
dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + iostorinv_id + "' and is_overdue = '0'").getResultJSONArray(0);
|
||||
} else {
|
||||
dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < dis_rows.size(); i++) {
|
||||
JSONObject dis_row = dis_rows.getJSONObject(i);
|
||||
String sect_code = dis_row.getString("sect_code");
|
||||
@@ -5329,12 +5430,17 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
// 回传sap
|
||||
JSONObject jsonMst = mstTab.query("iostorinv_id = '" + whereJson.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
|
||||
JSONArray jsonArr = new JSONArray();
|
||||
jsonArr.add(jsonMst);
|
||||
// 判断单据是否是完成状态:只回传完成状态的单据
|
||||
if (jsonMst.getString("bill_status").equals("99")) {
|
||||
if (!jsonMst.getString("upload_sap").equals("1")) {
|
||||
JSONArray jsonArr = new JSONArray();
|
||||
jsonArr.add(jsonMst);
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("rows", jsonArr);
|
||||
inAndOutReturnService.uploadSAP(param);
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("rows", jsonArr);
|
||||
inAndOutReturnService.uploadSAP(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
cu.cust_simple_name,
|
||||
a.plan_qty,
|
||||
attr.stor_name AS out_stor_name
|
||||
|
||||
FROM
|
||||
ST_IVT_IOStorInv ios
|
||||
LEFT JOIN md_cs_customerbase cu ON ios.cust_code = cu.cust_code
|
||||
@@ -106,15 +107,32 @@
|
||||
LEFT JOIN pdm_bi_subpackagerelationrecord sub ON sub.container_name = dis.pcsn AND dis.box_no = sub.package_box_sn AND sub.bill_code = ios.bill_code
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
SUM(a.assign_qty) AS plan_qty,
|
||||
SUM(a.plan_qty) AS plan_qty,
|
||||
a.iostorinv_id
|
||||
FROM
|
||||
st_ivt_iostorinvdtl a
|
||||
st_ivt_iostorinvdis a
|
||||
LEFT JOIN ST_IVT_IOStorInv b ON a.iostorinv_id = b.iostorinv_id
|
||||
WHERE
|
||||
b.io_type = '1'
|
||||
and b.is_delete='0'
|
||||
and a.is_overdue = '0'
|
||||
and b.is_overdue = '1'
|
||||
GROUP BY a.iostorinv_id
|
||||
|
||||
UNION
|
||||
|
||||
SELECT
|
||||
SUM(a.plan_qty) AS plan_qty,
|
||||
a.iostorinv_id
|
||||
FROM
|
||||
st_ivt_iostorinvdis a
|
||||
LEFT JOIN ST_IVT_IOStorInv b ON a.iostorinv_id = b.iostorinv_id
|
||||
WHERE
|
||||
b.io_type = '1'
|
||||
and b.is_delete='0'
|
||||
and b.is_overdue = '0'
|
||||
GROUP BY a.iostorinv_id
|
||||
|
||||
) a ON a.iostorinv_id = ios.iostorinv_id
|
||||
WHERE
|
||||
ios.io_type = '1'
|
||||
@@ -369,7 +387,14 @@
|
||||
struct.storagevehicle_id,
|
||||
struct.storagevehicle_code,
|
||||
point.point_id,
|
||||
sub.sap_pcsn
|
||||
sub.sap_pcsn,
|
||||
CASE
|
||||
WHEN SUBSTRING(sub.container_name,1,1) = 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '180'
|
||||
THEN '1'
|
||||
WHEN SUBSTRING(sub.container_name,1,1) != 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '90'
|
||||
THEN '1'
|
||||
ELSE '0'
|
||||
END AS is_overdue
|
||||
FROM
|
||||
ST_IVT_StructIvt ivt
|
||||
LEFT JOIN st_ivt_structattr struct ON struct.struct_id = ivt.struct_id
|
||||
@@ -437,7 +462,14 @@
|
||||
struct.storagevehicle_id,
|
||||
struct.storagevehicle_code,
|
||||
point.point_id,
|
||||
sub.sap_pcsn
|
||||
sub.sap_pcsn,
|
||||
CASE
|
||||
WHEN SUBSTRING(sub.container_name,1,1) = 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '180'
|
||||
THEN '1'
|
||||
WHEN SUBSTRING(sub.container_name,1,1) != 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '90'
|
||||
THEN '1'
|
||||
ELSE '0'
|
||||
END AS is_overdue
|
||||
FROM
|
||||
ST_IVT_StructIvt ivt2
|
||||
LEFT JOIN st_ivt_structattr struct ON struct.struct_id = ivt2.struct_id
|
||||
|
||||
@@ -62,7 +62,11 @@
|
||||
attr.struct_name,
|
||||
attr.struct_code,
|
||||
CASE
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '1' ELSE '0'
|
||||
WHEN SUBSTRING(sub.container_name,1,1) = 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '180'
|
||||
THEN '1'
|
||||
WHEN SUBSTRING(sub.container_name,1,1) != 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '90'
|
||||
THEN '1'
|
||||
ELSE '0'
|
||||
END AS is_overdue
|
||||
FROM
|
||||
ST_IVT_StructIvt ivt
|
||||
@@ -164,7 +168,11 @@
|
||||
attr.struct_name,
|
||||
attr.struct_code,
|
||||
CASE
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '1' ELSE '0'
|
||||
WHEN SUBSTRING(sub.container_name,1,1) = 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '180'
|
||||
THEN '1'
|
||||
WHEN SUBSTRING(sub.container_name,1,1) != 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '90'
|
||||
THEN '1'
|
||||
ELSE '0'
|
||||
END AS is_overdue
|
||||
FROM
|
||||
ST_IVT_StructIvt ivt
|
||||
|
||||
@@ -488,6 +488,8 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
WQLObject sectTab = WQLObject.getWQLObject("st_ivt_sectattr");
|
||||
// 子卷包装关系表
|
||||
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelationrecord");
|
||||
// 子卷包装关系表
|
||||
WQLObject subTab2 = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
|
||||
JSONArray rows = whereJson.getJSONArray("rows");
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
@@ -682,6 +684,9 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
JSONObject jsonSub = subTab.query("container_name = '" + json2.getString("pcsn") + "' AND package_box_sn = '" + json2.getString("box_no") + "' AND bill_id = '" + json2.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonSub)) {
|
||||
jsonDis.put("CHARG", jsonSub.getString("sap_pcsn")); // sap批次
|
||||
} else {
|
||||
JSONObject jsonSub2 = subTab2.query("container_name = '" + json2.getString("pcsn") + "'").uniqueResult(0);
|
||||
jsonDis.put("CHARG", jsonSub2.getString("sap_pcsn")); // sap批次
|
||||
}
|
||||
jsonDis.put("VBELN", json.getString("vbeln")); // 交货
|
||||
jsonDis.put("POSNR", json.getString("posnr")); // 项目
|
||||
@@ -978,6 +983,8 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
WQLObject sectTab = WQLObject.getWQLObject("st_ivt_sectattr");
|
||||
// 子卷包装关系表
|
||||
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelationrecord");
|
||||
// 子卷包装关系表
|
||||
WQLObject subTab2 = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
|
||||
//根据出入单类型判断回传业务
|
||||
//1、生产入库:回传MES;手工入库:回传SAP
|
||||
@@ -1299,8 +1306,12 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
}
|
||||
|
||||
JSONObject jsonSub = subTab.query("container_name = '" + json2.getString("pcsn") + "' AND package_box_sn = '" + json2.getString("box_no") + "' AND bill_id = '" + json2.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonSect)) {
|
||||
if (ObjectUtil.isNotEmpty(jsonSub)) {
|
||||
jsonDis.put("CHARG", jsonSub.getString("sap_pcsn")); // sap批次
|
||||
} else {
|
||||
JSONObject jsonSub2 = subTab2.query("container_name = '" + json2.getString("pcsn") + "'").uniqueResult(0);
|
||||
jsonDis.put("CHARG", jsonSub2.getString("sap_pcsn")); // sap批次
|
||||
|
||||
}
|
||||
jsonDis.put("VBELN", json.getString("vbeln")); // 交货
|
||||
jsonDis.put("POSNR", json.getString("posnr")); // 项目
|
||||
|
||||
@@ -296,6 +296,8 @@ public class OutBillQueryServiceImpl implements OutBillQueryService {
|
||||
mp.put("净重", json.getString("net_weight"));
|
||||
mp.put("单位", json.getString("qty_unit_name"));
|
||||
mp.put("管件类型", json.getString("paper_type"));
|
||||
mp.put("管件编码", json.getString("paper_code"));
|
||||
mp.put("管件描述", json.getString("paper_name"));
|
||||
mp.put("客户编码", json.getString("customer_name"));
|
||||
mp.put("发货客户名称", json.getString("customer_description"));
|
||||
if (ObjectUtil.isEmpty(json.getString("sale_order_name"))) {
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.material_code TYPEAS s_string
|
||||
输入.classIds TYPEAS f_string
|
||||
输入.pcsn TYPEAS s_string
|
||||
输入.sap_pcsn TYPEAS s_string
|
||||
输入.package_box_sn TYPEAS s_string
|
||||
@@ -53,14 +52,9 @@
|
||||
stor.stor_name,
|
||||
da.sect_date,
|
||||
da.pcsn,
|
||||
da.quality_scode,
|
||||
class.class_name,
|
||||
class.class_code,
|
||||
mater.material_id,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_model,
|
||||
unit.unit_name,
|
||||
da.start_num,
|
||||
da.in_num,
|
||||
da.out_num,
|
||||
@@ -77,22 +71,17 @@
|
||||
sum(end_num) AS end_num,
|
||||
sum(more_num) AS more_num,
|
||||
sum(less_num) AS less_num,
|
||||
max(material_id) AS material_id,
|
||||
max( material_id ) AS material_id,
|
||||
max(stor_id) AS stor_id,
|
||||
max(sect_date) AS sect_date,
|
||||
max(quality_scode) AS quality_scode,
|
||||
max(pcsn) AS pcsn
|
||||
sect_date,
|
||||
pcsn
|
||||
FROM
|
||||
ST_IVT_IOStorDaily a
|
||||
GROUP BY
|
||||
a.material_id,
|
||||
a.quality_scode,
|
||||
a.pcsn,
|
||||
a.sect_date
|
||||
) AS da
|
||||
LEFT JOIN MD_ME_MaterialBase mater ON da.material_id = mater.material_id
|
||||
LEFT JOIN md_pb_classstandard class ON mater.material_type_id = class.class_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = mater.base_unit_id
|
||||
LEFT JOIN st_ivt_bsrealstorattr stor ON stor.stor_id = da.stor_id
|
||||
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.container_name = da.pcsn
|
||||
WHERE 1=1
|
||||
@@ -127,10 +116,6 @@
|
||||
sub.package_box_sn like 输入.package_box_sn
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.classIds <> ""
|
||||
class.class_id in 输入.classIds
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
Reference in New Issue
Block a user