This commit is contained in:
2022-11-22 14:12:44 +08:00
parent 6147615986
commit ea7d866248
8 changed files with 272 additions and 29 deletions

View File

@@ -207,7 +207,7 @@ public class SapToLmsServiceImpl implements SapToLmsService {
jsonMst.put("biz_date", DateUtil.now());
JSONObject stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_delete = '0' AND is_used = '1' AND is_productstore = '1'").uniqueResult(0);
jsonMst.put("stor_id", stor.getString("stor_id"));
jsonMst.put("bill_status", "10");
jsonMst.put("bill_status", "30");
rawAssistIStorService.insertDtl(jsonMst);
}
} catch (Exception e) {

View File

@@ -0,0 +1,46 @@
package org.nl.wms.pda.st.rest;
import com.alibaba.fastjson.JSONObject;
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.pda.st.service.PrintService;
import org.nl.wms.pda.st.service.VirtualOutService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author zhouz
* @date 2022-05-25
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "打印信息")
@RequestMapping("/api/pda/print")
@Slf4j
public class PrintController {
private final PrintService printService;
@PostMapping("/customerInfo")
@Log("出库初始化查询")
@ApiOperation("出库初始化查询")
public ResponseEntity<Object> customerInfo(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(printService.customerInfo(whereJson),HttpStatus.OK);
}
@PostMapping("/billType")
@Log("获取单据类型")
@ApiOperation("获取单据类型")
public ResponseEntity<Object> customerPrint(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(printService.customerPrint(whereJson),HttpStatus.OK);
}
}

View File

@@ -0,0 +1,26 @@
package org.nl.wms.pda.st.service;
import com.alibaba.fastjson.JSONObject;
/**
* @description 服务接口
* @author liuxy
* @date 2022-05-25
**/
public interface PrintService {
/**
* 出库初始化查询
* @param whereJson /
* @return JSONObject /
*/
JSONObject customerInfo(JSONObject whereJson);
/**
* 获取单据类型
* @param whereJson /
* @return JSONObject /
*/
JSONObject customerPrint(JSONObject whereJson);
}

View File

@@ -0,0 +1,108 @@
package org.nl.wms.pda.st.service.impl;
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.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.pda.st.service.PrintService;
import org.nl.wms.pda.st.service.VirtualOutService;
import org.nl.wms.st.inbill.service.CheckOutBillService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @author liuxy
* @description 服务实现
* @date 2022-05-25
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class PrintServiceImpl implements PrintService {
@Override
public JSONObject customerInfo(JSONObject whereJson) {
String box_no = whereJson.getString("box_no");
JSONArray rows = WQL.getWO("PDA_ST_01").addParam("flag","5").addParam("box_no",box_no).process().getResultJSONArray(0);
JSONObject jo = new JSONObject();
jo.put("data", rows);
jo.put("message", "查询成功!");
return jo;
}
@Override
public JSONObject customerPrint(JSONObject whereJson) {
String box_no = whereJson.getString("box_no");
JSONObject box_jo = WQL.getWO("PDA_ST_01").addParam("flag","5").addParam("box_no",box_no).process().uniqueResult(0);
if (ObjectUtil.isEmpty(box_jo)){
throw new BadRequestException("未查询到木箱相关信息!");
}
//组织木箱打印信息
//箱号
String package_box_sn = box_jo.getString("package_box_sn");
//订单号
String sale_order_name = box_jo.getString("sale_order_name");
//品名
String product_description = box_jo.getString("product_description");
//物料号
String product_name = box_jo.getString("product_name");
//规格
String width = box_jo.getString("width");
//批号
String pcsn = "";
//入库日期
String date_of_FG_inbound = box_jo.getString("date_of_FG_inbound");
//毛重
String box_weight = box_jo.getString("box_weight");
//生产日期
String date_of_production = box_jo.getString("date_of_production");
//卷数
String quanlity_in_box = box_jo.getString("quanlity_in_box");
//保质期
String quality_guaran_period = box_jo.getString("quality_guaran_period");
//检验员
String nspector = "";
//储存条件
String storage_conditions = "";
double weight = 0;
JSONArray rows = WQL.getWO("PDA_ST_01").addParam("flag","5").addParam("box_no",box_no).process().getResultJSONArray(0);
for (int i = 0; i < rows.size(); i++) {
JSONObject row= rows.getJSONObject(i);
weight += row.getDoubleValue("net_weight");
}
//净重
JSONObject print_info = new JSONObject();
print_info.put("package_box_sn",package_box_sn);
print_info.put("sale_order_name",sale_order_name);
print_info.put("product_description",product_description);
print_info.put("product_name",product_name);
print_info.put("width",width);
print_info.put("pcsn",pcsn);
print_info.put("sum_net_weight",weight);
print_info.put("date_of_FG_inbound",date_of_FG_inbound);
print_info.put("box_weight",box_weight);
print_info.put("date_of_production",date_of_production);
print_info.put("quanlity_in_box",quanlity_in_box);
print_info.put("quality_guaran_period",quality_guaran_period);
print_info.put("nspector",nspector);
print_info.put("storage_conditions",storage_conditions);
JSONObject jo = new JSONObject();
jo.put("message", "打印成功!");
return jo;
}
}

View File

