修改
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,52 @@
|
||||
|
||||
package org.nl.wms.st.inbill.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.st.inbill.service.OutChargeService;
|
||||
import org.nl.wms.st.inbill.service.RegionioInService;
|
||||
import org.nl.wms.st.inbill.service.dto.RegionioDto;
|
||||
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-08-11
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "出库冲销")
|
||||
@RequestMapping("/api/outcharge")
|
||||
@Slf4j
|
||||
public class OutChargeController {
|
||||
|
||||
private final OutChargeService outChargeService;
|
||||
|
||||
@GetMapping
|
||||
@Log("出库单查询")
|
||||
@ApiOperation("出库单查询")
|
||||
//@PreAuthorize("@el.check('regionio:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(outChargeService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/charge")
|
||||
@Log("冲销")
|
||||
@ApiOperation("冲销")
|
||||
//@PreAuthorize("@el.check('regionio:add')")
|
||||
public ResponseEntity<Object> charge(@RequestBody Map whereJson) {
|
||||
outChargeService.charge(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
package org.nl.wms.st.inbill.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.st.inbill.service.dto.RegionioDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务接口
|
||||
* @date 2022-08-11
|
||||
**/
|
||||
public interface OutChargeService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @return Regionio
|
||||
*/
|
||||
void charge(@RequestBody Map whereJson);
|
||||
|
||||
}
|
||||
@@ -173,5 +173,9 @@ public class InbillServiceImpl {
|
||||
|
||||
//更新主表状态为99
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst_jo);
|
||||
|
||||
//回传MES
|
||||
|
||||
//回传SAP
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
|
||||
package org.nl.wms.st.inbill.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.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.pdm.service.DeviceService;
|
||||
import org.nl.wms.pdm.service.dto.DeviceDto;
|
||||
import org.nl.wms.st.inbill.service.OutChargeService;
|
||||
import org.nl.wms.st.inbill.service.RegionioInService;
|
||||
import org.nl.wms.st.inbill.service.dto.RegionioDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务实现
|
||||
* @date 2022-08-11
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class OutChargeServiceImpl implements OutChargeService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String bill_code = MapUtil.getStr(whereJson, "bill_code");
|
||||
String vehicle_code = MapUtil.getStr(whereJson, "vehicle_code");
|
||||
String material_code = MapUtil.getStr(whereJson, "material_code");
|
||||
String pcsn = MapUtil.getStr(whereJson, "pcsn");
|
||||
String start_point_code = MapUtil.getStr(whereJson, "start_point_code");
|
||||
String end_point_code = MapUtil.getStr(whereJson, "end_point_code");
|
||||
String start_region_code = MapUtil.getStr(whereJson, "start_region_code");
|
||||
String end_region_code = MapUtil.getStr(whereJson, "end_region_code");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "15");
|
||||
map.put("bill_status", MapUtil.getStr(whereJson, "bill_status"));
|
||||
if (ObjectUtil.isNotEmpty(bill_code)) map.put("bill_code", bill_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(vehicle_code)) map.put("vehicle_code", vehicle_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(material_code)) map.put("material_code", material_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(pcsn)) map.put("pcsn", pcsn + "%");
|
||||
if (ObjectUtil.isNotEmpty(start_point_code)) map.put("start_point_code", start_point_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(end_point_code)) map.put("end_point_code", end_point_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(start_region_code)) map.put("start_region_code", start_region_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(end_region_code)) map.put("end_region_code", end_region_code + "%");
|
||||
|
||||
JSONObject json = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ios.bill_code DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void charge(Map whereJson) {
|
||||
WQLObject dtl_wql = WQLObject.getWQLObject("st_ivt_iostorinvdtl");
|
||||
WQLObject mst_wql = WQLObject.getWQLObject("ST_IVT_IOStorInv");
|
||||
WQLObject dis_wql = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
//更新销售出库为已冲销
|
||||
String old_ios = (String) whereJson.get("iostorinv_id");
|
||||
HashMap mst_map = new HashMap();
|
||||
mst_map.put("is_writeoff", "1");
|
||||
mst_wql.update(mst_map, "iostorinv_id = '" + old_ios + "'");
|
||||
|
||||
//校验主表状态为生成
|
||||
JSONObject mst_jo = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '" + whereJson.get("iostorinv_id") + "'").uniqueResult(0);
|
||||
if (!mst_jo.getString("bill_status").equals("99")) {
|
||||
throw new BadRequestException("主表状态必须为完成!");
|
||||
}
|
||||
|
||||
JSONObject mst_row = mst_wql.query("iostorinv_id = '" + whereJson.get("iostorinv_id") + "'").uniqueResult(0);
|
||||
JSONArray dis_rows = dis_wql.query("iostorinv_id = '" + whereJson.get("iostorinv_id") + "'").getResultJSONArray(0);
|
||||
|
||||
//生成手工入库单
|
||||
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
String bill_code = CodeUtil.getNewCode("IO_CODE");
|
||||
whereJson.put("iostorinv_id", iostorinv_id);
|
||||
whereJson.put("bill_code", bill_code);
|
||||
whereJson.put("io_type", "0");
|
||||
whereJson.put("bill_type", "0009");
|
||||
whereJson.put("buss_type", ((String) whereJson.get("bill_type")).substring(0, 4));
|
||||
whereJson.put("bill_status", "30");
|
||||
whereJson.put("input_optid", currentUserId + "");
|
||||
whereJson.put("input_optname", nickName);
|
||||
whereJson.put("input_time", now);
|
||||
whereJson.put("update_optid", currentUserId + "");
|
||||
whereJson.put("update_optname", nickName);
|
||||
whereJson.put("update_time", now);
|
||||
mst_wql.insert(whereJson);
|
||||
|
||||
for (int i = 0; i < dis_rows.size(); i++) {
|
||||
//插入明细表
|
||||
String iostorinvdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
JSONObject dis_row = dis_rows.getJSONObject(i);
|
||||
//查询对应的出库单明细
|
||||
JSONObject dtl_row = dtl_wql.query("iostorinvdtl_id = '" + dis_row.getString("iostorinvdtl_id") + "'").uniqueResult(0);
|
||||
dis_row.put("iostorinvdtl_id", iostorinvdtl_id);
|
||||
dis_row.put("iostorinv_id", iostorinv_id);
|
||||
dis_row.put("seq_no", i + 1);
|
||||
dis_row.put("bill_status", "30");
|
||||
dis_row.put("real_qty", "0");
|
||||
dis_row.put("source_billdtl_id", dtl_row.getString("iostorinvdtl_id"));
|
||||
dis_row.put("source_bill_type", mst_row.getString("bill_type"));
|
||||
dis_row.put("source_bill_code", mst_row.getString("bill_code"));
|
||||
dis_row.put("source_bill_table", "ST_IVT_IOStorInvDtl");
|
||||
dis_row.put("vbeln", dtl_row.getString("vbeln"));
|
||||
dis_row.put("posnr", dtl_row.getString("posnr"));
|
||||
dis_row.put("assign_qty", dis_row.getString("plan_qty"));
|
||||
dis_row.put("unassign_qty", "0");
|
||||
//插入手工入库明细表
|
||||
dtl_wql.insert(dis_row);
|
||||
|
||||
dis_row.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
dis_row.put("seq_no", 1);
|
||||
dis_row.put("sect_id", "");
|
||||
dis_row.put("sect_code", "");
|
||||
dis_row.put("sect_name", "");
|
||||
dis_row.put("struct_id", "");
|
||||
dis_row.put("struct_code", "");
|
||||
dis_row.put("struct_name", "");
|
||||
dis_row.put("work_status", "00");
|
||||
dis_row.put("real_qty", "0");
|
||||
//插入分配表
|
||||
dis_wql.insert(dis_row);
|
||||
|
||||
|
||||
//将包装关系中对应的记录状态改为包装
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("status", "1");
|
||||
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(map, "package_box_SN = '" + dis_row.getString("box_no") + "' AND status = '0'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
map.put("end_time", end_time);
|
||||
}
|
||||
|
||||
JSONObject jo = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "input_time desc");
|
||||
JSONObject jo = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "bill_code desc");
|
||||
return jo;
|
||||
}
|
||||
|
||||
|
||||
@@ -555,6 +555,47 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "15"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
ios.*
|
||||
FROM
|
||||
ST_IVT_IOStorInv ios
|
||||
WHERE
|
||||
ios.is_delete = '0'
|
||||
AND
|
||||
ios.io_type = '1'
|
||||
AND
|
||||
ios.is_writeoff = '0'
|
||||
AND
|
||||
ios.bill_status = '99'
|
||||
AND
|
||||
ios.bill_type = '1001'
|
||||
OPTION 输入.bill_code <> ""
|
||||
ios.bill_code like 输入.bill_code
|
||||
ENDOPTION
|
||||
OPTION 输入.stor_id <> ""
|
||||
ios.stor_id = 输入.stor_id
|
||||
ENDOPTION
|
||||
OPTION 输入.bill_type <> ""
|
||||
ios.bill_type = 输入.bill_type
|
||||
ENDOPTION
|
||||
OPTION 输入.create_mode <> ""
|
||||
ios.create_mode = 输入.create_mode
|
||||
ENDOPTION
|
||||
OPTION 输入.bill_status <> ""
|
||||
ios.bill_status = 输入.bill_status
|
||||
ENDOPTION
|
||||
OPTION 输入.begin_time <> ""
|
||||
ios.input_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
ios.input_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user