代码更新
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
|
||||
package org.nl.wms.basedata.master.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.basedata.master.service.TransportationbaseService;
|
||||
import org.nl.wms.basedata.master.service.dto.TransportationbaseDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @date 2022-11-10
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "运输公司基本信息管理")
|
||||
@RequestMapping("/api/transportationbase")
|
||||
@Slf4j
|
||||
public class TransportationbaseController {
|
||||
|
||||
private final TransportationbaseService transportationbaseService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询运输公司基本信息")
|
||||
@ApiOperation("查询运输公司基本信息")
|
||||
//@SaCheckPermission("@el.check('transportationbase:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(transportationbaseService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增运输公司基本信息")
|
||||
@ApiOperation("新增运输公司基本信息")
|
||||
//@SaCheckPermission("@el.check('transportationbase:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody TransportationbaseDto dto) {
|
||||
transportationbaseService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改运输公司基本信息")
|
||||
@ApiOperation("修改运输公司基本信息")
|
||||
//@SaCheckPermission("@el.check('transportationbase:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody TransportationbaseDto dto) {
|
||||
transportationbaseService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除运输公司基本信息")
|
||||
@ApiOperation("删除运输公司基本信息")
|
||||
//@SaCheckPermission("@el.check('transportationbase:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
transportationbaseService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("删除运输公司基本信息")
|
||||
@ApiOperation("删除运输公司基本信息")
|
||||
@PostMapping("/getTransporta")
|
||||
public ResponseEntity<Object> getTransporta() {
|
||||
return new ResponseEntity<>(transportationbaseService.getTransporta(),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
|
||||
package org.nl.wms.basedata.master.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.nl.wms.basedata.master.service.dto.TransportationbaseDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务接口
|
||||
* @date 2022-11-10
|
||||
**/
|
||||
public interface TransportationbaseService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<TransportationbaseDto>
|
||||
*/
|
||||
List<TransportationbaseDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param cust_id ID
|
||||
* @return Transportationbase
|
||||
*/
|
||||
TransportationbaseDto findById(Long cust_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Transportationbase
|
||||
*/
|
||||
TransportationbaseDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(TransportationbaseDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(TransportationbaseDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 获取下拉框
|
||||
*
|
||||
*/
|
||||
JSONArray getTransporta();
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package org.nl.wms.basedata.master.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description /
|
||||
* @date 2022-11-10
|
||||
**/
|
||||
@Data
|
||||
public class TransportationbaseDto implements Serializable {
|
||||
|
||||
/** 物流公司标识 */
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long cust_id;
|
||||
|
||||
/**
|
||||
* 物流公司编码
|
||||
*/
|
||||
private String cust_code;
|
||||
|
||||
/**
|
||||
* 物流公司名称
|
||||
*/
|
||||
private String cust_name;
|
||||
|
||||
/**
|
||||
* 物流公司简称
|
||||
*/
|
||||
private String cust_simple_name;
|
||||
|
||||
/**
|
||||
* 国家
|
||||
*/
|
||||
private String country;
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 传真
|
||||
*/
|
||||
private String faxnumber;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String webSite;
|
||||
|
||||
/**
|
||||
* 法人代表
|
||||
*/
|
||||
private String jurid_name;
|
||||
|
||||
/**
|
||||
* 税务登记号
|
||||
*/
|
||||
private String tax_no;
|
||||
|
||||
/**
|
||||
* 工商注册号
|
||||
*/
|
||||
private String register_no;
|
||||
|
||||
/**
|
||||
* 经营许可证号
|
||||
*/
|
||||
private String manage_lice_no;
|
||||
|
||||
/**
|
||||
* 营业执照
|
||||
*/
|
||||
private String busi_char_name;
|
||||
|
||||
/**
|
||||
* 行政区划
|
||||
*/
|
||||
private Long area_id;
|
||||
|
||||
/**
|
||||
* 邮政编码
|
||||
*/
|
||||
private String zip_code;
|
||||
|
||||
/**
|
||||
* 公司电话
|
||||
*/
|
||||
private String corp_tele_no;
|
||||
|
||||
/**
|
||||
* 公司地址
|
||||
*/
|
||||
private String corp_address;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 启用时间
|
||||
*/
|
||||
private String is_used_time;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_used;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
private String ext_id;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
|
||||
package org.nl.wms.basedata.master.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
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.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.basedata.master.service.TransportationbaseService;
|
||||
import org.nl.wms.basedata.master.service.dto.TransportationbaseDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务实现
|
||||
* @date 2022-11-10
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class TransportationbaseServiceImpl implements TransportationbaseService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
|
||||
String cust_code = MapUtil.getStr(whereJson, "cust_code");
|
||||
String cust_name = MapUtil.getStr(whereJson, "cust_name");
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "1");
|
||||
map.put("is_used",MapUtil.getStr(whereJson,"is_used"));
|
||||
if (ObjectUtil.isNotEmpty(cust_code)) map.put("cust_code","%"+cust_code+"%");
|
||||
if (ObjectUtil.isNotEmpty(cust_name)) map.put("cust_name","%"+cust_name+"%");
|
||||
JSONObject json = WQL.getWO("QMD_CS_TRANSPORAIONL").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time ASC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TransportationbaseDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_transportationbase");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(TransportationbaseDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransportationbaseDto findById(Long cust_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_transportationbase");
|
||||
JSONObject json = wo.query("cust_id = '" + cust_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(TransportationbaseDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransportationbaseDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_transportationbase");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(TransportationbaseDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(TransportationbaseDto dto) {
|
||||
WQLObject tab = WQLObject.getWQLObject("MD_CS_TransportationBase");
|
||||
|
||||
JSONObject jsonObject = tab.query("cust_code = '" + dto.getCust_code() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonObject)) throw new BadRequestException("此编码已存在");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setCust_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_transportationbase");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TransportationbaseDto dto) {
|
||||
TransportationbaseDto entity = this.findById(dto.getCust_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_transportationbase");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_transportationbase");
|
||||
for (Long cust_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("cust_id", String.valueOf(cust_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getTransporta() {
|
||||
JSONArray resultJSONArray = WQL.getWO("QMD_CS_TRANSPORAIONL").addParam("flag", "2").process().getResultJSONArray(0);
|
||||
return resultJSONArray;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
[交易说明]
|
||||
交易名: 物流公司基本信息分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.cust_code TYPEAS s_string
|
||||
输入.cust_name TYPEAS s_string
|
||||
输入.is_used TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
MD_CS_TransportationBase
|
||||
WHERE
|
||||
is_delete = '0'
|
||||
|
||||
OPTION 输入.cust_code <> ""
|
||||
cust_code like 输入.cust_code
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.cust_name <> ""
|
||||
cust_name like 输入.cust_name
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.is_used <> ""
|
||||
is_used = 输入.is_used
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
cust_code AS value,
|
||||
cust_name AS label
|
||||
FROM
|
||||
MD_CS_TransportationBase
|
||||
WHERE
|
||||
is_delete = '0'
|
||||
AND is_used = '1'
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package org.nl.wms.ext.sap.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.core.bean.WQLObject;
|
||||
import org.nl.wms.ext.sap.service.SapToLmsService;
|
||||
import org.nl.wms.log.LokiLog;
|
||||
import org.nl.wms.log.LokiLogType;
|
||||
import org.nl.wms.st.inbill.service.CheckOutBillService;
|
||||
import org.nl.wms.st.outbill.service.impl.CheckOutBillServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@@ -16,6 +20,8 @@ import org.springframework.stereotype.Service;
|
||||
@Slf4j
|
||||
public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
|
||||
private final CheckOutBillService checkOutBillService;
|
||||
|
||||
@LokiLog(type = LokiLogType.SAP_TO_LMS)
|
||||
@Override
|
||||
public JSONObject getMaterialInfo(JSONArray rows) {
|
||||
@@ -36,17 +42,70 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
@LokiLog(type = LokiLogType.SAP_TO_LMS)
|
||||
@Override
|
||||
public JSONObject getDeliveryInfo(JSONObject jo) {
|
||||
|
||||
log.info("getDeliveryInfo的输入参数为:------------------------" + jo.toString());
|
||||
/*for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
|
||||
}*/
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表
|
||||
WQLObject unitTab = WQLObject.getWQLObject("md_pb_measureunit"); // 基础单位表
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
|
||||
try {
|
||||
JSONArray item = jo.getJSONArray("ITEM");
|
||||
|
||||
JSONObject jsonMst = new JSONObject();
|
||||
jsonMst.put("stor_id","1582991156504039424");
|
||||
jsonMst.put("stor_code","CP01");
|
||||
jsonMst.put("stor_name","成品仓库");
|
||||
jsonMst.put("detail_count",item.size());
|
||||
jsonMst.put("bill_status","10");
|
||||
jsonMst.put("create_mode","03");
|
||||
|
||||
JSONArray tableData = new JSONArray();
|
||||
|
||||
String lfart = "";
|
||||
for (int i = 0; i < item.size(); i++) {
|
||||
JSONObject json = item.getJSONObject(i);
|
||||
lfart = json.getString("LFART");
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
if (StrUtil.equals(lfart, "ZLF")) {
|
||||
// 生成出库单
|
||||
jsonMst.put("io_type", "1");
|
||||
jsonMst.put("buss_type", "1001");
|
||||
jsonMst.put("bill_type", "1001");
|
||||
jsonMst.put("source_id", json.getLongValue("VBELN"));
|
||||
jsonMst.put("source_name", "交货单");
|
||||
jsonMst.put("source_type", lfart);
|
||||
|
||||
// 明细
|
||||
JSONObject jsonMater = materTab.query("material_code = '" + json.getString("MATNR") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("此物料不存在"+json.getString("MATNR"));
|
||||
JSONObject jsonUnit = unitTab.query("measure_unit_id = '" + jsonMater.getString("base_unit_id") + "'").uniqueResult(0);
|
||||
|
||||
jsonDtl.put("material_id",jsonMater.getString("material_id"));
|
||||
jsonDtl.put("qty_unit_id",jsonMater.getLongValue("base_unit_id"));
|
||||
jsonDtl.put("qty_unit_name",jsonUnit.getString("unit_name"));
|
||||
jsonDtl.put("plan_qty",json.getDoubleValue("LFIMG"));
|
||||
jsonDtl.put("source_bill_code",json.getString("VGBEL-VGPOS"));
|
||||
tableData.add(jsonDtl);
|
||||
}
|
||||
}
|
||||
jsonMst.put("tableData", tableData);
|
||||
|
||||
if (StrUtil.equals(lfart, "ZLF")) {
|
||||
// 调用出库新增
|
||||
checkOutBillService.insertDtl(jsonMst);
|
||||
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("RTYPE", "E");
|
||||
result.put("RTMSG", "操作失败!"+e.getMessage());
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
@@ -20,6 +21,8 @@ import org.nl.wms.st.inbill.service.CheckOutBillService;
|
||||
import org.nl.wms.st.inbill.service.impl.InbillServiceImpl;
|
||||
import org.nl.wms.st.inbill.service.impl.RawAssistIStorServiceImpl;
|
||||
import org.nl.wms.st.outbill.service.impl.CheckOutBillServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
@@ -27,6 +30,8 @@ import java.util.*;
|
||||
/**
|
||||
* Created by Lxy on 2021/12/22.
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class OutTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = OutTask.class.getName();
|
||||
|
||||
@@ -88,7 +93,7 @@ public class OutTask extends AbstractAcsTask {
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
// 调用标识完成
|
||||
CheckOutBillServiceImpl checkOutBillService = new CheckOutBillServiceImpl(null,null,null);
|
||||
CheckOutBillService checkOutBillService = SpringContextHolder.getBean(CheckOutBillService.class);
|
||||
checkOutBillService.finishTask(jsonTask);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.tasks.OutTask;
|
||||
import org.nl.wms.st.inbill.service.CheckOutBillService;
|
||||
import org.nl.wms.st.inbill.service.StorPublicService;
|
||||
import org.nl.wms.st.instor.service.HandMoveStorService;
|
||||
import org.nl.wms.st.instor.task.HandMoveStorAcsTask;
|
||||
@@ -720,10 +721,11 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
OutTask checkOutBillAcsTask = new OutTask();
|
||||
// OutTask checkOutBillAcsTask = new OutTask();
|
||||
String task_id = whereJson.getString("task_id");
|
||||
String taskdtl_id = whereJson.getString("taskdtl_id");
|
||||
JSONObject result = checkOutBillAcsTask.notifyAcs(taskdtl_id);
|
||||
// JSONObject result = checkOutBillAcsTask.notifyAcs(taskdtl_id);
|
||||
JSONObject result = null;
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
String status = result.getString("status");
|
||||
if ("200".equals(status)) {
|
||||
|
||||
@@ -11,10 +11,15 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.domain.Param;
|
||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
|
||||
import org.nl.wms.ext.sap.service.impl.LmsToSapServiceImpl;
|
||||
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.service.dto.TaskDto;
|
||||
@@ -43,6 +48,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
private final StorPublicService storPublicService;
|
||||
private final RawAssistIStorService rawAssistIStorService;
|
||||
private final HandMoveStorService handMoveStorService;
|
||||
private final OutTask outTask;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
|
||||
@@ -237,6 +243,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
jsonDtl.put("qty_unit_name", row.getString("qty_unit_name"));
|
||||
jsonDtl.put("plan_qty", row.get("plan_qty"));
|
||||
jsonDtl.put("remark", row.getString("remark"));
|
||||
jsonDtl.put("source_bill_code", row.getString("source_bill_code"));
|
||||
jsonDtl.put("assign_qty", "0");
|
||||
jsonDtl.put("unassign_qty", row.get("plan_qty"));
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl);
|
||||
@@ -1038,7 +1045,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
param.put("task_group_id", ""); // 任务组
|
||||
param.put("sort_seq", ""); // 任务组顺序号
|
||||
|
||||
OutTask outTask = new OutTask();
|
||||
String create_task_id = outTask.createTask(param);
|
||||
|
||||
// 更新分配状态、任务标识、出库点位
|
||||
@@ -1507,6 +1513,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");
|
||||
//出库主表
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv");
|
||||
// 物料表
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
|
||||
String iostorinv_id = form.getString("iostorinv_id");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
@@ -1597,6 +1605,127 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
from_start.put("storagevehicle_code", "");
|
||||
storPublicService.updateStructAndPoint(from_start);
|
||||
}
|
||||
|
||||
/*
|
||||
* 回传:
|
||||
* 销售出库:sap、mes
|
||||
* 改切出库:sap
|
||||
*/
|
||||
String isUpload = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_upload").getValue();
|
||||
if (StrUtil.equals(isUpload, "1")) {
|
||||
String bill_type = jo_mst.getString("bill_type");
|
||||
// 销售出库
|
||||
if (StrUtil.equals(bill_type, "1001")) {
|
||||
// 1.回传sap
|
||||
JSONObject paramSapMst = new JSONObject();
|
||||
paramSapMst.put("ZACTION", "P");
|
||||
paramSapMst.put("VBELN", ""); // 交货
|
||||
paramSapMst.put("BUDAT", jo_mst.getString("biz_date"));
|
||||
paramSapMst.put("ZZYGYF", jo_mst.getString("estimated_freight"));
|
||||
paramSapMst.put("ZZYFGY", jo_mst.getString("trans_code"));
|
||||
|
||||
JSONArray paramDtlArr = new JSONArray();
|
||||
JSONArray dtlArr = wo_dtl.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0);
|
||||
for (int i = 0; i < dtlArr.size(); i++) {
|
||||
JSONArray paramDisArr = new JSONArray();
|
||||
JSONObject json = dtlArr.getJSONObject(i);
|
||||
JSONObject jsonMater = materTab.query("material_id = '" + json.getString("material_id") + "'").uniqueResult(0);
|
||||
|
||||
// 明细
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("VBELN", ""); // 交货
|
||||
jsonDtl.put("POSNR", json.getString("seq_no"));
|
||||
jsonDtl.put("MATNR", jsonMater.getString("material_code"));
|
||||
jsonDtl.put("LGORT", ""); // 储存地点
|
||||
|
||||
// 分配明细
|
||||
JSONArray disArr = wo_dis.query("iostorinvdtl_id = '" + json.getString("iostorinvdtl_id") + "'").getResultJSONArray(0);
|
||||
for (int j = 0; j < disArr.size(); j++) {
|
||||
JSONObject json2 = disArr.getJSONObject(j);
|
||||
JSONObject jsonDis = new JSONObject();
|
||||
|
||||
jsonDis.put("VBELN", ""); // 交货
|
||||
jsonDis.put("POSNR", json2.getString("seq_no"));
|
||||
jsonDis.put("CHARG", json2.getString("pcsn"));
|
||||
jsonDis.put("LFIMG", json.getString("plan_qty"));
|
||||
jsonDis.put("VRKME", json.getString("qty_unit_name"));
|
||||
jsonDis.put("PIKMG", json2.getString("plan_qty"));
|
||||
jsonDis.put("VRKMP", json2.getString("qty_unit_name"));
|
||||
paramDisArr.add(jsonDis);
|
||||
}
|
||||
jsonDtl.put("CHARG_T", paramDisArr);
|
||||
paramDtlArr.add(jsonDtl);
|
||||
}
|
||||
paramSapMst.put("ITEM", paramDtlArr);
|
||||
|
||||
// 调用接口回传
|
||||
new LmsToSapServiceImpl().returnDelivery(paramSapMst);
|
||||
|
||||
// 2.回传mes
|
||||
JSONObject paramMesMst = new JSONObject();
|
||||
String userName = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
|
||||
String passWord = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
|
||||
|
||||
paramMesMst.put("UserName",userName);
|
||||
paramMesMst.put("Password",passWord);
|
||||
paramMesMst.put("OutboundOrderNum",jo_mst.getString("bill_code"));
|
||||
paramMesMst.put("OutboundUser",jo_mst.getString("confirm_optname"));
|
||||
paramMesMst.put("OutboundTime",jo_mst.getString("confirm_time"));
|
||||
|
||||
JSONArray boxArr = WQL.getWO("ST_OUTIVT02").addParam("flag", "2")
|
||||
.addParam("iostorinv_id", jo_mst.getString("iostorinv_id"))
|
||||
.process().getResultJSONArray(0);
|
||||
|
||||
JSONArray paramArr = new JSONArray();
|
||||
for (int i = 0; i < boxArr.size(); i++) {
|
||||
JSONObject json = boxArr.getJSONObject(i);
|
||||
JSONObject jsonBox = new JSONObject();
|
||||
|
||||
jsonBox.put("PackageBoxSN", json.getString("num"));
|
||||
paramArr.add(jsonBox);
|
||||
}
|
||||
paramMesMst.put("item", paramArr);
|
||||
|
||||
// 调用接口回传
|
||||
new LmsToMesServiceImpl().childRollFGOutboundComplete(paramMesMst);
|
||||
}
|
||||
|
||||
// 改切出库
|
||||
if (StrUtil.equals(bill_type, "1003")) {
|
||||
JSONObject paramMst = new JSONObject();
|
||||
JSONArray paramArr = new JSONArray();
|
||||
|
||||
paramMst.put("BLDAT", jo_mst.getString("biz_date"));
|
||||
paramMst.put("BUDAT", jo_mst.getString("biz_date"));
|
||||
paramMst.put("BKTXT", ""); // 凭证抬头文本
|
||||
paramMst.put("XBLNR", ""); // 参考
|
||||
|
||||
JSONArray disArr = wo_dis.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0);
|
||||
for (int i = 0; i < disArr.size(); i++) {
|
||||
JSONObject json = disArr.getJSONObject(i);
|
||||
JSONObject jsonMater = materTab.query("material_id = '" + json.getString("material_id") + "'").uniqueResult(0);
|
||||
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("RSPOS", i+1);
|
||||
jsonDtl.put("MATNR", jsonMater.getString("material_code"));
|
||||
jsonDtl.put("BWART", "311");
|
||||
jsonDtl.put("MENGE", json.getDoubleValue("plan_qty"));
|
||||
jsonDtl.put("MEINS", json.getString("qty_unit_id"));
|
||||
jsonDtl.put("LGORT", ""); // 库存地点
|
||||
jsonDtl.put("CHARG", json.getString("pcsn"));
|
||||
jsonDtl.put("UMLGO", ""); // 收货库存地点
|
||||
jsonDtl.put("UMCHA", json.getString("pcsn"));
|
||||
jsonDtl.put("KDAUF", ""); // 销售订单
|
||||
jsonDtl.put("KDPOS", ""); // 销售订单行项目
|
||||
paramArr.add(jsonDtl);
|
||||
}
|
||||
paramMst.put("item", paramArr);
|
||||
|
||||
// 调用接口回传
|
||||
new LmsToSapServiceImpl().returnMoveDtl(paramMst);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
输入.flag TYPEAS s_string
|
||||
输入.pcsn TYPEAS s_string
|
||||
输入.struct_id TYPEAS s_string
|
||||
输入.iostorinv_id TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
@@ -58,6 +59,24 @@
|
||||
ivt.struct_id = 输入.struct_id
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
count(dis.struct_id) AS num
|
||||
FROM
|
||||
ST_IVT_IOStorInvDis dis
|
||||
WHERE
|
||||
1 = 1
|
||||
group by dis.struct_id
|
||||
|
||||
OPTION 输入.iostorinv_id <> ""
|
||||
dis.iostorinv_id = 输入.iostorinv_id
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
Reference in New Issue
Block a user