@@ -4,6 +4,7 @@ package org.nl.wms.pda.st.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -117,12 +118,18 @@ public class ProductInstorServiceImpl implements ProductInstorService {
mst_jo.put("total_qty", "0");
mst_jo.put("bill_status", "30");
String iostorinv_id = "";
if (!option.equals("3")) {
//查询该木箱是否存在未完成的入库单
JSONObject box_mst_jo = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("box_no = '" + box_no + "' AND bill_status <'99'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(box_mst_jo)){
JSONObject box_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '"+box_mst_jo.getString("iostorinv_id")+"' AND is_delete = '0' AND bill_status < '99'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(box_mst)){
iostorinv_id = box_mst_jo.getString("iostorinv_id");
}else {
iostorinv_id = rawAssistIStorService.insertDtl(mst_jo);
}
}else {
iostorinv_id = rawAssistIStorService.insertDtl(mst_jo);
} else {
//查询该木箱所在的未完成的入库单
JSONObject box_mst_jo = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("box_no = '" + box_no + "' AND bill_status <'99'").uniqueResult(0);
iostorinv_id = box_mst_jo.getString("iostorinv_id");
}
//判断是否虚拟

View File

@@ -55,6 +55,8 @@
mst.bill_type = '1002'
AND
sub.package_box_SN = 输入.box_no
AND
sub.status = '3'
ENDSELECT
ENDQUERY
ENDIF
@@ -73,30 +75,33 @@
sub.status = '0'
AND
sub.package_box_SN = 输入.box_no
UNION
SELECT
sub.package_box_SN,
sub.container_name,
sub.product_name,
sub.product_description,
sub.net_weight
FROM
st_ivt_iostorinvdis dis
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.package_box_SN = dis.box_no
AND sub.container_name = dis.pcsn
LEFT JOIN sch_base_task task ON task.vehicle_code = dis.storagevehicle_code
WHERE
mst.bill_type = '0009'
AND sub.STATUS = '1'
AND mst.is_delete = '0'
AND mst.bill_status < '99'
AND dis.work_status < '99'
AND task.task_id IS NULL
AND sub.package_box_SN = 输入.box_no
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "4"
QUERY
SELECT
package_box_SN,
container_name,
product_name,
product_description,
net_weight
FROM
pdm_bi_subpackagerelation sub
WHERE
sub.status = '1'
AND
sub.package_box_SN = 输入.box_no
AND
IFNULL(sub.vbeln,'') <> ''
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "3"
QUERY
SELECT
@@ -110,4 +115,52 @@
AND IFNULL( storagevehicle_code, '' ) = ''
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "4"
QUERY
SELECT
sub.package_box_SN,
sub.container_name,
sub.product_name,
sub.product_description,
sub.net_weight
FROM
st_ivt_iostorinvdis dis
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.package_box_SN = dis.box_no AND sub.container_name = dis.pcsn
LEFT JOIN sch_base_task task ON task.vehicle_code = dis.storagevehicle_code
WHERE
mst.bill_type = '0002'
AND sub.STATUS = '1'
AND mst.is_delete = '0'
AND mst.bill_status < '99'
AND dis.work_status < '99'
AND task.task_id IS NULL
AND sub.package_box_SN = 输入.box_no
AND IFNULL(sub.vbeln,'') <> ''
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "5"
QUERY
SELECT
sub.package_box_sn,
sub.quanlity_in_box,
sub.box_weight,
sub.sale_order_name,
sub.product_name,
sub.product_description,
sub.width,
sub.container_name,
sub.net_weight,
sub.date_of_FG_inbound,
sub.date_of_production
FROM
pdm_bi_subpackagerelation sub
WHERE
sub.package_box_sn = 输入.box_no
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -149,7 +149,7 @@ public class OutChargeServiceImpl implements OutChargeService {
//将包装关系中对应的记录状态改为包装
HashMap<String, String> map = new HashMap<>();
map.put("status", "1");
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(map, "package_box_SN = '" + dis_row.getString("box_no") + "' AND status = '0'");
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(map, "package_box_SN = '" + dis_row.getString("box_no") + "' AND status = '3'");
}
}

View File

@@ -124,6 +124,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
double total_qty = 0;
JSONObject io_mst = new JSONObject();
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
String bill_code = CodeUtil.getNewCode("IO_CODE");
@@ -139,8 +140,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
io_mst.put("stor_id", whereJson.get("stor_id"));
io_mst.put("stor_code", stor_code);
io_mst.put("stor_name", stor_name);
io_mst.put("total_qty", whereJson.get("total_qty"));
io_mst.put("detail_count", whereJson.get("detail_count"));
io_mst.put("detail_count", rows.size());
io_mst.put("remark", whereJson.get("remark"));
io_mst.put("bill_status", whereJson.get("bill_status"));
io_mst.put("create_mode", "01");
@@ -170,6 +170,8 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
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");
total_qty += Double.parseDouble(net_weight);
row.put("box_no", row.get("package_box_sn"));
/*//如果是退货入库,查询对应的包装关系维护交货单号和交货单行号
@@ -204,6 +206,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
map.put("status", "1");
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(map, "package_box_SN = '" + dis.getString("box_no") + "' AND status = '0'");
}
io_mst.put("total_qty", total_qty);
WQLObject.getWQLObject("ST_IVT_IOStorInv").insert(io_mst);
return iostorinv_id;