Browse Source

opt:替换仓库表相关代码替换

master
zds 4 weeks ago
parent
commit
07be76365d
  1. 12
      lms/nladmin-system/src/main/java/org/nl/start/Init.java
  2. 7
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/rest/UserStorController.java
  3. 11
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/UserStorService.java
  4. 49
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/UserStorServiceImpl.java
  5. 6
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/storattr/controller/StorattrController.java
  6. 6
      lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/storattr/service/impl/StorattrServiceImpl.java
  7. 12
      lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java
  8. 60
      lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java
  9. 11
      lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PdaCheckServiceImpl.java
  10. 33
      lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java
  11. 70
      lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryProudDayData.java
  12. 570
      lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryProudDayDataTest.java
  13. 13
      lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/CheckServiceImpl.java
  14. 43
      lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java
  15. 70
      lms/nladmin-system/src/main/java/org/nl/wms/st/returns/service/impl/InAndOutRetrunServiceImpl.java
  16. 2
      lms/nladmin-ui/src/views/wms/basedata/st/userStor/userStor.js

12
lms/nladmin-system/src/main/java/org/nl/start/Init.java

@ -37,7 +37,7 @@ public class Init implements ApplicationRunner {
*/
private void initTwoAttr2(int row_num, int col_all, int layer_all, int row_num_now ,int block_num, int zdepth) {
WQLObject tab = WQLObject.getWQLObject("ST_IVT_StructAttr");
/* WQLObject tab = WQLObject.getWQLObject("ST_IVT_StructAttr");
WQLObject tab2 = WQLObject.getWQLObject("st_ivt_bsrealstorattr");
WQLObject tab3 = WQLObject.getWQLObject("st_ivt_sectattr");
WQLObject tab4 = WQLObject.getWQLObject("sch_base_point");
@ -135,7 +135,7 @@ public class Init implements ApplicationRunner {
}
}
}*/
}
/**
@ -143,7 +143,7 @@ public class Init implements ApplicationRunner {
*/
private void initTwoAttr(int row_num, int col_num, int layer_num, int block_num, String zdepth) {
WQLObject tab = WQLObject.getWQLObject("ST_IVT_StructAttr");
/*WQLObject tab = WQLObject.getWQLObject("ST_IVT_StructAttr");
WQLObject tab2 = WQLObject.getWQLObject("st_ivt_bsrealstorattr");
WQLObject tab3 = WQLObject.getWQLObject("st_ivt_sectattr");
WQLObject tab4 = WQLObject.getWQLObject("sch_base_point");
@ -256,11 +256,11 @@ public class Init implements ApplicationRunner {
}
}
}*/
}
private void createAttr() {
WQLObject tab = WQLObject.getWQLObject("ST_IVT_StructAttr");
/*WQLObject tab = WQLObject.getWQLObject("ST_IVT_StructAttr");
WQLObject tab2 = WQLObject.getWQLObject("st_ivt_bsrealstorattr");
WQLObject tab3 = WQLObject.getWQLObject("st_ivt_sectattr");
WQLObject tab4 = WQLObject.getWQLObject("sch_base_point");
@ -343,7 +343,7 @@ public class Init implements ApplicationRunner {
tab4.insert(jsonPoint);
}
System.out.println("项目启动成功!");
System.out.println("项目启动成功!");*/
}

7
lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/rest/UserStorController.java

@ -27,13 +27,6 @@ public class UserStorController {
return new ResponseEntity<>(userStorService.pageQuery(whereJson, page), HttpStatus.OK);
}
@PostMapping("/queryStor")
@Log("查询所有仓库")
public ResponseEntity<Object> queryStor(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(userStorService.queryStor(whereJson), HttpStatus.OK);
}
@PostMapping("/queryUserStor")
@Log("查询用户对应仓库")

11
lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/UserStorService.java

@ -2,8 +2,10 @@ package org.nl.wms.basedata.st.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.basedata.st.storattr.service.dao.Storattr;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
public interface UserStorService {
@ -16,13 +18,6 @@ public interface UserStorService {
*/
Map<String, Object> pageQuery(Map whereJson, Pageable page);
/**
* 查询所有仓库
*
* @param whereJson /
*/
JSONArray queryStor(JSONObject whereJson);
/**
* 查询用户对应仓库
*
@ -40,7 +35,7 @@ public interface UserStorService {
/**
* 获取人员对应下拉框 普通下拉框
*/
JSONArray getUserStor();
List<Storattr> getUserStor();
/**
* 获取人员对应下拉框 多级下拉框

49
lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/UserStorServiceImpl.java

@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.SecurityUtils;
@ -11,11 +12,12 @@ 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.st.service.UserStorService;
import org.nl.wms.basedata.st.storattr.service.dao.Storattr;
import org.nl.wms.basedata.st.storattr.service.dao.mapper.StorattrMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
/**
* PC端出入库新增
@ -24,7 +26,8 @@ import java.util.Map;
@RequiredArgsConstructor
@Slf4j
public class UserStorServiceImpl implements UserStorService {
@Autowired
private StorattrMapper storattrMapper;
@Override
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
HashMap<String, String> map = new HashMap<>(whereJson);
@ -36,12 +39,6 @@ public class UserStorServiceImpl implements UserStorService {
return jo;
}
@Override
public JSONArray queryStor(JSONObject whereJson) {
JSONArray rows = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_used = '1' AND is_delete = '0'").getResultJSONArray(0);
return rows;
}
@Override
public JSONArray queryUserStor(JSONObject whereJson) {
String user_id = whereJson.getString("user_id");
@ -68,45 +65,31 @@ public class UserStorServiceImpl implements UserStorService {
}
@Override
public JSONArray getUserStor() {
public List<Storattr> getUserStor() {
/*
* 获取人员对应仓库下拉框公共方法 普通下拉框
*/
String currentUserId = SecurityUtils.getCurrentUserId().toString();
WQLObject userStorTab = WQLObject.getWQLObject("st_ivt_userstor");
WQLObject storTab = WQLObject.getWQLObject("st_ivt_bsrealstorattr");
JSONArray userStorArr = userStorTab.query("user_id = '" + currentUserId + "'").getResultJSONArray(0);
int size = userStorArr.size();
// 将仓库id拼成字符串
String stor_id = "";
Set<String> set = new HashSet<>();
for (int i = 0; i < userStorArr.size(); i++) {
JSONObject json = userStorArr.getJSONObject(i);
if (size == 1) {
// 如果只有一条记录
stor_id = "('" + json.getString("stor_id") + "')";
} else {
if (i == 0) {
// 第一条记录拼接
stor_id = "('" + json.getString("stor_id") + "','";
} else {
if ((size - 1) == i) {
// 最后一条记录拼接
stor_id += json.getString("stor_id") + "')";
} else {
stor_id += json.getString("stor_id") + "','";
}
}
}
set.add(json.getString("stor_id"));
}
// 查询仓库下拉框
JSONArray resultJSONArray = new JSONArray();
if (ObjectUtil.isNotEmpty(userStorArr)) {
resultJSONArray = storTab.query("is_delete = '0' and is_used = '1' and stor_id in" + stor_id).getResultJSONArray(0);
List<Storattr> resultJSONArray = new ArrayList<Storattr>();
if (set.size()>0) {
resultJSONArray =storattrMapper.selectList( Wrappers.lambdaQuery(Storattr.class)
.eq(Storattr::getIs_delete, "0")
.eq(Storattr::getIs_used, "1").in(Storattr::getStor_id,set)
);
}
return resultJSONArray;
}

6
lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/storattr/controller/StorattrController.java

@ -35,6 +35,12 @@ public class StorattrController {
return new ResponseEntity<>(storattrService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping("/queryAllStor")
@Log("查询仓库")
//@PreAuthorize("@el.check('Storattr:list')")
public ResponseEntity<Object> queryAll(@RequestParam Map whereJson) {
return new ResponseEntity<>(storattrService.queryAll(whereJson), HttpStatus.OK);
}
@PostMapping
@Log("新增仓库")

6
lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/storattr/service/impl/StorattrServiceImpl.java

@ -62,7 +62,8 @@ public class StorattrServiceImpl extends ServiceImpl<StorattrMapper, Storattr> i
@Override
public List<StorattrDto> queryAll(Map whereJson) {
return BeanUtil.copyProperties(storattrMapper.selectList(null), StorattrDto.class);
return BeanUtil.copyProperties(storattrMapper.selectList(Wrappers.lambdaQuery(Storattr.class)
.eq(Storattr::getIs_delete, "0")), StorattrDto.class);
}
@Override
@ -74,7 +75,8 @@ public class StorattrServiceImpl extends ServiceImpl<StorattrMapper, Storattr> i
@Override
public StorattrDto findByCode(String code) {
Storattr storattr = storattrMapper.selectOne(Wrappers.lambdaQuery(Storattr.class)
.eq(Storattr::getStor_code, code));
.eq(Storattr::getStor_code, code)
.eq(Storattr::getIs_delete, "0"));
return BeanUtil.copyProperties(storattr, StorattrDto.class);
}

12
lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java

@ -48,6 +48,8 @@ import org.nl.wms.basedata.master.materialbase.service.dao.Materialbase;
import org.nl.wms.basedata.master.materialbase.service.dao.mapper.MaterialbaseMapper;
import org.nl.wms.basedata.master.unit.service.dao.Unit;
import org.nl.wms.basedata.master.unit.service.dao.mapper.UnitMapper;
import org.nl.wms.basedata.st.storattr.service.StorattrService;
import org.nl.wms.basedata.st.storattr.service.dto.StorattrDto;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.ext.mes.service.MesToLmsService;
import org.nl.wms.pda.mps.service.InService;
@ -77,6 +79,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
private final InService inService;
@Autowired
private StorattrService storattrService;
@Autowired
private InterfaceBackMapper interfaceBackMapper;
@Autowired
private UnitMapper unitMapper;
@ -1479,7 +1483,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
double detail_count = 0;
String changeinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
JSONObject jsonStor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_code = '" + stor_code + "'").uniqueResult(0);
StorattrDto jsonStor = storattrService.findByCode(stor_code);
if (ObjectUtil.isEmpty(jsonStor)) {
throw new BadRequestException("仓库不存在:" + stor_code);
}
@ -1567,9 +1571,9 @@ public class MesToLmsServiceImpl implements MesToLmsService {
mst_jo.put("buss_type", "2001");
mst_jo.put("bill_type", "2001");
mst_jo.put("biz_date", DateUtil.today());
mst_jo.put("stor_id", jsonStor.getString("stor_id"));
mst_jo.put("stor_code", jsonStor.getString("stor_code"));
mst_jo.put("stor_name", jsonStor.getString("stor_name"));
mst_jo.put("stor_id", jsonStor.getStor_id());
mst_jo.put("stor_code", jsonStor.getStor_code());
mst_jo.put("stor_name", jsonStor.getStor_name());
mst_jo.put("total_qty", total_qty);
mst_jo.put("detail_count", detail_count);
mst_jo.put("bill_status", "10");

60
lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java

@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
@ -18,6 +19,10 @@ import org.nl.wms.basedata.master.materialbase.service.dao.mapper.MaterialbasePr
import org.nl.wms.basedata.master.unit.service.UnitService;
import org.nl.wms.basedata.master.unit.service.dao.Unit;
import org.nl.wms.basedata.master.unit.service.dao.mapper.UnitMapper;
import org.nl.wms.basedata.st.storattr.service.StorattrService;
import org.nl.wms.basedata.st.storattr.service.dao.Storattr;
import org.nl.wms.basedata.st.storattr.service.dao.mapper.StorattrMapper;
import org.nl.wms.basedata.st.storattr.service.dto.StorattrDto;
import org.nl.wms.ext.sap.service.SapToLmsService;
import org.nl.wms.st.inbill.service.CheckOutBillService;
import org.nl.wms.st.inbill.service.RawAssistIStorService;
@ -50,8 +55,10 @@ public class SapToLmsServiceImpl implements SapToLmsService {
private UnitMapper unitMapper;
@Autowired
private UnitService unitService;
@Autowired
private StorattrMapper storattrMapper;
@Autowired
private StorattrService storattrService;
public JSONObject getReCutInfo2(JSONObject json) {
log.info("getReCutInfo的输入参数为:------------------------" + json.toString());
@ -63,8 +70,10 @@ public class SapToLmsServiceImpl implements SapToLmsService {
try {
JSONArray dtl_ja = json.getJSONArray("ITEM");
String LGORT = dtl_ja.getJSONObject(0).getString("LGORT");
JSONObject stor_jo = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("ext_id = '" + LGORT + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(stor_jo)) {
List<Storattr> stor_jos = storattrMapper.selectList(Wrappers.lambdaQuery(Storattr.class)
.eq(Storattr::getExt_id, LGORT)
.eq(Storattr::getIs_delete, "0"));
if (ObjectUtil.isEmpty(stor_jos)) {
result.put("RTYPE", "E");
result.put("RTMSG", "操作失败!" + "未查询到外部标识为:" + LGORT + "对应的仓库!");
result.put("RTOAL", 1);
@ -72,9 +81,9 @@ public class SapToLmsServiceImpl implements SapToLmsService {
return result;
}
jsonMst.put("stor_id", stor_jo.getString("stor_id"));
jsonMst.put("stor_code", stor_jo.getString("stor_code"));
jsonMst.put("stor_name", stor_jo.getString("stor_name"));
jsonMst.put("stor_id", stor_jos.get(0).getStor_id());
jsonMst.put("stor_code", stor_jos.get(0).getStor_code());
jsonMst.put("stor_name", stor_jos.get(0).getStor_name());
jsonMst.put("detail_count", dtl_ja.size());
jsonMst.put("bill_status", "10");
jsonMst.put("create_mode", "03");
@ -162,8 +171,10 @@ public class SapToLmsServiceImpl implements SapToLmsService {
for(String LGORT: storList.keySet()) {
// 查询仓库是否存在
JSONObject stor_jo = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("ext_id = '" + LGORT + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(stor_jo)) {
List<Storattr> stor_jos = storattrMapper.selectList(Wrappers.lambdaQuery(Storattr.class)
.eq(Storattr::getExt_id, LGORT)
.eq(Storattr::getIs_delete, "0"));
if (ObjectUtil.isEmpty(stor_jos)) {
result.put("RTYPE", "E");
result.put("RTMSG", "操作失败!" + "未查询到外部标识为:" + LGORT + "对应的仓库!");
result.put("RTOAL", 1);
@ -173,9 +184,9 @@ public class SapToLmsServiceImpl implements SapToLmsService {
// 组织主表信息
JSONObject jsonMst = new JSONObject();
jsonMst.put("stor_id", stor_jo.getString("stor_id"));
jsonMst.put("stor_code", stor_jo.getString("stor_code"));
jsonMst.put("stor_name", stor_jo.getString("stor_name"));
jsonMst.put("stor_id", stor_jos.get(0).getStor_id());
jsonMst.put("stor_code",stor_jos.get(0).getStor_code());
jsonMst.put("stor_name",stor_jos.get(0).getStor_name());
// 组织明细信息
JSONArray dtls = new JSONArray();
@ -381,17 +392,19 @@ public class SapToLmsServiceImpl implements SapToLmsService {
//获取SAP的存储地点
String LGORT = item.getJSONObject(0).getString("LGORT");
JSONObject stor_jo = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("ext_id = '" + LGORT + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(stor_jo)) {
List<Storattr> stor_jos = storattrMapper.selectList(Wrappers.lambdaQuery(Storattr.class)
.eq(Storattr::getExt_id, LGORT)
.eq(Storattr::getIs_delete, "0"));
if (ObjectUtil.isEmpty(stor_jos)) {
result.put("RTYPE", "E");
result.put("RTMSG", "操作失败!" + "未查询到外部标识为:" + LGORT + "对应的仓库!");
result.put("RTOAL", 1);
result.put("RTDAT", null);
return result;
}
jsonMst.put("stor_id", stor_jo.getString("stor_id"));
jsonMst.put("stor_code", stor_jo.getString("stor_code"));
jsonMst.put("stor_name", stor_jo.getString("stor_name"));
jsonMst.put("stor_id", stor_jos.get(0).getStor_id());
jsonMst.put("stor_code", stor_jos.get(0).getStor_code());
jsonMst.put("stor_name", stor_jos.get(0).getStor_name());
jsonMst.put("detail_count", item.size());
jsonMst.put("bill_status", "10");
jsonMst.put("create_mode", "03");
@ -626,7 +639,6 @@ public class SapToLmsServiceImpl implements SapToLmsService {
log.info("getCannibalize的输入参数为:------------------------" + jo.toString());
JSONObject result = new JSONObject();
WQLObject storTab = WQLObject.getWQLObject("st_ivt_bsrealstorattr"); // 仓库表
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表
// 校验调入仓库和调出仓库是否存在
@ -637,8 +649,8 @@ public class SapToLmsServiceImpl implements SapToLmsService {
throw new BadRequestException("交货单不能为空!");
}
JSONObject jsonStorOut = storTab.query("stor_code = '" + lgort_out + "' and is_used = '1' and is_delete = '0'").uniqueResult(0);
JSONObject jsonStorIn = storTab.query("stor_code = '" + lgort_in + "' and is_used = '1' and is_delete = '0'").uniqueResult(0);
StorattrDto jsonStorOut = storattrService.findByCode(lgort_out);
StorattrDto jsonStorIn = storattrService.findByCode(lgort_in);
if (ObjectUtil.isEmpty(jsonStorOut) || ObjectUtil.isEmpty(jsonStorIn)) {
result.put("RTYPE", "E");
result.put("RTMSG", "操作失败!,调入仓库或调出仓库有误,请检查!");
@ -656,10 +668,10 @@ public class SapToLmsServiceImpl implements SapToLmsService {
jsonMst.put("bill_type", "1004");
jsonMst.put("source_id", jo.getLongValue("ZDBSQD"));
jsonMst.put("source_name", "调拨单");
jsonMst.put("stor_id", jsonStorOut.getString("stor_id"));
jsonMst.put("stor_code", jsonStorOut.getString("stor_code"));
jsonMst.put("stor_name", jsonStorOut.getString("stor_name"));
jsonMst.put("out_stor_id", jsonStorIn.getString("stor_id"));
jsonMst.put("stor_id", jsonStorOut.getStor_id());
jsonMst.put("stor_code", jsonStorOut.getStor_code());
jsonMst.put("stor_name", jsonStorOut.getStor_name());
jsonMst.put("out_stor_id", jsonStorIn.getStor_id());
jsonMst.put("detail_count", 1);
jsonMst.put("bill_status", "10");
jsonMst.put("create_mode", "03");

11
lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PdaCheckServiceImpl.java

@ -13,11 +13,14 @@ 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.basedata.st.service.impl.UserStorServiceImpl;
import org.nl.wms.basedata.st.storattr.service.dao.Storattr;
import org.nl.wms.pda.st.service.PdaCheckService;
import org.nl.wms.st.instor.service.CheckService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author liuxy
* @description 服务实现
@ -156,15 +159,15 @@ public class PdaCheckServiceImpl implements PdaCheckService {
public JSONObject getStor() {
UserStorServiceImpl userStorService = new UserStorServiceImpl();
JSONArray userStor = userStorService.getUserStor();
List<Storattr> userStor = userStorService.getUserStor();
JSONArray resultJSONArray = new JSONArray();
for (int i = 0; i < userStor.size(); i++) {
JSONObject json = userStor.getJSONObject(i);
Storattr json = userStor.get(i);
JSONObject jsonObject = new JSONObject();
jsonObject.put("value", json.getString("stor_id"));
jsonObject.put("text", json.getString("stor_name"));
jsonObject.put("value", json.getStor_id());
jsonObject.put("text", json.getStor_name());
resultJSONArray.add(jsonObject);
}
JSONObject jo = new JSONObject();

33
lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java

@ -8,13 +8,10 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
@ -23,6 +20,8 @@ import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
import org.nl.wms.basedata.st.storattr.service.dao.Storattr;
import org.nl.wms.basedata.st.storattr.service.dao.mapper.StorattrMapper;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.ext.acs.service.impl.AcsToWmsServiceImpl;
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
@ -34,6 +33,7 @@ import org.nl.wms.st.inbill.service.StorPublicService;
import org.nl.wms.st.inbill.service.impl.InbillServiceImpl;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -54,8 +54,6 @@ import java.util.stream.Collectors;
@Slf4j
public class ProductInstorServiceImpl implements ProductInstorService {
private final InbillServiceImpl inbillService;
private final RawAssistIStorService rawAssistIStorService;
private final StorPublicService storPublicService;
@ -67,7 +65,8 @@ public class ProductInstorServiceImpl implements ProductInstorService {
private final WmsToAcsService wmsToAcsService;
private final LmsToMesService lmsToMesService;
@Autowired
private StorattrMapper storattrMapper;
@Override
public JSONObject boxQuery(JSONObject whereJson) {
String box_no = whereJson.getString("box_no");
@ -174,16 +173,22 @@ public class ProductInstorServiceImpl implements ProductInstorService {
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_SN = '" + box_no + "'").uniqueResult(0);
//查询仓库
JSONObject stor = new JSONObject();
List<Storattr> stors = new ArrayList<Storattr>();
LambdaQueryWrapper<Storattr> lam = new LambdaQueryWrapper<Storattr>();
lam.eq(Storattr::getIs_delete,"0");
lam.eq(Storattr::getIs_used,"1");
if ("BC01".equals(sub_jo.getString("ext_code"))) {
stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_delete = '0' AND is_used = '1' AND is_productstore = '0' AND stor_code = 'BC01'").uniqueResult(0);
lam.eq(Storattr::getIs_productstore,"0");
lam.eq(Storattr::getStor_code,sub_jo.getString("ext_code"));
stors = storattrMapper.selectList(lam);
} else {
stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_delete = '0' AND is_used = '1' AND is_productstore = '1'").uniqueResult(0);
lam.eq(Storattr::getIs_productstore,"1");
stors = storattrMapper.selectList(lam);
}
mst_jo.put("stor_id", stor.getString("stor_id"));
mst_jo.put("stor_code", stor.getString("stor_code"));
mst_jo.put("stor_name", stor.getString("stor_name"));
mst_jo.put("stor_id", stors.get(0).getStor_id());
mst_jo.put("stor_code", stors.get(0).getStor_code());
mst_jo.put("stor_name", stors.get(0).getStor_name());
mst_jo.put("detail_count", box_rows.size());
mst_jo.put("total_qty", "0");
mst_jo.put("bill_status", "10"); // 生成
@ -403,7 +408,7 @@ public class ProductInstorServiceImpl implements ProductInstorService {
//直接分配虚拟区货位,并确认
JSONObject struct = WQL.getWO("PDA_ST_01")
.addParam("flag", "3")
.addParam("stor_id", stor.getString("stor_id"))
.addParam("stor_id", stors.get(0).getStor_id())
.addParam("sect_id", "BC01".equals(sub_jo.getString("ext_code")) ? "1712667908095741952" : whereJson.getString("sect_id"))
.process().uniqueResult(0);

70
lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryProudDayData.java

@ -7,19 +7,22 @@ import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
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.SpringContextHolder;
import org.nl.system.service.param.ISysParamService;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.wms.basedata.st.storattr.service.dao.Storattr;
import org.nl.wms.basedata.st.storattr.service.dao.mapper.StorattrMapper;
import org.nl.wms.ext.mes.service.LmsToMesService;
import org.nl.wms.sch.AutoQueryEnum;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@ -32,7 +35,10 @@ public class AutoQueryProudDayData {
private final LmsToMesService lmsToMesService;
private final RedissonClient redissonClient;
@Autowired
private StorattrMapper storattrMapper;
@Autowired
private ISysParamService sysParamService;
@SneakyThrows
public void run() {
RLock lock = redissonClient.getLock(this.getClass().getName());
@ -43,7 +49,7 @@ public class AutoQueryProudDayData {
JSONArray UserList = new JSONArray();
String userList = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("USER_LIST_FEISHU").getValue();
String userList = sysParamService.findByCode("USER_LIST_FEISHU").getValue();
String[] split = userList.split(",");
if (split.length > 0) {
@ -73,15 +79,19 @@ public class AutoQueryProudDayData {
}
public JSONObject data() {
WQLObject storTab = WQLObject.getWQLObject("st_ivt_bsrealstorattr"); // 仓库表
// 查询共多少个仓库
String in_stor_code = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("STOR_CODE_FEISHU").getValue();
JSONArray storArr = storTab.query("is_used = '1' and stor_code in" + in_stor_code).getResultJSONArray(0);
String in_stor_code = sysParamService.findByCode("STOR_CODE_FEISHU").getValue();
String[] strs = in_stor_code.split(",");
List<String> list = Arrays.asList(strs);
List<Storattr> storattrs = storattrMapper.selectList(Wrappers.lambdaQuery(Storattr.class)
.eq(Storattr::getIs_used, "1")
.in(Storattr::getStor_code, list));
// 客户
String custB = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("CUST_B").getValue();
String custC = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("CUST_C").getValue();
String custB = sysParamService.findByCode("CUST_B").getValue();
String custC = sysParamService.findByCode("CUST_C").getValue();
String custBandC = custB + "," + custC;
JSONObject result = new JSONObject(); // 全部数据
@ -104,33 +114,33 @@ public class AutoQueryProudDayData {
// 正常库龄
List<JSONObject> regIvtList = WQL.getWO("AUTOQUERYBILLINFO").addParam("flag", "4").process().getResultJSONArray(0).toJavaList(JSONObject.class);
for (int i = 0; i < storArr.size(); i++) {
JSONObject item = storArr.getJSONObject(i);
for (int i = 0; i < storattrs.size(); i++) {
Storattr item = storattrs.get(i);
JSONObject json = new JSONObject();
json.put("local", item.getString("simple_name")); // 存储地点
json.put("local", item.getSimple_name()); // 存储地点
// 总量
List<JSONObject> collect = allIvtList.stream()
.filter(row -> row.getString("stor_id").equals(item.getString("stor_id")))
.filter(row -> row.getString("stor_id").equals(item.getStor_id()))
.collect(Collectors.toList());
json.put("TotalInventory", collect.isEmpty() ? "0.00" : NumberUtil.round(collect.get(0).getString("num"), 2) + "");
// 超期库存
List<JSONObject> collect2 = sidIvtList.stream()
.filter(row -> row.getString("stor_id").equals(item.getString("stor_id")))
.filter(row -> row.getString("stor_id").equals(item.getStor_id()))
.collect(Collectors.toList());
json.put("OverdueInventory", collect2.isEmpty() ? "0.00" : NumberUtil.round(collect2.get(0).getString("num"), 2) + "");
// 临期库存
List<JSONObject> collect3 = faceIvtList.stream()
.filter(row -> row.getString("stor_id").equals(item.getString("stor_id")))
.filter(row -> row.getString("stor_id").equals(item.getStor_id()))
.collect(Collectors.toList());
json.put("InterimInventory", collect3.isEmpty() ? "0.00" : NumberUtil.round(collect3.get(0).getString("num"), 2) + "");
// 正常库存
List<JSONObject> collect4 = regIvtList.stream()
.filter(row -> row.getString("stor_id").equals(item.getString("stor_id")))
.filter(row -> row.getString("stor_id").equals(item.getStor_id()))
.collect(Collectors.toList());
json.put("NormalStockAge", collect4.isEmpty() ? "0.00" : NumberUtil.round(collect4.get(0).getString("num"), 2) + "");
@ -200,27 +210,27 @@ public class AutoQueryProudDayData {
.addParam("customer_name", "('" + collectAll + "')")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
for (int i = 0; i < storArr.size(); i++) {
JSONObject item = storArr.getJSONObject(i);
for (int i = 0; i < storattrs.size(); i++) {
Storattr item = storattrs.get(i);
JSONObject json = new JSONObject();
json.put("Local", item.getString("simple_name"));
json.put("Local", item.getSimple_name());
// B库存
List<JSONObject> collectB = custIvtBList.stream()
.filter(row -> row.getString("stor_id").equals(item.getString("stor_id")))
.filter(row -> row.getString("stor_id").equals(item.getStor_id()))
.collect(Collectors.toList());
json.put("Customernventory1", collectB.isEmpty() ? "0.00" : NumberUtil.round(collectB.get(0).getString("num"), 2) + "");
// C库存
List<JSONObject> collectC = custIvtCList.stream()
.filter(row -> row.getString("stor_id").equals(item.getString("stor_id")))
.filter(row -> row.getString("stor_id").equals(item.getStor_id()))
.collect(Collectors.toList());
json.put("Customernventory2", collectC.isEmpty() ? "0.00" : NumberUtil.round(collectC.get(0).getString("num"), 2) + "");
// 其他库存
List<JSONObject> collectOthen = custIvtOtherList.stream()
.filter(row -> row.getString("stor_id").equals(item.getString("stor_id")))
.filter(row -> row.getString("stor_id").equals(item.getStor_id()))
.collect(Collectors.toList());
json.put("Customernventory3", collectOthen.isEmpty() ? "0.00" : NumberUtil.round(collectOthen.get(0).getString("num"), 2) + "");
@ -479,18 +489,20 @@ public class AutoQueryProudDayData {
JSONArray Arrayobject6 = new JSONArray();
// 所有仓库
List<JSONObject> storAllArr = storTab.query("is_used = '1'").getResultJSONArray(0).toJavaList(JSONObject.class);
List<Storattr> stors = storattrMapper.selectList(Wrappers.lambdaQuery(Storattr.class)
.eq(Storattr::getIs_used, "1")
.eq(Storattr::getIs_delete, "0"));
// B公司
String in_B = storAllArr.stream()
.filter(row -> row.getString("remark").equals("B"))
.map(row -> row.getString("stor_id"))
String in_B = stors.stream()
.filter(row -> row.getRemark().equals("B"))
.map(row -> row.getStor_id()+"")
.collect(Collectors.joining("','"));
// C公司
String in_C = storAllArr.stream()
.filter(row -> row.getString("remark").equals("C"))
.map(row -> row.getString("stor_id"))
String in_C = stors.stream()
.filter(row -> row.getRemark().equals("C"))
.map(row -> row.getStor_id()+"")
.collect(Collectors.joining("','"));
// B公司当前库存

570
lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoQueryProudDayDataTest.java

@ -1,570 +0,0 @@
package org.nl.wms.sch.manage;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
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.SpringContextHolder;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.wms.ext.mes.service.LmsToMesService;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@Component
@RequiredArgsConstructor
public class AutoQueryProudDayDataTest {
private final LmsToMesService lmsToMesService;
public void run() {
JSONObject param = new JSONObject();
JSONArray UserList = new JSONArray();
String userList = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("USER_LIST_FEISHU").getValue();
String[] split = userList.split(",");
if (split.length > 0) {
for (String s : split) {
JSONObject jo = new JSONObject();
jo.put("User", s);
UserList.add(jo);
}
} else {
JSONObject jo = new JSONObject();
jo.put("User", "");
UserList.add(jo);
}
param.put("UserList", UserList);
param.put("Code", "ctp_AAVwgNuQOtO0");
param.put("card", data());
// 调用接口
lmsToMesService.proudDayData(param);
}
public JSONObject data() {
WQLObject storTab = WQLObject.getWQLObject("st_ivt_bsrealstorattr"); // 仓库表
// 查询共多少个仓库
String in_stor_code = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("STOR_CODE_FEISHU").getValue();
JSONArray storArr = storTab.query("is_used = '1' and stor_code in" + in_stor_code).getResultJSONArray(0);
// 客户
String custB = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("CUST_B").getValue();
String custC = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("CUST_C").getValue();
JSONObject result = new JSONObject(); // 全部数据
result.put("Title", DateUtil.today() + "成品数据(单位:T)");
/*
* 查询各仓库库存
*/
JSONArray Arrayobject1 = new JSONArray(); // 各仓库库存集合
// 库存总量集合
List<JSONObject> allIvtList = WQL.getWO("TEST0001").addParam("flag", "1").process().getResultJSONArray(0).toJavaList(JSONObject.class);
// 超期库存集合
List<JSONObject> sidIvtList = WQL.getWO("TEST0001").addParam("flag", "2").process().getResultJSONArray(0).toJavaList(JSONObject.class);
// 临期库存集合
List<JSONObject> faceIvtList = WQL.getWO("TEST0001").addParam("flag", "3").process().getResultJSONArray(0).toJavaList(JSONObject.class);
// 正常库龄
List<JSONObject> regIvtList = WQL.getWO("TEST0001").addParam("flag", "4").process().getResultJSONArray(0).toJavaList(JSONObject.class);
for (int i = 0; i < storArr.size(); i++) {
JSONObject item = storArr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("local", item.getString("stor_name")); // 存储地点
// 库存总量
List<JSONObject> collect = allIvtList.stream()
.filter(row -> row.getString("stor_id").equals(item.getString("stor_id")))
.collect(Collectors.toList());
json.put("TotalInventory", collect.isEmpty() ? "0" : NumberUtil.round(collect.get(0).getString("num"), 2) + "");
// 超期库存
List<JSONObject> collect2 = sidIvtList.stream()
.filter(row -> row.getString("stor_id").equals(item.getString("stor_id")))
.collect(Collectors.toList());
json.put("OverdueInventory", collect2.isEmpty() ? "0" : NumberUtil.round(collect2.get(0).getString("num"), 2) + "");
// 临期库存
List<JSONObject> collect3 = faceIvtList.stream()
.filter(row -> row.getString("stor_id").equals(item.getString("stor_id")))
.collect(Collectors.toList());
json.put("InterimInventory", collect3.isEmpty() ? "0" : NumberUtil.round(collect3.get(0).getString("num"), 2) + "");
// 正常库存
List<JSONObject> collect4 = regIvtList.stream()
.filter(row -> row.getString("stor_id").equals(item.getString("stor_id")))
.collect(Collectors.toList());
json.put("NormalStockAge", collect4.isEmpty() ? "0" : NumberUtil.round(collect4.get(0).getString("num"), 2) + "");
Arrayobject1.add(json);
}
// 计算全部
JSONObject allIvt = new JSONObject();
allIvt.put("local", "全部");
allIvt.put("TotalInventory", NumberUtil.round(allIvtList.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
allIvt.put("OverdueInventory", NumberUtil.round(sidIvtList.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
allIvt.put("InterimInventory", NumberUtil.round(faceIvtList.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
allIvt.put("NormalStockAge", NumberUtil.round(regIvtList.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
// Arrayobject1.add(allIvt);
result.put("Arrayobject1", Arrayobject1);
/*
* 各客户库存
* 1.表头
* {
* B库存10000708 蕉城时代10000698 江苏时代10000779 四川时代10000561 宁德时代
* C库存10000426 比亚迪2010 海亮股份
* Other库存 除BC客户的其他客户
* }
* 2.数据
*/
// 1.表头:
JSONArray Customernventory = new JSONArray();
JSONObject custHand = new JSONObject();
custHand.put("Customer1", "B库存");
custHand.put("Customer2", "C库存");
custHand.put("Customer3", "Other库存");
Customernventory.add(custHand);
result.put("Customernventory", Customernventory);
// 2.数据
JSONArray Arrayobject2 = new JSONArray();
String[] splitB = custB.split(",");
ArrayList<String> bList = new ArrayList<>(Arrays.asList(splitB));
String collectB1 = String.join("','", bList);
String[] splitC = custC.split(",");
ArrayList<String> cList = new ArrayList<>(Arrays.asList(splitC));
String collectC1 = String.join("','", cList);
String in_cust = custB + "," + custC;
String[] splitAll = in_cust.split(",");
ArrayList<String> aAndBList = new ArrayList<>(Arrays.asList(splitAll));
String collectAll = String.join("','", aAndBList);
// B库存集合
List<JSONObject> custIvtBList = WQL.getWO("TEST0001").addParam("flag", "5")
.addParam("customer_name", "('" + collectB1 + "')")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
// C库存集合
List<JSONObject> custIvtCList = WQL.getWO("TEST0001").addParam("flag", "5")
.addParam("customer_name", "('" + collectC1 + "')")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
// 其他库存集合
List<JSONObject> custIvtOtherList = WQL.getWO("TEST0001").addParam("flag", "6")
.addParam("customer_name", "('" + collectAll + "')")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
for (int i = 0; i < storArr.size(); i++) {
JSONObject item = storArr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("Local", item.getString("stor_name"));
// B库存
List<JSONObject> collectB = custIvtBList.stream()
.filter(row -> row.getString("stor_id").equals(item.getString("stor_id")))
.collect(Collectors.toList());
json.put("Customernventory1", collectB.isEmpty() ? "0" : NumberUtil.round(collectB.get(0).getString("num"), 2) + "");
// C库存
List<JSONObject> collectC = custIvtCList.stream()
.filter(row -> row.getString("stor_id").equals(item.getString("stor_id")))
.collect(Collectors.toList());
json.put("Customernventory2", collectC.isEmpty() ? "0" : NumberUtil.round(collectC.get(0).getString("num"), 2) + "");
// 其他库存
List<JSONObject> collectOthen = custIvtOtherList.stream()
.filter(row -> row.getString("stor_id").equals(item.getString("stor_id")))
.collect(Collectors.toList());
json.put("Customernventory3", collectOthen.isEmpty() ? "0" : NumberUtil.round(collectOthen.get(0).getString("num"), 2) + "");
Arrayobject2.add(json);
}
// 计算全部
JSONObject allCustIvt = new JSONObject();
allCustIvt.put("Local", "全部");
allCustIvt.put("Customernventory1", NumberUtil.round(custIvtBList.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
allCustIvt.put("Customernventory2", NumberUtil.round(custIvtCList.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
allCustIvt.put("Customernventory3", NumberUtil.round(custIvtOtherList.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
// Arrayobject2.add(allCustIvt);
result.put("Arrayobject2", Arrayobject2);
/*
* 库存变化
* 1.表头
* {
* B库存10000708 蕉城时代10000698 江苏时代10000779 四川时代10000561 宁德时代
* C库存10000426 比亚迪2010 海亮股份
* 汇总 所有客户
* }
* 2.数据
*/
// 1.表头
JSONArray Arrayobject3 = new JSONArray();
JSONObject changeIvt = new JSONObject();
changeIvt.put("Customer1", "B客户");
changeIvt.put("Customer2", "C客户");
changeIvt.put("Customer3", "汇总");
Arrayobject3.add(changeIvt);
result.put("Arrayobject3", Arrayobject3);
// 2.数据
JSONArray Arrayobject4 = new JSONArray();
// 所有昨日入库量客户分组集合
List<JSONObject> yesterdayInList = WQL.getWO("TEST0001").addParam("flag", "7")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
// 所有昨日出库量客户分组集合
List<JSONObject> yesterdayOutList = WQL.getWO("TEST0001").addParam("flag", "8")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
// 所有当月入库量客户分组集合
List<JSONObject> monthInList = WQL.getWO("TEST0001").addParam("flag", "9")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
// 所有当月出库量客户分组集合
List<JSONObject> monthOutList = WQL.getWO("TEST0001").addParam("flag", "10")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
// ---- 昨日入库量 ----
JSONObject yesterdayIn = new JSONObject();
yesterdayIn.put("Title", "昨日入库量");
// B客户
List<JSONObject> custBList = yesterdayInList.stream()
.filter(row -> custB.contains(row.getString("customer_name")))
.collect(Collectors.toList());
yesterdayIn.put("Customerqty1", NumberUtil.round(custBList.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
// C客户
List<JSONObject> custCList = yesterdayInList.stream()
.filter(row -> custC.contains(row.getString("customer_name")))
.collect(Collectors.toList());
yesterdayIn.put("Customerqty2", NumberUtil.round(custCList.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
// 汇总
yesterdayIn.put("Customerqty3", NumberUtil.round(yesterdayInList.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
Arrayobject4.add(yesterdayIn);
// ---- 昨日出库量 ----
JSONObject yesterdayOut = new JSONObject();
yesterdayOut.put("Title", "昨日出库量");
// B客户
List<JSONObject> custBList2 = yesterdayOutList.stream()
.filter(row -> custB.contains(row.getString("customer_name")))
.collect(Collectors.toList());
yesterdayOut.put("Customerqty1", NumberUtil.round(custBList2.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
// C客户
List<JSONObject> custCList2 = yesterdayOutList.stream()
.filter(row -> custC.contains(row.getString("customer_name")))
.collect(Collectors.toList());
yesterdayOut.put("Customerqty2", NumberUtil.round(custCList2.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
// 汇总
yesterdayOut.put("Customerqty3", NumberUtil.round(yesterdayOutList.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
// Arrayobject4.add(yesterdayOut);
// ---- 当月入库量 ----
JSONObject monthdayIn = new JSONObject();
monthdayIn.put("Title", "当月入库量");
// B客户
List<JSONObject> custBList3 = monthInList.stream()
.filter(row -> custB.contains(row.getString("customer_name")))
.collect(Collectors.toList());
monthdayIn.put("Customerqty1", NumberUtil.round(custBList3.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
// C客户
List<JSONObject> custCList3 = monthInList.stream()
.filter(row -> custC.contains(row.getString("customer_name")))
.collect(Collectors.toList());
monthdayIn.put("Customerqty2", NumberUtil.round(custCList3.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
// 汇总
monthdayIn.put("Customerqty3", NumberUtil.round(monthInList.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
Arrayobject4.add(monthdayIn);
// ---- 当月出库量 ----
JSONObject monthdayOut = new JSONObject();
monthdayOut.put("Title", "当月出库量");
// B客户
List<JSONObject> custBList4 = monthOutList.stream()
.filter(row -> custB.contains(row.getString("customer_name")))
.collect(Collectors.toList());
monthdayOut.put("Customerqty1", NumberUtil.round(custBList4.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
// C客户
List<JSONObject> custCList4 = monthOutList.stream()
.filter(row -> custC.contains(row.getString("customer_name")))
.collect(Collectors.toList());
monthdayOut.put("Customerqty2", NumberUtil.round(custCList4.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
// 汇总
monthdayOut.put("Customerqty3", NumberUtil.round(monthOutList.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "");
// Arrayobject4.add(monthdayOut);
result.put("Arrayobject4", Arrayobject4);
/*
* 各区域库存变化
* 数据
* {
* B库存10000708 蕉城时代10000698 江苏时代10000779 四川时代10000561 宁德时代
* C库存10000426 比亚迪2010 海亮股份
* }
* {
* region_code: A1,A2,A3,A4
* }
*/
JSONArray Arrayobject5 = new JSONArray();
// 所有昨日入库量区域分组集合
List<JSONObject> yesterdayInRegList = WQL.getWO("TEST0001").addParam("flag", "11")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
// 所有昨日出库量区域分组集合
List<JSONObject> yesterdayOutRegList = WQL.getWO("TEST0001").addParam("flag", "12")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
// 所有昨日入库量区域、客户分组集合
List<JSONObject> yesterdayCustInRegList = WQL.getWO("TEST0001").addParam("flag", "13")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
// 所有昨日出库量区域、客户分组集合
List<JSONObject> yesterdayCustOutRegList = WQL.getWO("TEST0001").addParam("flag", "14")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
// 所有当月入库量区域分组集合
List<JSONObject> monthInRegList = WQL.getWO("TEST0001").addParam("flag", "15")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
// 所有当月出库量区域分组集合
List<JSONObject> monthOutRegList = WQL.getWO("TEST0001").addParam("flag", "16")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
// 所有当月入库量区域、客户分组集合
List<JSONObject> monthCustInRegList = WQL.getWO("TEST0001").addParam("flag", "17")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
// 所有当月出库量区域、客户分组集合
List<JSONObject> monthCustOutRegList = WQL.getWO("TEST0001").addParam("flag", "18")
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
// ---- 当月入库量 ----
JSONObject monthRegIn = monthReg(monthInRegList, "当月入库量");
Arrayobject5.add(monthRegIn);
// ---- 当月出库量 ----
JSONObject monthRegOut = monthReg(monthOutRegList, "当月出库量");
Arrayobject5.add(monthRegOut);
// ---- 昨日入库量 ----
JSONObject yesterdayInReg = monthReg(yesterdayInRegList, "昨日入库量");
Arrayobject5.add(yesterdayInReg);
// ---- 昨日出库量 ----
JSONObject yesterdayOutReg = monthReg(yesterdayOutRegList, "昨日出库量");
Arrayobject5.add(yesterdayOutReg);
// ---- B昨日出库量 ----
JSONObject yesterdayCustOutRegB = monthRegCust(yesterdayCustOutRegList, "B昨日出库量", custB);
Arrayobject5.add(yesterdayCustOutRegB);
// ---- B昨日入库量 ----
JSONObject yesterdayCustInRegB = monthRegCust(yesterdayCustInRegList, "B昨日入库量", custB);
Arrayobject5.add(yesterdayCustInRegB);
// ---- B当月入库量 ----
JSONObject monthCustInRegB = monthRegCust(monthCustInRegList, "B当月入库量", custB);
Arrayobject5.add(monthCustInRegB);
// ---- B当月出库量 ----
JSONObject monthCustOutRegB = monthRegCust(monthCustOutRegList, "B当月出库量", custB);
Arrayobject5.add(monthCustOutRegB);
// ---- C昨日出库量 ----
JSONObject yesterdayCustOutRegC = monthRegCust(yesterdayCustOutRegList, "C昨日出库量", custC);
Arrayobject5.add(yesterdayCustOutRegC);
// ---- C昨日入库量 ----
JSONObject yesterdayCustInRegC = monthRegCust(yesterdayCustInRegList, "C昨日入库量", custC);
Arrayobject5.add(yesterdayCustInRegC);
// ---- C当月入库量 ----
JSONObject monthCustInRegC = monthRegCust(monthCustInRegList, "C当月入库量", custC);
Arrayobject5.add(monthCustInRegC);
// ---- C当月出库量 ----
JSONObject monthCustOutRegC = monthRegCust(monthCustOutRegList, "C当月出库量", custC);
Arrayobject5.add(monthCustOutRegC);
result.put("Arrayobject5", Arrayobject5);
return result;
}
/**
* 当月区域公共方法
*
* @param param
* @param title
* @return JSONObject
*/
private JSONObject monthReg(List<JSONObject> param, String title) {
JSONObject result = new JSONObject();
result.put("Title", title);
Map<String, List<JSONObject>> paramMap = param.stream()
.collect(Collectors.groupingBy(row -> row.getString("region_code")));
if (paramMap.isEmpty()) {
result.put("Areaqty1", "0");
result.put("Areaqty2", "0");
result.put("Areaqty3", "0");
result.put("Areaqty4", "0");
}
for (String region_code : paramMap.keySet()) {
List<JSONObject> list = paramMap.get(region_code);
String num = NumberUtil.round(list.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "";
switch (region_code) {
case "A1":
result.put("Areaqty1", num);
break;
case "A2":
result.put("Areaqty2", num);
break;
case "A3":
result.put("Areaqty3", num);
break;
case "A4":
result.put("Areaqty4", num);
break;
default:
break;
}
}
if (ObjectUtil.isEmpty(result.getString("Areaqty1"))) {
result.put("Areaqty1", "0");
}
if (ObjectUtil.isEmpty(result.getString("Areaqty2"))) {
result.put("Areaqty2", "0");
}
if (ObjectUtil.isEmpty(result.getString("Areaqty3"))) {
result.put("Areaqty3", "0");
}
if (ObjectUtil.isEmpty(result.getString("Areaqty4"))) {
result.put("Areaqty4", "0");
}
return result;
}
/**
* 当月区域客户公共方法
*
* @param param
* @param title
* @param customer 客户
* @return JSONObject
*/
private JSONObject monthRegCust(List<JSONObject> param, String title, String customer) {
JSONObject result = new JSONObject();
result.put("Title", title);
Map<String, List<JSONObject>> paramMap = param.stream()
.collect(Collectors.groupingBy(row -> row.getString("region_code")));
if (paramMap.isEmpty()) {
result.put("Areaqty1", "0");
result.put("Areaqty2", "0");
result.put("Areaqty3", "0");
result.put("Areaqty4", "0");
}
for (String region_code : paramMap.keySet()) {
List<JSONObject> list = paramMap.get(region_code);
List<JSONObject> custList = list.stream()
.filter(row -> customer.contains(row.getString("customer_name")))
.collect(Collectors.toList());
String num = NumberUtil.round(custList.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.0).toString(), 2) + "";
switch (region_code) {
case "A1":
result.put("Areaqty1", num);
break;
case "A2":
result.put("Areaqty2", num);
break;
case "A3":
result.put("Areaqty3", num);
break;
case "A4":
result.put("Areaqty4", num);
break;
default:
break;
}
}
if (ObjectUtil.isEmpty(result.getString("Areaqty1"))) {
result.put("Areaqty1", "0");
}
if (ObjectUtil.isEmpty(result.getString("Areaqty2"))) {
result.put("Areaqty2", "0");
}
if (ObjectUtil.isEmpty(result.getString("Areaqty3"))) {
result.put("Areaqty3", "0");
}
if (ObjectUtil.isEmpty(result.getString("Areaqty4"))) {
result.put("Areaqty4", "0");
}
return result;
}
}

13
lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/CheckServiceImpl.java

@ -17,7 +17,10 @@ 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.st.service.impl.UserStorServiceImpl;
import org.nl.wms.basedata.st.storattr.service.dao.Storattr;
import org.nl.wms.basedata.st.storattr.service.dao.mapper.StorattrMapper;
import org.nl.wms.st.instor.service.CheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -33,7 +36,8 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
@Slf4j
public class CheckServiceImpl implements CheckService {
@Autowired
private StorattrMapper storattrMapper;
@Override
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
@ -540,13 +544,12 @@ public class CheckServiceImpl implements CheckService {
public void allInsert(JSONObject jsonObject) {
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_CheckMst"); // 盘点单主表
WQLObject dtlTab = WQLObject.getWQLObject("ST_IVT_CheckDtl"); // 盘点单明细表
WQLObject storTab = WQLObject.getWQLObject("st_ivt_bsrealstorattr"); // 仓库表
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
Long deptId = SecurityUtils.getDeptId();
JSONObject jsonStor = storTab.query("stor_id = '" + jsonObject.getString("stor_id") + "'").uniqueResult(0);
Storattr jsonStor = storattrMapper.selectById(jsonObject.getString("stor_id"));
// 查找库内所有在库木箱
JSONArray dtlArr = WQL.getWO("QST_IVT_CHECK").addParam("flag", "11")
@ -564,8 +567,8 @@ public class CheckServiceImpl implements CheckService {
jsonMst.put("check_code", CodeUtil.getNewCode("PD_CODE"));
jsonMst.put("buss_type", jsonObject.getString("check_type"));
jsonMst.put("check_type", jsonObject.getString("check_type"));
jsonMst.put("stor_id", jsonStor.getLongValue("stor_id"));
jsonMst.put("stor_name", jsonStor.getString("stor_name"));
jsonMst.put("stor_id", jsonStor.getStor_id());
jsonMst.put("stor_name", jsonStor.getStor_name());
jsonMst.put("dtl_num", dtlArr.size());
jsonMst.put("create_mode", "01");
jsonMst.put("is_nok", "0");

43
lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java

@ -33,6 +33,8 @@ import org.nl.wms.basedata.master.transport.service.ITransportationBaseService;
import org.nl.wms.basedata.master.transport.service.dao.TransportationBase;
import org.nl.wms.basedata.master.transport.service.dao.mapper.TransportationBaseMapper;
import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
import org.nl.wms.basedata.st.storattr.service.dao.Storattr;
import org.nl.wms.basedata.st.storattr.service.dao.mapper.StorattrMapper;
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.tasks.OutTask;
@ -78,6 +80,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
@Autowired
private CustomerbaseMapper customerbaseMapper;
@Autowired
private StorattrMapper storattrMapper;
@Autowired
private TransportationBaseMapper transportationBaseMapper;
@Autowired
private ITransportationBaseService transportationBaseService;
@ -457,7 +461,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
String bill_code = CodeUtil.getNewCode("IO_CODE");
JSONObject jsonStor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id ='" + MapUtil.getStr(map, "stor_id") + "'").uniqueResult(0);
Storattr jsonStor = storattrMapper.selectById(MapUtil.getStr(map, "stor_id"));
map.put("iostorinv_id", iostorinv_id);
map.put("bill_code", bill_code);
map.put("biz_date", map.getString("biz_date").substring(0, 10));
@ -466,8 +470,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
map.put("io_type", "1");
map.put("detail_count", rows.size() + "");
map.put("create_mode", "01");
map.put("stor_code", jsonStor.getString("stor_code"));
map.put("stor_name", jsonStor.getString("stor_name"));
map.put("stor_code", jsonStor.getStor_code());
map.put("stor_name", jsonStor.getStor_name());
map.put("input_optid", currentUserId + "");
map.put("input_optname", nickName);
map.put("input_time", now);
@ -602,7 +606,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
String bill_code = CodeUtil.getNewCode("IO_CODE");
JSONObject jsonStor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id ='" + MapUtil.getStr(map, "stor_id") + "'").uniqueResult(0);
Storattr jsonStor = storattrMapper.selectById(MapUtil.getStr(map, "stor_id"));
map.put("iostorinv_id", iostorinv_id);
map.put("bill_code", bill_code);
map.put("biz_date", map.getString("biz_date").substring(0, 10));
@ -611,8 +615,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
map.put("io_type", "1");
map.put("detail_count", rows.size() + "");
map.put("create_mode", "01");
map.put("stor_code", jsonStor.getString("stor_code"));
map.put("stor_name", jsonStor.getString("stor_name"));
map.put("stor_code", jsonStor.getStor_code());
map.put("stor_name", jsonStor.getStor_name());
map.put("input_optid", currentUserId + "");
map.put("input_optname", nickName);
map.put("input_time", now);
@ -708,7 +712,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
String bill_code = CodeUtil.getNewCode("IO_CODE");
JSONObject jsonStor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id ='" + MapUtil.getStr(map, "stor_id") + "'").uniqueResult(0);
Storattr jsonStor = storattrMapper.selectById(MapUtil.getStr(map, "stor_id"));
map.put("iostorinv_id", iostorinv_id);
map.put("bill_code", bill_code);
map.put("biz_date", map.getString("biz_date").substring(0, 10));
@ -717,8 +721,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
map.put("io_type", "1");
map.put("detail_count", rows.size() + "");
map.put("create_mode", "01");
map.put("stor_code", jsonStor.getString("stor_code"));
map.put("stor_name", jsonStor.getString("stor_name"));
map.put("stor_code", jsonStor.getStor_code());
map.put("stor_name", jsonStor.getStor_name());
map.put("input_optid", currentUserId + "");
map.put("input_optname", nickName);
map.put("input_time", now);
@ -4807,13 +4811,13 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
jo_mst.put("bill_type", "0004");
jo_mst.put("buss_type", ((String) jo_mst.get("bill_type")).substring(0, 4));
//查询移入仓库的信息
JSONObject in_stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id = '" + out_jo.getString("out_stor_id") + "'").uniqueResult(0);
Storattr in_stor = storattrMapper.selectById(out_jo.getString("out_stor_id"));
if (ObjectUtil.isEmpty(in_stor)) {
throw new BadRequestException("未查询到对应的移入仓库信息!");
}
jo_mst.put("stor_id", in_stor.getString("stor_id"));
jo_mst.put("stor_code", in_stor.getString("stor_code"));
jo_mst.put("stor_name", in_stor.getString("stor_name"));
jo_mst.put("stor_id", in_stor.getStor_id());
jo_mst.put("stor_code", in_stor.getStor_code());
jo_mst.put("stor_name", in_stor.getStor_name());
jo_mst.put("bill_status", "30");
jo_mst.put("input_optid", currentUserId + "");
jo_mst.put("input_optname", nickName);
@ -5437,13 +5441,13 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
jo_mst.put("bill_type", "0004");
jo_mst.put("buss_type", ((String) jo_mst.get("bill_type")).substring(0, 4));
//查询移入仓库的信息
JSONObject in_stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id = '" + out_jo.getString("out_stor_id") + "'").uniqueResult(0);
Storattr in_stor = storattrMapper.selectById(out_jo.getString("out_stor_id"));
if (ObjectUtil.isEmpty(in_stor)) {
throw new BadRequestException("未查询到对应的移入仓库信息!");
}
jo_mst.put("stor_id", in_stor.getString("stor_id"));
jo_mst.put("stor_code", in_stor.getString("stor_code"));
jo_mst.put("stor_name", in_stor.getString("stor_name"));
jo_mst.put("stor_id", in_stor.getStor_id());
jo_mst.put("stor_code", in_stor.getStor_code());
jo_mst.put("stor_name", in_stor.getStor_name());
jo_mst.put("bill_status", "30");
jo_mst.put("input_optid", currentUserId + "");
jo_mst.put("input_optname", nickName);
@ -5973,7 +5977,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_IOStorInv"); // 出入库主表
WQLObject dtlTab = WQLObject.getWQLObject("st_ivt_iostorinvdtl"); // 出入库明细表
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation"); // 子卷包装关系表
WQLObject storTab = WQLObject.getWQLObject("st_ivt_bsrealstorattr"); // 实物仓库表
JSONObject jsonMst = mstTab.query("iostorinv_id = '" + MapUtil.getStr(whereJson, "iostorinv_id") + "'").uniqueResult(0);
@ -6008,8 +6011,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
// 调出仓库
oneMap.put("out_stor", jsonMst.getString("stor_code"));
// 调入仓库
JSONObject jsonStor = storTab.query("stor_id = '" + jsonMst.getString("out_stor_id") + "'").uniqueResult(0);
oneMap.put("in_stor", jsonStor.getString("stor_code"));
Storattr jsonStor = storattrMapper.selectById(jsonMst.getString("out_stor_id"));
oneMap.put("in_stor", jsonStor.getStor_code());
}
String pageNow = String.valueOf(j + 1); // 页码

70
lms/nladmin-system/src/main/java/org/nl/wms/st/returns/service/impl/InAndOutRetrunServiceImpl.java

@ -20,10 +20,15 @@ import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.system.service.user.ISysUserService;
import org.nl.system.service.user.dao.SysUser;
import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
import org.nl.wms.basedata.st.storattr.service.StorattrService;
import org.nl.wms.basedata.st.storattr.service.dao.Storattr;
import org.nl.wms.basedata.st.storattr.service.dao.mapper.StorattrMapper;
import org.nl.wms.basedata.st.storattr.service.dto.StorattrDto;
import org.nl.wms.ext.mes.service.LmsToMesService;
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
import org.nl.wms.ext.sap.service.impl.LmsToSapServiceImpl;
import org.nl.wms.st.returns.service.InAndOutReturnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@ -41,7 +46,10 @@ import java.util.stream.Collectors;
public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
private final ISysUserService iSysUserService;
@Autowired
private StorattrMapper storattrMapper;
@Autowired
private StorattrService storattrService;
@Override
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
HashMap map = new HashMap<>(whereJson);
@ -170,9 +178,6 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
String isUpload = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_upload").getValue();
String bill_type = jo_mst.getString("bill_type");
String stor_id = jo_mst.getString("stor_id");
JSONObject stor_jo = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("stor_id = '" + stor_id + "'").uniqueResult(0);
String lgort = stor_jo.getString("ext_id");
String is_productstore = stor_jo.getString("is_productstore");
//生产入库
if (StrUtil.equals(bill_type, "0001") || StrUtil.equals(bill_type, "0007")) {
@ -285,7 +290,6 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
}
// 销售出库
// if (StrUtil.equals(bill_type, "1001") && is_productstore.equals("1")) {
if (StrUtil.equals(bill_type, "1001")) {
// 2.回传mes
JSONObject paramMesMst = new JSONObject();
@ -323,7 +327,6 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
}
// 调拨出库
// if (StrUtil.equals(bill_type, "1004") && is_productstore.equals("1")) {
if (StrUtil.equals(bill_type, "1004")) {
// 2.回传mes
JSONObject paramMesMst = new JSONObject();
@ -410,8 +413,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
List<JSONObject> disList = WQLObject.getWQLObject("st_ivt_iostorinvdis").query("box_no in ('" + box_no_in + "') and iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0).toJavaList(JSONObject.class);
// 查询仓库
JSONObject jsonStor = WQLObject.getWQLObject("st_ivt_bsrealstorattr")
.query("stor_code = '" + jo_mst.getString("stor_code") + "'").uniqueResult(0);
StorattrDto jsonStor = storattrService.findByCode(jo_mst.getString("stor_code"));
for (int j = 0; j < disArr.size(); j++) {
JSONObject param = new JSONObject();
@ -443,7 +445,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
param.put("Items", item);
// 仓库编码
param.put("WareHouse", jsonStor.getString("ext_id"));
param.put("WareHouse", jsonStor.getExt_id());
SpringContextHolder.getBean(LmsToMesServiceImpl.class).ChildScrapUpdate(param);
// 更新分配回传成功
@ -460,30 +462,6 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
jo_mst.put("upload_time", DateUtil.now());
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst);
}
/*// 改切出库
if (StrUtil.equals(bill_type, "1003")) {
JSONArray disArr = wo_dis.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0);
//调用母卷配送到位接口
JSONObject mes_jo = new JSONObject();
//查询该子卷对应的分切计划
//JSONArray cut_rows = WQLObject.getWQLObject("")
JSONObject source_dtl = WQLObject.getWQLObject("st_ivt_iostorinvdtl").query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "' AND IFNULL(source_billdtl_id,'') <> ''").uniqueResult(0);
mes_jo.put("container_name", source_dtl.getString("pcsn"));
mes_jo.put("package_box_sn", source_dtl.getString("box_no"));
mes_jo.put("warehouse", "3");
new LmsToMesServiceImpl().cutPlanMomRollDeliveryComplete(mes_jo);
jo_mst.put("upload_mes", "1");
if (jo_mst.getString("upload_sap").equals("1")) {
jo_mst.put("is_upload", "1");
jo_mst.put("upload_optid", SecurityUtils.getCurrentUserId());
jo_mst.put("upload_time", DateUtil.now());
}
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst);
}*/
}
}
}
@ -512,9 +490,9 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
if (StrUtil.equals(isUpload, "1")) {
String bill_type = jo_mst.getString("bill_type");
String stor_id = jo_mst.getString("stor_id");
JSONObject stor_jo = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("stor_id = '" + stor_id + "'").uniqueResult(0);
String lgort = stor_jo.getString("ext_id");
String is_productstore = stor_jo.getString("is_productstore");
Storattr stor_jo = storattrMapper.selectById(stor_id);
String lgort = stor_jo.getExt_id();
String is_productstore = stor_jo.getIs_productstore();
//退货入库
if (StrUtil.equals(bill_type, "0002")) {
// 1.回传sap
@ -742,8 +720,8 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
param.put("ZDBSQD", jsonDtl.getString("vbeln"));
param.put("LGORT2", jo_mst.getString("stor_code"));
JSONObject jsonStorOut = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id = '" + jo_mst.getString("out_stor_id") + "'").uniqueResult(0);
param.put("LGORT1", jsonStorOut.getString("stor_code"));
Storattr jsonStorOut = storattrMapper.selectById(jo_mst.getString("out_stor_id"));
param.put("LGORT1", jsonStorOut.getStor_code());
for (int j = 0; j < disArr.size(); j++) {
JSONObject jsonDis = disArr.getJSONObject(j);
@ -1008,9 +986,8 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
JSONObject jo_mst = rows.getJSONObject(i);
String bill_type = jo_mst.getString("bill_type");
String stor_id = jo_mst.getString("stor_id");
JSONObject stor_jo = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("stor_id = '" + stor_id + "'").uniqueResult(0);
String lgort = stor_jo.getString("ext_id");
String is_productstore = stor_jo.getString("is_productstore");
Storattr stor_jo = storattrMapper.selectById(stor_id);
String lgort = stor_jo.getExt_id();
//生产入库
if (StrUtil.equals(bill_type, "0001") || StrUtil.equals(bill_type, "0007")) {
//1.回传MES
@ -1067,7 +1044,6 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
JSONObject jsonSect = sectTab.query("sect_id = '" + json2.getString("sect_id") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonSect)) {
// jsonDtl.put("LGORT", jsonSect.getString("ext_id")); // 明細储存地点
jsonDtl.put("LGORT", jo_mst.getString("remark")); // 明細储存地点
}
@ -1113,8 +1089,8 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
param.put("ZDBSQD", jsonDtl.getString("vbeln"));
param.put("LGORT2", jo_mst.getString("stor_code"));
JSONObject jsonStorOut = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id = '" + jo_mst.getString("out_stor_id") + "'").uniqueResult(0);
param.put("LGORT1", jsonStorOut.getString("stor_code"));
Storattr jsonStorOut = storattrMapper.selectById(jo_mst.getString("out_stor_id"));
param.put("LGORT1", jsonStorOut.getStor_code());
for (int j = 0; j < disArr.size(); j++) {
JSONObject jsonDis = disArr.getJSONObject(j);
@ -1359,7 +1335,6 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
// 2.回传mes
//if (is_productstore.equals("1")) {
JSONObject paramMesMst = new JSONObject();
String userName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
String passWord = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
@ -1639,8 +1614,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
List<JSONObject> disList = WQLObject.getWQLObject("st_ivt_iostorinvdis").query("box_no in ('" + box_no_in + "') and iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0).toJavaList(JSONObject.class);
// 查询仓库
JSONObject jsonStor = WQLObject.getWQLObject("st_ivt_bsrealstorattr")
.query("stor_code = '" + jo_mst.getString("stor_code") + "'").uniqueResult(0);
StorattrDto jsonStor = storattrService.findByCode(jo_mst.getString("stor_code"));
for (int j = 0; j < disArr.size(); j++) {
JSONObject param = new JSONObject();
@ -1672,7 +1646,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
param.put("Items", item);
// 仓库编码
param.put("WareHouse", jsonStor.getString("ext_id"));
param.put("WareHouse", jsonStor.getExt_id());
SpringContextHolder.getBean(LmsToMesServiceImpl.class).ChildScrapUpdate(param);
// 更新分配回传成功

2
lms/nladmin-ui/src/views/wms/basedata/st/userStor/userStor.js

@ -2,7 +2,7 @@ import request from '@/utils/request'
export function queryStor(data) {
return request({
url: '/api/userStor/queryStor',
url: '/api/Storattr/queryAllStor',
method: 'post',
data
})

Loading…
Cancel
Save