修改
This commit is contained in:
Binary file not shown.
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.st.inbill.rest;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -29,8 +30,8 @@ public class RawAssistIStorController {
|
||||
@Log("查询原辅料入库单据")
|
||||
@ApiOperation("查询原辅料入库单据")
|
||||
//@PreAuthorize("@el.check('checkoutbill:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(rawAssistIStorService.pageQuery(whereJson,page), HttpStatus.OK);
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(rawAssistIStorService.pageQuery(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("删除出入库单")
|
||||
@@ -46,23 +47,24 @@ public class RawAssistIStorController {
|
||||
@Log("查询到货通知单")
|
||||
@ApiOperation("查询到货通知单")
|
||||
//@PreAuthorize("@el.check('materialtype:list')")
|
||||
public ResponseEntity<Object> getBillDtl(@RequestParam Map whereJson,Pageable page) {
|
||||
return new ResponseEntity<>(rawAssistIStorService.getBillDtl(whereJson,page), HttpStatus.OK);
|
||||
public ResponseEntity<Object> getBillDtl(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(rawAssistIStorService.getBillDtl(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping()
|
||||
@Log("新增入库单")
|
||||
@ApiOperation("新增入库单")
|
||||
//@PreAuthorize("@el.check('structrelamaterial:edit')")
|
||||
public ResponseEntity<Object> insertDtl(@RequestBody Map whereJson){
|
||||
public ResponseEntity<Object> insertDtl(@RequestBody Map whereJson) {
|
||||
rawAssistIStorService.insertDtl(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改入库单")
|
||||
@ApiOperation("修改入库单")
|
||||
//@PreAuthorize("@el.check('sectattr:edit')")
|
||||
public ResponseEntity<Object> update(@RequestBody Map whereJson){
|
||||
public ResponseEntity<Object> update(@RequestBody Map whereJson) {
|
||||
rawAssistIStorService.update(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@@ -127,6 +129,24 @@ public class RawAssistIStorController {
|
||||
return new ResponseEntity<>(rawAssistIStorService.queryTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/delDis")
|
||||
@Log("删除分配")
|
||||
@ApiOperation("删除分配")
|
||||
//@PreAuthorize("@el.check('materialtype:list')")
|
||||
public ResponseEntity<Object> delDis(@RequestBody JSONObject whereJson) {
|
||||
rawAssistIStorService.delDis(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryBoxMater")
|
||||
@Log("查询箱内子卷")
|
||||
@ApiOperation("查询箱内子卷")
|
||||
//@PreAuthorize("@el.check('materialtype:list')")
|
||||
public ResponseEntity<Object> queryBoxMater(@RequestBody JSONArray whereJson) {
|
||||
|
||||
return new ResponseEntity<>(rawAssistIStorService.queryBoxMater(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/updateTask")
|
||||
@Log("变更任务")
|
||||
@ApiOperation("变更任务")
|
||||
|
||||
@@ -22,6 +22,10 @@ public interface RawAssistIStorService {
|
||||
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
void delDis(JSONObject whereJson);
|
||||
|
||||
JSONArray queryBoxMater(JSONArray rows);
|
||||
|
||||
void update(Map whereJson);
|
||||
|
||||
void commit(Map whereJson);
|
||||
|
||||
@@ -110,8 +110,8 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
map.put("material_search", "%" + material_search + "%");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(begin_time)) {
|
||||
map.put("begin_time", begin_time);
|
||||
map.put("end_time", end_time);
|
||||
map.put("begin_time", begin_time.substring(0, 10));
|
||||
map.put("end_time", end_time.substring(0, 10));
|
||||
}
|
||||
JSONObject jo = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "date_of_FG_inbound,package_box_sn desc");
|
||||
return jo;
|
||||
@@ -165,6 +165,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
row.put("material_id", material.getString("material_id"));
|
||||
row.put("pcsn", row.get("container_name"));
|
||||
row.put("bill_status", "30");
|
||||
row.put("quality_scode", "01");
|
||||
row.put("qty_unit_id", material.getString("base_unit_id"));
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + material.getString("base_unit_id") + "'").uniqueResult(0);
|
||||
row.put("qty_unit_name", unit.getString("unit_name"));
|
||||
@@ -204,9 +205,9 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
//将包装关系中对应的记录状态改为包装
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("status", "1");
|
||||
if (whereJson.get("bill_type").equals("0003")){
|
||||
if (whereJson.get("bill_type").equals("0003")) {
|
||||
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(map, "package_box_SN = '" + dis.getString("box_no") + "' AND status = '3'");
|
||||
}else {
|
||||
} else {
|
||||
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(map, "package_box_SN = '" + dis.getString("box_no") + "' AND status = '0'");
|
||||
}
|
||||
}
|
||||
@@ -245,6 +246,34 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delDis(JSONObject whereJson) {
|
||||
String box_no = whereJson.getString("package_box_sn");
|
||||
//将状态为包装的改为生成
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("status", "0");
|
||||
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(map, "package_box_SN = '" + box_no + "' AND status = '1'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray queryBoxMater(JSONArray rows) {
|
||||
JSONArray total_rows = new JSONArray();
|
||||
HashSet<String> set = new HashSet<>();
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
String package_box_sn = row.getString("package_box_sn");
|
||||
set.add(package_box_sn);
|
||||
}
|
||||
for (String s : set) {
|
||||
JSONArray maters = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "16").addParam("package_box_sn", s).process().getResultJSONArray(0);
|
||||
for (int i = 0; i < maters.size(); i++) {
|
||||
JSONObject mater = maters.getJSONObject(i);
|
||||
total_rows.add(mater);
|
||||
}
|
||||
}
|
||||
return total_rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Map whereJson) {
|
||||
JSONObject mst_jo = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '" + whereJson.get("iostorinv_id") + "'").uniqueResult(0);
|
||||
@@ -261,28 +290,79 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("ST_IVT_IOStorInv");
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");
|
||||
WQLObject wo_dis = WQLObject.getWQLObject("st_ivt_iostorinvdis");
|
||||
wo.update(whereJson);
|
||||
//先删除该单据下的所有明细
|
||||
String iostorinv_id = (String) whereJson.get("iostorinv_id");
|
||||
wo_dtl.delete("iostorinv_id = '" + iostorinv_id + "'");
|
||||
JSONArray dis_rows = wo_dis.query("iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0);
|
||||
for (int i = 0; i < dis_rows.size(); i++) {
|
||||
JSONObject dis_row = dis_rows.getJSONObject(i);
|
||||
String box_no = dis_row.getString("box_no");
|
||||
//将状态为包装的改为生成
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
if (whereJson.get("bill_type").equals("0003")) {
|
||||
map.put("status", "3");
|
||||
}else {
|
||||
map.put("status", "0");
|
||||
}
|
||||
|
||||
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(map, "package_box_SN = '" + box_no + "' AND status = '1'");
|
||||
}
|
||||
wo_dis.delete("iostorinv_id = '" + iostorinv_id + "'");
|
||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableData");
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
HashMap<String, String> row = rows.get(i);
|
||||
row.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
row.put("iostorinv_id", iostorinv_id);
|
||||
row.put("seq_no", (i + 1) + "");
|
||||
row.put("bill_status", "10");
|
||||
row.put("unassign_qty", row.get("plan_qty"));
|
||||
JSONObject material = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + row.get("product_name") + "'").uniqueResult(0);
|
||||
row.put("material_id", material.getString("material_id"));
|
||||
row.put("pcsn", row.get("container_name"));
|
||||
row.put("bill_status", "30");
|
||||
row.put("quality_scode", "01");
|
||||
row.put("qty_unit_id", material.getString("base_unit_id"));
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + material.getString("base_unit_id") + "'").uniqueResult(0);
|
||||
row.put("qty_unit_name", unit.getString("unit_name"));
|
||||
row.put("assign_qty", row.get("net_weight"));
|
||||
row.put("plan_qty", row.get("net_weight"));
|
||||
String net_weight = row.get("net_weight");
|
||||
row.put("box_no", row.get("package_box_sn"));
|
||||
|
||||
/*//如果是退货入库,查询对应的包装关系维护交货单号和交货单行号
|
||||
if (whereJson.get("bill_type").equals("0002")) {
|
||||
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("container_name = '" + row.get("container_name") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(sub_jo)) {
|
||||
throw new BadRequestException("未查询到对应的子卷包装关系!");
|
||||
}
|
||||
row.put("vbeln", sub_jo.getString("vbeln"));
|
||||
row.put("posnr", sub_jo.getString("posnr"));
|
||||
}*/
|
||||
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(row);
|
||||
|
||||
//如果生成的入库单为软废采购入库需要将采购订单接口处理表改为采购中
|
||||
if (whereJson.get("bill_type").equals("000202")) {
|
||||
HashMap<String, String> proc_map = new HashMap<>();
|
||||
proc_map.put("proc_status", "02");
|
||||
proc_map.put("update_optid", currentUserId + "");
|
||||
proc_map.put("update_optname", nickName);
|
||||
proc_map.put("update_time", now);
|
||||
WQLObject.getWQLObject("PCS_IF_PurchaseOrderProc").update(proc_map, "id = '" + row.get("base_billdtl_id") + "'");
|
||||
JSONObject dis = new JSONObject();
|
||||
dis.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
dis.put("iostorinv_id", iostorinv_id);
|
||||
dis.put("iostorinvdtl_id", row.get("iostorinvdtl_id"));
|
||||
dis.put("seq_no", 1);
|
||||
dis.put("material_id", row.get("material_id"));
|
||||
dis.put("pcsn", row.get("pcsn"));
|
||||
dis.put("box_no", row.get("box_no"));
|
||||
dis.put("quality_scode", row.get("quality_scode"));
|
||||
dis.put("work_status", "00");
|
||||
dis.put("qty_unit_id", material.getString("base_unit_id"));
|
||||
dis.put("qty_unit_name", unit.getString("unit_name"));
|
||||
dis.put("plan_qty", row.get("plan_qty"));
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDis").insert(dis);
|
||||
|
||||
//将包装关系中对应的记录状态改为包装
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("status", "1");
|
||||
if (whereJson.get("bill_type").equals("0003")) {
|
||||
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(map, "package_box_SN = '" + dis.getString("box_no") + "' AND status = '3'");
|
||||
} else {
|
||||
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(map, "package_box_SN = '" + dis.getString("box_no") + "' AND status = '0'");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -420,7 +500,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
boolean is_virtual = false;
|
||||
if (sect_jo.getString("sect_type_attr").equals("09")) {
|
||||
is_virtual = true;
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextId()+"";
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
dis_map.put("task_id", task_id);
|
||||
dis_map.put("work_status", "01");
|
||||
}
|
||||
|
||||
@@ -102,7 +102,8 @@
|
||||
product_description,
|
||||
width,
|
||||
thickness,
|
||||
net_weight
|
||||
net_weight,
|
||||
net_weight AS plan_qty
|
||||
FROM
|
||||
pdm_bi_subpackagerelation sub
|
||||
WHERE
|
||||
@@ -111,7 +112,7 @@
|
||||
sub.date_of_FG_inbound >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
sub.date_of_FG_inbound <= 输入.begin_time
|
||||
sub.date_of_FG_inbound <= 输入.end_time
|
||||
ENDOPTION
|
||||
OPTION 输入.bill_code <> ""
|
||||
sub.sale_order_name = 输入.bill_code
|
||||
@@ -136,14 +137,16 @@
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT DISTINCT
|
||||
dtl.* ,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
mst.bill_code
|
||||
dtl.*,
|
||||
sub.*,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
mst.bill_code
|
||||
FROM
|
||||
st_ivt_iostorinvdtl dtl
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dtl.material_id
|
||||
LEFT JOIN ST_IVT_IOStorInv mst ON mst.iostorinv_id = dtl.iostorinv_id
|
||||
st_ivt_iostorinvdtl dtl
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dtl.material_id
|
||||
LEFT JOIN ST_IVT_IOStorInv mst ON mst.iostorinv_id = dtl.iostorinv_id
|
||||
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.container_name = dtl.pcsn
|
||||
where
|
||||
mst.bill_code = 输入.bill_code
|
||||
OPTION 输入.open_flag = "1"
|
||||
@@ -596,6 +599,32 @@
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "16"
|
||||
QUERY
|
||||
SELECT
|
||||
sale_order_name,
|
||||
customer_name,
|
||||
customer_description,
|
||||
package_box_sn,
|
||||
quanlity_in_box,
|
||||
container_name,
|
||||
product_name,
|
||||
product_description,
|
||||
width,
|
||||
thickness,
|
||||
net_weight,
|
||||
net_weight AS plan_qty
|
||||
FROM
|
||||
pdm_bi_subpackagerelation sub
|
||||
WHERE
|
||||
sub.status = '0'
|
||||
OPTION 输入.package_box_sn <> ""
|
||||
sub.package_box_sn = 输入.package_box_sn
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
package org.nl.wms.statistics.rest;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.statistics.service.IostordailyService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @date 2022-01-17
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "收发存查询管理")
|
||||
@RequestMapping("/api/iostordaily")
|
||||
@Slf4j
|
||||
public class IostordailyController {
|
||||
|
||||
private final IostordailyService iostordailyService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询收发存查询")
|
||||
@ApiOperation("查询收发存查询")
|
||||
//@PreAuthorize("@el.check('iostordaily:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(iostordailyService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getStor")
|
||||
@Log("查询仓库")
|
||||
@ApiOperation("查询仓库")
|
||||
public ResponseEntity<Object> getStor(){
|
||||
return new ResponseEntity<>(iostordailyService.getStor(),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
package org.nl.wms.statistics.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author Liuxy
|
||||
* @date 2022-01-17
|
||||
**/
|
||||
public interface IostordailyService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询仓库
|
||||
*/
|
||||
JSONArray getStor();
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package org.nl.wms.statistics.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author Liuxy
|
||||
* @date 2022-01-17
|
||||
**/
|
||||
@Data
|
||||
public class IostordailyDto implements Serializable {
|
||||
|
||||
/** 仓库日表标识 */
|
||||
/** 防止精度丢失 */
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long stordaily_id;
|
||||
|
||||
/** 仓库标识 */
|
||||
private Long stor_id;
|
||||
|
||||
/** 仓库编码 */
|
||||
private String stor_code;
|
||||
|
||||
/** 仓库名称 */
|
||||
private String stor_name;
|
||||
|
||||
/** 日期 */
|
||||
private String sect_date;
|
||||
|
||||
/** 物料标识 */
|
||||
private Long material_id;
|
||||
|
||||
/** 品质类型 */
|
||||
private String quality_scode;
|
||||
|
||||
/** 批次 */
|
||||
private String pcsn;
|
||||
|
||||
/** 库存等级 */
|
||||
private String ivt_level;
|
||||
|
||||
/** 是否可用 */
|
||||
private String is_active;
|
||||
|
||||
/** 期初数 */
|
||||
private BigDecimal start_num;
|
||||
|
||||
/** 入库数 */
|
||||
private BigDecimal in_num;
|
||||
|
||||
/** 出库数 */
|
||||
private BigDecimal out_num;
|
||||
|
||||
/** 其它加 */
|
||||
private BigDecimal more_num;
|
||||
|
||||
/** 其它减 */
|
||||
private BigDecimal less_num;
|
||||
|
||||
/** 期末数 */
|
||||
private BigDecimal end_num;
|
||||
|
||||
/** 数量计量单位标识 */
|
||||
private Long qty_unit_id;
|
||||
|
||||
/** 数量计量单位名称 */
|
||||
private String qty_unit_name;
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
|
||||
package org.nl.wms.statistics.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.basedata.master.service.MaterialbaseService;
|
||||
import org.nl.wms.statistics.service.IostordailyService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author Liuxy
|
||||
* @date 2022-01-17
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class IostordailyServiceImpl implements IostordailyService {
|
||||
private final ClassstandardService classstandardService;
|
||||
private final MaterialbaseService materialbaseService;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(Map whereJson, Pageable page){
|
||||
String material_code = MapUtil.getStr(whereJson, "material_code");
|
||||
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
|
||||
String pcsn = MapUtil.getStr(whereJson, "pcsn");
|
||||
//物料限制的时候使用,初始化页面
|
||||
String class_idStr = MapUtil.getStr(whereJson, "class_idStr");
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
map.put("flag", "1");
|
||||
//处理物料当前节点的所有子节点
|
||||
if (!StrUtil.isEmpty(material_type_id)) {
|
||||
map.put("material_type_id", material_type_id);
|
||||
String classIds = classstandardService.getChildIdStr(material_type_id);
|
||||
map.put("classIds", classIds);
|
||||
} else if (ObjectUtil.isNotEmpty(class_idStr)) {
|
||||
String classIds = classstandardService.getAllChildIdStr(class_idStr);
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(material_code)) {
|
||||
//处理转义字符
|
||||
if (material_code.contains("\\"))material_code=material_code.replace("\\","\\\\\\");
|
||||
map.put("material_code", "%" + material_code + "%");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(pcsn)) map.put("pcsn", "%" + pcsn + "%");
|
||||
JSONObject json = WQL.getWO("SendReceiveQuery_query_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "da.sect_date desc");
|
||||
|
||||
/*
|
||||
* 处理所属组织
|
||||
* 1.PG粉所属组织:通过物料编码+批次找工令所属组织来获取
|
||||
* 2.软废所属组织:物料编码去掉后缀 例如:-YZ 找最近完成的工令获取所属组织,若还有其他事业部,页面单元格底色标黄色
|
||||
* 3.除PG粉和软废外其他类型物料所属组织取不到 为空就行
|
||||
*/
|
||||
WQLObject workTab = WQLObject.getWQLObject("PDM_BI_WorkOrder"); // 工令表
|
||||
WQLObject deptTab = WQLObject.getWQLObject("sys_dept"); // 部门表
|
||||
|
||||
JSONArray contentArr = json.getJSONArray("content");
|
||||
for (int i = 0; i < contentArr.size(); i++) {
|
||||
JSONObject jsonObject = contentArr.getJSONObject(i);
|
||||
String material_id = jsonObject.getString("material_id");
|
||||
String pcsn_1 = jsonObject.getString("pcsn");
|
||||
|
||||
/*// 判断物料是PG粉还是软废
|
||||
boolean is_pgf = materialbaseService.isAlongMaterType(MaterOptTypeEnum.PGF.getCode(), material_id, null);
|
||||
boolean is_rf = materialbaseService.isAlongMaterType(MaterOptTypeEnum.RF.getCode(), material_id, null);
|
||||
|
||||
if (is_pgf) {
|
||||
JSONObject jsonWork = workTab.query("material_id = '" + material_id + "' and pcsn = '" + pcsn_1 + "' and is_delete ='0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonWork)) continue;
|
||||
|
||||
JSONObject jsonDept = deptTab.query("dept_id = '" + jsonWork.getString("org_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonDept)) jsonObject.put("dept_name", jsonDept.getString("name"));
|
||||
}
|
||||
|
||||
if (is_rf) {
|
||||
// 截取 "-" 最后出现的前面的字符串
|
||||
String material_code_1 = jsonObject.getString("material_code");
|
||||
int lastIndexOf = material_code_1.lastIndexOf('-');
|
||||
String material_code_sub = material_code_1.substring(0, lastIndexOf);
|
||||
|
||||
JSONArray workArr = WQL.getWO("SendReceiveQuery_query_01").addParam("flag", "3").addParam("material_code", material_code_sub).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(workArr)) continue;
|
||||
if (workArr.size() > 1) {
|
||||
jsonObject.put("is_yellow", "1");
|
||||
JSONObject json_1 = workArr.getJSONObject(0);
|
||||
jsonObject.put("dept_name",json_1.getString("dept_name"));
|
||||
} else {
|
||||
JSONObject json_1 = workArr.getJSONObject(0);
|
||||
jsonObject.put("dept_name",json_1.getString("dept_name"));
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getStor() {
|
||||
JSONArray jsonArr = WQL.getWO("SendReceiveQuery_query_01").addParam("flag", "2").process().getResultJSONArray(0);
|
||||
return jsonArr;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user