修改
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
package org.nl.wms.st.instor.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.annotation.Log;
|
||||
import org.nl.wms.st.instor.service.CheckService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "盘点")
|
||||
@RequestMapping("/api/check")
|
||||
@Slf4j
|
||||
public class CheckController {
|
||||
private final CheckService checkService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询手工移库单")
|
||||
@ApiOperation("查询手工移库单")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(checkService.pageQuery(whereJson,page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getOutBillDtl")
|
||||
@Log("查询移库单")
|
||||
@ApiOperation("查询移库单")
|
||||
public ResponseEntity<Object> getOutBillDtl(@RequestParam Map whereJson){
|
||||
return new ResponseEntity<>(checkService.getOutBillDtl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getOutBillDtl2")
|
||||
@Log("查询移库单")
|
||||
@ApiOperation("查询移库单")
|
||||
public ResponseEntity<Object> getOutBillDtl2(@RequestParam Map whereJson){
|
||||
return new ResponseEntity<>(checkService.getOutBillDtl2(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getOutBillDis")
|
||||
@Log("查询移库单")
|
||||
@ApiOperation("查询移库单")
|
||||
public ResponseEntity<Object> getOutBillDis(@RequestParam Map whereJson){
|
||||
return new ResponseEntity<>(checkService.getOutBillDis(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@Log("删除移库单")
|
||||
@ApiOperation("删除移库单")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
checkService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改移库单")
|
||||
@ApiOperation("修改移库单")
|
||||
public ResponseEntity<Object> update(@RequestBody Map whereJson){
|
||||
checkService.update(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@PostMapping()
|
||||
@Log("新增移库单")
|
||||
@ApiOperation("新增移库单")
|
||||
public ResponseEntity<Object> insertDtl(@RequestBody Map whereJson){
|
||||
checkService.insertDtl(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
@GetMapping("/getStructIvt")
|
||||
@Log("查询可分配库存")
|
||||
@ApiOperation("查询可分配库存")
|
||||
public ResponseEntity<Object> getStructIvt(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(checkService.getStructIvt(whereJson,page), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/confirm")
|
||||
@Log("移库单强制确认")
|
||||
@ApiOperation("移库单强制确认")
|
||||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
|
||||
checkService.confirm(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@GetMapping("/getInvTypes")
|
||||
@Log("查询单据字段")
|
||||
@ApiOperation("查询单据字段")
|
||||
public ResponseEntity<Object> getInvTypes(){
|
||||
return new ResponseEntity<>(checkService.getInvTypes(), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/handdown")
|
||||
@Log("移库单手动下发")
|
||||
@ApiOperation("移库单手动下发")
|
||||
public ResponseEntity<Object> handdown(@RequestBody JSONObject whereJson) {
|
||||
checkService.handdown(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@PostMapping("/saveCheck")
|
||||
@Log("盘点保存")
|
||||
@ApiOperation("盘点保存")
|
||||
public ResponseEntity<Object> saveCheck(@RequestBody JSONObject whereJson) {
|
||||
checkService.saveCheck(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@PostMapping("/process0")
|
||||
@Log("财务为准")
|
||||
@ApiOperation("财务为准")
|
||||
public ResponseEntity<Object> process0(@RequestBody JSONObject whereJson) {
|
||||
checkService.process0(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@PostMapping("/process1")
|
||||
@Log("实物为准")
|
||||
@ApiOperation("实物为准")
|
||||
public ResponseEntity<Object> process1(@RequestBody JSONObject whereJson) {
|
||||
checkService.process1(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void download(HttpServletResponse response,@RequestParam Map whereJson) throws IOException {
|
||||
checkService.download(checkService.getOutBillDtl(whereJson), response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package org.nl.wms.st.instor.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.instor.service.HandMoveStorService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "检验出库")
|
||||
@RequestMapping("/api/handmovestor")
|
||||
@Slf4j
|
||||
public class HandMoveStorController {
|
||||
private final HandMoveStorService handMoveStorService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询手工移库单")
|
||||
@ApiOperation("查询手工移库单")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(handMoveStorService.pageQuery(whereJson,page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getOutBillDtl")
|
||||
@Log("查询移库单")
|
||||
@ApiOperation("查询移库单")
|
||||
public ResponseEntity<Object> getOutBillDtl(@RequestParam Map whereJson){
|
||||
return new ResponseEntity<>(handMoveStorService.getOutBillDtl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@Log("删除移库单")
|
||||
@ApiOperation("删除移库单")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
handMoveStorService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改移库单")
|
||||
@ApiOperation("修改移库单")
|
||||
public ResponseEntity<Object> update(@RequestBody Map whereJson){
|
||||
handMoveStorService.update(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@PostMapping()
|
||||
@Log("新增移库单")
|
||||
@ApiOperation("新增移库单")
|
||||
public ResponseEntity<Object> insertDtl(@RequestBody Map whereJson){
|
||||
handMoveStorService.insertDtl(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
@GetMapping("/getStructIvt")
|
||||
@Log("查询可分配库存")
|
||||
@ApiOperation("查询可分配库存")
|
||||
public ResponseEntity<Object> getStructIvt(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(handMoveStorService.getStructIvt(whereJson,page), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/confirm")
|
||||
@Log("移库单强制确认")
|
||||
@ApiOperation("移库单强制确认")
|
||||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
|
||||
handMoveStorService.confirm(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@GetMapping("/getInvTypes")
|
||||
@Log("查询单据字段")
|
||||
@ApiOperation("查询单据字段")
|
||||
public ResponseEntity<Object> getInvTypes(){
|
||||
return new ResponseEntity<>(handMoveStorService.getInvTypes(), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/handdown")
|
||||
@Log("移库单手动下发")
|
||||
@ApiOperation("移库单手动下发")
|
||||
public ResponseEntity<Object> handdown(@RequestBody JSONObject whereJson) {
|
||||
handMoveStorService.handdown(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package org.nl.wms.st.instor.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
public interface CheckService {
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> pageQuery(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
/**
|
||||
* 新增出库单
|
||||
* @param whereJson /
|
||||
*/
|
||||
void insertDtl (Map whereJson);
|
||||
/**
|
||||
* 查询出库单明细
|
||||
* @param whereJson /
|
||||
* @return
|
||||
*/
|
||||
JSONArray getOutBillDtl(Map whereJson);
|
||||
|
||||
JSONArray getOutBillDtl2(Map whereJson);
|
||||
/**
|
||||
* 查询出库单明细
|
||||
* @param whereJson /
|
||||
* @return
|
||||
*/
|
||||
JSONArray getOutBillDis(Map whereJson);
|
||||
/**
|
||||
* 修改出库单
|
||||
* @param whereJson /
|
||||
*/
|
||||
void update(Map whereJson);
|
||||
/**
|
||||
* 查询可分配库存
|
||||
* @param whereJson /
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getStructIvt(Map whereJson, Pageable page);
|
||||
/**
|
||||
* 出库单强制确认
|
||||
* @param whereJson /
|
||||
*/
|
||||
void confirm(JSONObject whereJson);
|
||||
/**
|
||||
* 查询单据字段
|
||||
* @return
|
||||
*/
|
||||
JSONArray getInvTypes();
|
||||
/**
|
||||
* 移库单手动下发
|
||||
* @param whereJson /
|
||||
*/
|
||||
void handdown(JSONObject whereJson);
|
||||
/**
|
||||
* 盘点保存
|
||||
* @param whereJson /
|
||||
*/
|
||||
void saveCheck(JSONObject whereJson);
|
||||
/**
|
||||
* 财务为准
|
||||
* @param whereJson /
|
||||
*/
|
||||
void process0(JSONObject whereJson);
|
||||
/**
|
||||
* 财务为准
|
||||
* @param whereJson /
|
||||
*/
|
||||
void process1(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 导出
|
||||
* @param rows
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
void download(JSONArray rows, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package org.nl.wms.st.instor.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface HandMoveStorService {
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> pageQuery(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
/**
|
||||
* 新增出库单
|
||||
* @param whereJson /
|
||||
*/
|
||||
void insertDtl (Map whereJson);
|
||||
/**
|
||||
* 新增出库单2
|
||||
* @param whereJson /
|
||||
*/
|
||||
String insertDtl2 (JSONObject whereJson);
|
||||
/**
|
||||
* 查询出库单明细
|
||||
* @param whereJson /
|
||||
* @return
|
||||
*/
|
||||
JSONArray getOutBillDtl(Map whereJson);
|
||||
/**
|
||||
* 修改出库单
|
||||
* @param whereJson /
|
||||
*/
|
||||
void update(Map whereJson);
|
||||
/**
|
||||
* 全部取消
|
||||
* @param whereJson /
|
||||
*/
|
||||
void allCancel(JSONObject whereJson);
|
||||
/**
|
||||
* 查询可分配库存
|
||||
* @param whereJson /
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getStructIvt(Map whereJson, Pageable page);
|
||||
/**
|
||||
* 出库单强制确认
|
||||
* @param whereJson /
|
||||
*/
|
||||
void confirm(JSONObject whereJson);
|
||||
/**
|
||||
* 出库任务下发
|
||||
* @param whereJson /
|
||||
*/
|
||||
void issueTask(JSONObject whereJson);
|
||||
/**
|
||||
* 出库任务手动完成
|
||||
* @param whereJson /
|
||||
*/
|
||||
void finishTask(JSONObject whereJson);
|
||||
/**
|
||||
* 出库任务手动取消完成
|
||||
* @param whereJson /
|
||||
*/
|
||||
void cancleTaskfinish(JSONObject whereJson);
|
||||
/**
|
||||
* 查询单据字段
|
||||
* @return
|
||||
*/
|
||||
JSONArray getInvTypes();
|
||||
/**
|
||||
* 移库单手动下发
|
||||
* @param whereJson /
|
||||
*/
|
||||
void handdown(JSONObject whereJson);
|
||||
}
|
||||
@@ -0,0 +1,676 @@
|
||||
package org.nl.wms.st.instor.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.security.service.dto.JwtUserDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.FileUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.common.util.DataAuthUtil;
|
||||
import org.nl.wms.st.core.service.StorPublicService;
|
||||
import org.nl.wms.st.instor.service.CheckService;
|
||||
import org.nl.wms.st.instor.task.HandMoveStorAcsTask;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* PC端出入库新增
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CheckServiceImpl implements CheckService {
|
||||
@Autowired
|
||||
private StorPublicService storPublicService;
|
||||
@Autowired
|
||||
private MoreOrLessService moreOrLessService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
map.put("flag", "1");
|
||||
if (StrUtil.isNotEmpty(map.get("check_code"))) {
|
||||
map.put("check_code", "%" + map.get("check_code") + "%");
|
||||
}
|
||||
String deptIds = DataAuthUtil.getDeptStr();
|
||||
map.put("deptIds", deptIds);
|
||||
if (StrUtil.isNotEmpty(map.get("buss_type"))) {
|
||||
map.put("buss_type", whereJson.get("buss_type") + "%");
|
||||
}
|
||||
JSONObject jo = WQL.getWO("QST_IVT_CHECK").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "check_code desc");
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
for (Long moveinv_id : ids) {
|
||||
this.deleteById(moveinv_id + "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过moveinv_id删除明细,还原库存等操作
|
||||
*
|
||||
* @param check_id
|
||||
*/
|
||||
void deleteById(String check_id) {
|
||||
//明细表
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_CheckDtl");
|
||||
//主表
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_CheckMst");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("is_delete", "1");
|
||||
map.put("update_optid", currentUserId + "");
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", now);
|
||||
JSONObject jo_mst = wo_mst.query("check_id='" + check_id + "'").uniqueResult(0);
|
||||
JSONArray ja = wo_dtl.query("check_id='" + check_id + "'").getResultJSONArray(0);
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
//解锁起点点位、仓位
|
||||
JSONObject from_start = new JSONObject();
|
||||
from_start.put("lock_type", "00");
|
||||
from_start.put("struct_id", jo.getString("struct_id"));
|
||||
storPublicService.updateStructAndPoint(from_start);
|
||||
|
||||
//删除明细
|
||||
wo_dtl.delete("checkdtl_id='" + jo.getString("checkdtl_id") + "'");
|
||||
}
|
||||
//更新主表
|
||||
wo_mst.update(map, "check_id='" + check_id + "'");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void insertDtl(Map map) {
|
||||
//主表
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_CheckMst");
|
||||
|
||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) map.get("tableData");
|
||||
map.remove("tableData");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
String check_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
String check_code = CodeUtil.getNewCode("PD_CODE");
|
||||
map.put("check_id", check_id);
|
||||
map.put("check_code", check_code);
|
||||
map.put("buss_type", "");
|
||||
map.put("create_mode", "01");
|
||||
map.put("input_optid", currentUserId + "");
|
||||
map.put("input_optname", nickName);
|
||||
map.put("input_time", now);
|
||||
map.put("update_optid", currentUserId + "");
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", now);
|
||||
map.put("is_delete", "0");
|
||||
map.put("is_upload", "0");
|
||||
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
|
||||
Long deptId = currentUser.getDeptId();
|
||||
map.put("sysdeptid", deptId);
|
||||
map.put("syscompanyid", deptId);
|
||||
JSONObject jo_mst = JSONObject.parseObject(JSON.toJSONString(map));
|
||||
//调用明细处理方法
|
||||
this.insertDtlByRows(jo_mst, rows);
|
||||
wo_mst.insert(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传进来的载具物料明细,查询载具所有库存记录,并生成移库明细
|
||||
*
|
||||
* @param rows
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
void insertDtlByRows(JSONObject jo_mst, ArrayList<HashMap> rows) {
|
||||
//明细表
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_CheckDtl");
|
||||
//定义需要需要插入的库存集合
|
||||
HashSet<String> set = new HashSet<>();
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
HashMap<String, String> row = rows.get(i);
|
||||
set.add(row.get("struct_id"));
|
||||
|
||||
String checkdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
row.put("checkdtl_id", checkdtl_id);
|
||||
row.put("check_code", jo_mst.getString("check_code"));
|
||||
row.put("check_id", jo_mst.getString("check_id"));
|
||||
row.put("seq_no", (i + 1) + "");
|
||||
row.put("is_down", "0");
|
||||
wo_dtl.insert(row);
|
||||
}
|
||||
|
||||
//锁定起点点位、仓位
|
||||
Iterator<String> it = set.iterator();
|
||||
JSONObject from_start = new JSONObject();
|
||||
from_start.put("lock_type", "02");
|
||||
for (; it.hasNext(); ) {
|
||||
String struct_id = it.next();
|
||||
from_start.put("struct_id", struct_id);
|
||||
from_start.put("inv_type", jo_mst.getString("check_type"));
|
||||
from_start.put("inv_id", jo_mst.getString("check_id"));
|
||||
from_start.put("inv_code", jo_mst.getString("check_code"));
|
||||
storPublicService.updateStructAndPoint(from_start);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getOutBillDtl(Map whereJson) {
|
||||
whereJson.put("flag", "2");
|
||||
JSONArray jo = WQL.getWO("QST_IVT_CHECK")
|
||||
.addParamMap((HashMap) whereJson)
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getOutBillDtl2(Map whereJson) {
|
||||
whereJson.put("flag", "8");
|
||||
JSONArray jo = WQL.getWO("QST_IVT_CHECK")
|
||||
.addParamMap((HashMap) whereJson)
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getOutBillDis(Map whereJson) {
|
||||
whereJson.put("flag", "4");
|
||||
JSONArray jo = WQL.getWO("QST_IVT_CHECK")
|
||||
.addParamMap((HashMap) whereJson)
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Map whereJson) {
|
||||
//主表
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_CheckMst");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
String check_id = (String) whereJson.get("check_id");
|
||||
//查询主表
|
||||
JSONObject jo_mst = wo_mst.query("check_id='" + check_id + "'").uniqueResult(0);
|
||||
//调用删除明细,还原库存方法
|
||||
this.deleteById(check_id + "");
|
||||
//获取明细
|
||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableData");
|
||||
//调用明细处理方法
|
||||
this.insertDtlByRows(jo_mst, rows);
|
||||
jo_mst.put("remark", whereJson.get("remark"));
|
||||
jo_mst.put("dtl_num", whereJson.get("dtl_num"));
|
||||
jo_mst.put("check_type", whereJson.get("check_type"));
|
||||
jo_mst.put("update_optid", currentUserId + "");
|
||||
jo_mst.put("update_optname", nickName);
|
||||
jo_mst.put("update_time", now);
|
||||
//更新主表
|
||||
wo_mst.update(jo_mst);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getStructIvt(Map whereJson, Pageable page) {
|
||||
HashMap<String, String> map = new HashMap<String, String>(whereJson);
|
||||
if (StrUtil.isNotEmpty(map.get("remark"))) {
|
||||
map.put("remark", "%" + map.get("remark") + "%");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(map.get("struct_code"))) {
|
||||
map.put("struct_code", "%" + map.get("struct_code") + "%");
|
||||
}
|
||||
JSONObject jo = WQL.getWO("QST_IVT_CHECK")
|
||||
.addParam("flag", "3")
|
||||
.addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "struct.struct_id,struct.storagevehicle_code");
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void confirm(JSONObject whereJson) {
|
||||
//主表
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_CheckMst");
|
||||
//明细表
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_CheckDtl");
|
||||
|
||||
JSONObject form = whereJson.getJSONObject("row");
|
||||
JSONArray rows = whereJson.getJSONArray("rows");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
JSONObject jo_mst = wo_mst.query("status in ('10','30') and check_id='" + form.getString("check_id") + "'").uniqueResult(0);
|
||||
if (jo_mst == null) {
|
||||
throw new BadRequestException("盘点单状态异常!");
|
||||
}
|
||||
wo_dtl.delete("status in ('01','04') and check_id='" + form.getString("check_id") + "'");
|
||||
//定义需要需要更新的的点位集合
|
||||
HashSet<String> set = new HashSet<>();
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject jo = rows.getJSONObject(i);
|
||||
String status = jo.getString("status");
|
||||
double base_qty = jo.getDoubleValue("base_qty");
|
||||
jo.put("seq_no", "" + (i + 1));
|
||||
set.add(jo.getString("struct_id"));
|
||||
//已盘点过的明细不再处理
|
||||
if ("05,06,07,99".contains(status)) {
|
||||
wo_dtl.update(jo);
|
||||
continue;
|
||||
}
|
||||
jo.put("status", "05");
|
||||
jo.put("check_optid", currentUserId);
|
||||
jo.put("check_optname", nickName);
|
||||
jo.put("check_time", now);
|
||||
double fac_qty = jo.getDoubleValue("fac_qty");
|
||||
//判断盈亏
|
||||
if (fac_qty > base_qty) {
|
||||
jo.put("check_result", "2");
|
||||
} else if (fac_qty < base_qty) {
|
||||
jo.put("check_result", "1");
|
||||
} else {
|
||||
jo.put("status", "99");
|
||||
jo.put("check_result", "0");
|
||||
}
|
||||
if (StrUtil.isEmpty(jo.getString("checkdtl_id"))) {
|
||||
String checkdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
jo.put("checkdtl_id", checkdtl_id);
|
||||
}
|
||||
wo_dtl.insert(jo);
|
||||
}
|
||||
jo_mst.put("dtl_num", rows.size());
|
||||
jo_mst.put("status", "30");
|
||||
jo_mst.put("is_nok", "0");
|
||||
JSONArray ja_nok = wo_dtl.query("check_result <>'0' and check_id='" + form.getString("check_id") + "'").getResultJSONArray(0);
|
||||
if (ja_nok.size() != 0) {
|
||||
jo_mst.put("is_nok", "1");
|
||||
}
|
||||
JSONArray ja = wo_dtl.query("status in ('99','07') and check_id='" + form.getString("check_id") + "'").getResultJSONArray(0);
|
||||
//说明全部确认
|
||||
if (ja.size() == jo_mst.getInteger("dtl_num")) {
|
||||
HashMap<String, String> mapdtl = new HashMap<>();
|
||||
mapdtl.put("status", "99");
|
||||
wo_dtl.update(mapdtl, "check_id='" + form.getString("check_id") + "'");
|
||||
|
||||
jo_mst.put("status", "99");
|
||||
jo_mst.put("confirm_optid", currentUserId);
|
||||
jo_mst.put("confirm_optname", nickName);
|
||||
jo_mst.put("confirm_time", now);
|
||||
//锁定起点点位、仓位
|
||||
Iterator<String> it = set.iterator();
|
||||
JSONObject from_start = new JSONObject();
|
||||
from_start.put("lock_type", "00");
|
||||
for (; it.hasNext(); ) {
|
||||
String struct_id = it.next();
|
||||
from_start.put("struct_id", struct_id);
|
||||
storPublicService.updateStructAndPoint(from_start);
|
||||
}
|
||||
}
|
||||
wo_mst.update(jo_mst);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handdown(JSONObject whereJson) {
|
||||
//移库单主表
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_MoveInv");
|
||||
//移库单明细表
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_MoveInvDtl");
|
||||
//任务表
|
||||
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
|
||||
HandMoveStorAcsTask handMoveStorAcsTask = new HandMoveStorAcsTask();
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
String moveinv_id = whereJson.getString("moveinv_id");
|
||||
//查询所有载具的库存
|
||||
JSONArray ja = WQL.getWO("QST_IVT_HANDMOVESTOR")
|
||||
.addParam("flag", "4")
|
||||
.addParam("moveinv_id", moveinv_id)
|
||||
.process().getResultJSONArray(0);
|
||||
if (ja.size() == 0) {
|
||||
throw new BadRequestException("当前移库单无可下发任务!");
|
||||
}
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
String task_id = jo.getString("task_id");
|
||||
String taskdtl_id = whereJson.getString("taskdtl_id");
|
||||
JSONObject result = handMoveStorAcsTask.notifyAcs(taskdtl_id);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
String status = result.getString("status");
|
||||
if ("200".equals(status)) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
//更新分配表
|
||||
map.put("is_issued", "1");
|
||||
wo_dtl.update(map, "is_issued='0' and task_id='" + task_id + "'");
|
||||
//更新任务为已下发
|
||||
map.put("task_status", "02");
|
||||
map.put("update_optid", currentUserId + "");
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", now);
|
||||
wo_Task.update(map, "task_status='01' and taskdtl_id='" + taskdtl_id + "'");
|
||||
} else {
|
||||
throw new BadRequestException("任务下发失败,请稍后重试!");
|
||||
}
|
||||
} else {
|
||||
throw new BadRequestException("任务下发失败,请稍后重试!");
|
||||
}
|
||||
}
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("bill_status", "20");
|
||||
wo_mst.update(map, "moveinv_id='" + moveinv_id + "'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveCheck(JSONObject whereJson) {
|
||||
//主表
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_CheckMst");
|
||||
//明细表
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_CheckDtl");
|
||||
|
||||
JSONObject form = whereJson.getJSONObject("row");
|
||||
JSONArray rows = whereJson.getJSONArray("rows");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
JSONObject jo_mst = wo_mst.query("status in ('10','30') and check_id='" + form.getString("check_id") + "'").uniqueResult(0);
|
||||
if (jo_mst == null) {
|
||||
throw new BadRequestException("盘点单状态异常!");
|
||||
}
|
||||
wo_dtl.delete("status in ('01','04') and check_id='" + form.getString("check_id") + "'");
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject jo = rows.getJSONObject(i);
|
||||
String status = jo.getString("status");
|
||||
double base_qty = jo.getDoubleValue("base_qty");
|
||||
jo.put("seq_no", "" + (i + 1));
|
||||
//已盘点过的明细不再处理
|
||||
if ("05,06,07,99".contains(status)) {
|
||||
wo_dtl.update(jo);
|
||||
continue;
|
||||
}
|
||||
jo.put("status", "04");
|
||||
jo.put("check_optid", currentUserId);
|
||||
jo.put("check_optname", nickName);
|
||||
jo.put("check_time", now);
|
||||
double fac_qty = jo.getDoubleValue("fac_qty");
|
||||
//判断盈亏
|
||||
if (fac_qty > base_qty) {
|
||||
jo.put("check_result", "2");
|
||||
} else if (fac_qty < base_qty) {
|
||||
jo.put("check_result", "1");
|
||||
} else {
|
||||
jo.put("check_result", "0");
|
||||
}
|
||||
if (StrUtil.isEmpty(jo.getString("checkdtl_id"))) {
|
||||
String checkdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
jo.put("checkdtl_id", checkdtl_id);
|
||||
}
|
||||
wo_dtl.insert(jo);
|
||||
}
|
||||
jo_mst.put("dtl_num", rows.size());
|
||||
jo_mst.put("status", "30");
|
||||
jo_mst.put("is_nok", "0");
|
||||
JSONArray ja_nok = wo_dtl.query("check_result <>'0' and check_id='" + form.getString("check_id") + "'").getResultJSONArray(0);
|
||||
if (ja_nok.size() != 0) {
|
||||
jo_mst.put("is_nok", "1");
|
||||
}
|
||||
wo_mst.update(jo_mst);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void process0(JSONObject whereJson) {
|
||||
//主表
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_CheckMst");
|
||||
//明细表
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_CheckDtl");
|
||||
|
||||
JSONObject form = whereJson.getJSONObject("form");
|
||||
JSONObject row = whereJson.getJSONObject("row");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
JSONObject jo_mst = wo_mst.query("status <>'99' and check_id='" + form.getString("check_id") + "'").uniqueResult(0);
|
||||
if (jo_mst == null) {
|
||||
throw new BadRequestException("盘点单状态异常!");
|
||||
}
|
||||
row.put("status", "07");
|
||||
row.put("process_optid", currentUserId);
|
||||
row.put("process_type", "0");
|
||||
row.put("is_process", "1");
|
||||
row.put("process_time", now);
|
||||
wo_dtl.update(row);
|
||||
JSONArray ja = wo_dtl.query("status in ('99','07') and check_id='" + form.getString("check_id") + "'").getResultJSONArray(0);
|
||||
//说明全部确认
|
||||
if (ja.size() == jo_mst.getInteger("dtl_num")) {
|
||||
HashMap<String, String> mapdtl = new HashMap<>();
|
||||
mapdtl.put("status", "99");
|
||||
wo_dtl.update(mapdtl, "check_id='" + form.getString("check_id") + "'");
|
||||
|
||||
jo_mst.put("status", "99");
|
||||
jo_mst.put("confirm_optid", currentUserId);
|
||||
jo_mst.put("confirm_optname", nickName);
|
||||
jo_mst.put("confirm_time", now);
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
//锁定起点点位、仓位
|
||||
JSONObject from_start = new JSONObject();
|
||||
from_start.put("lock_type", "00");
|
||||
from_start.put("struct_id", jo.getString("struct_id"));
|
||||
storPublicService.updateStructAndPoint(from_start);
|
||||
|
||||
}
|
||||
}
|
||||
wo_mst.update(jo_mst);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void process1(JSONObject whereJson) {
|
||||
//主表
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_CheckMst");
|
||||
//明细表
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_CheckDtl");
|
||||
//明细表
|
||||
WQLObject wo_dis = WQLObject.getWQLObject("ST_IVT_CheckDtlDis");
|
||||
|
||||
JSONObject form = whereJson.getJSONObject("row");
|
||||
JSONArray rows = whereJson.getJSONArray("rows");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
JSONObject jo_mst = wo_mst.query("status <>'99' and check_id='" + form.getString("check_id") + "'").uniqueResult(0);
|
||||
if (jo_mst == null) {
|
||||
throw new BadRequestException("盘点单状态异常!");
|
||||
}
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("status", "07");
|
||||
map.put("process_optid", currentUserId + "");
|
||||
map.put("process_type", "1");
|
||||
map.put("is_process", "1");
|
||||
map.put("process_time", now);
|
||||
wo_dtl.update(map, "status not in('07','99') and storagevehicle_code='" + form.getString("storagevehicle_code") + "' and check_id='" + form.getString("check_id") + "'");
|
||||
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject jo = rows.getJSONObject(i);
|
||||
String checkdtldis_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
jo.put("checkdtldis_id", checkdtldis_id);
|
||||
jo.put("check_id", jo_mst.getString("check_id"));
|
||||
jo.put("check_code", jo_mst.getString("check_code"));
|
||||
jo.put("sect_id", form.getString("sect_id"));
|
||||
jo.put("struct_id", form.getString("struct_id"));
|
||||
jo.put("struct_name", form.getString("struct_name"));
|
||||
jo.put("sect_name", form.getString("sect_name"));
|
||||
wo_dis.insert(jo);
|
||||
|
||||
}
|
||||
//判断是否要生成损单
|
||||
JSONArray ja_sun = WQL.getWO("QST_IVT_CHECK")
|
||||
.addParam("storagevehicle_code", form.getString("storagevehicle_code"))
|
||||
.addParam("check_id", form.getString("check_id"))
|
||||
.addParam("flag", "6")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
if (ja_sun.size() > 0) {
|
||||
JSONObject mapMst = new JSONObject();
|
||||
mapMst.put("mol_inv_type", "42");
|
||||
mapMst.put("create_mode", "02");
|
||||
mapMst.put("mol_type", "0");
|
||||
mapMst.put("stor_id", ja_sun.getJSONObject(0).getString("stor_id"));
|
||||
mapMst.put("sect_id", ja_sun.getJSONObject(0).getString("sect_id"));
|
||||
mapMst.put("sect_name", ja_sun.getJSONObject(0).getString("sect_name"));
|
||||
mapMst.put("struct_id", ja_sun.getJSONObject(0).getString("struct_id"));
|
||||
mapMst.put("struct_name", ja_sun.getJSONObject(0).getString("struct_name"));
|
||||
//List<HashMap> rows_sun = ja_sun.toJavaList(HashMap.class);
|
||||
mapMst.put("tableData", ja_sun);
|
||||
moreOrLessService.insertDtl(mapMst);
|
||||
}
|
||||
|
||||
//判断是否要生成溢单
|
||||
JSONArray ja_yi = WQL.getWO("QST_IVT_CHECK")
|
||||
.addParam("storagevehicle_code", form.getString("storagevehicle_code"))
|
||||
.addParam("check_id", form.getString("check_id"))
|
||||
.addParam("flag", "5")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
if (ja_yi.size() > 0) {
|
||||
JSONObject mapMst = new JSONObject();
|
||||
mapMst.put("mol_inv_type", "42");
|
||||
mapMst.put("create_mode", "02");
|
||||
mapMst.put("mol_type", "1");
|
||||
mapMst.put("stor_id", ja_yi.getJSONObject(0).getString("stor_id"));
|
||||
mapMst.put("sect_id", ja_yi.getJSONObject(0).getString("sect_id"));
|
||||
mapMst.put("sect_name", ja_yi.getJSONObject(0).getString("sect_name"));
|
||||
mapMst.put("struct_id", ja_yi.getJSONObject(0).getString("struct_id"));
|
||||
mapMst.put("struct_name", ja_yi.getJSONObject(0).getString("struct_name"));
|
||||
//List<HashMap> rows_yi = ja_yi.toJavaList(HashMap.class);
|
||||
mapMst.put("tableData", ja_yi);
|
||||
moreOrLessService.insertDtl(mapMst);
|
||||
}
|
||||
|
||||
JSONArray ja = wo_dtl.query("status in ('99','07') and check_id='" + form.getString("check_id") + "'").getResultJSONArray(0);
|
||||
//说明全部确认
|
||||
if (ja.size() == jo_mst.getInteger("dtl_num")) {
|
||||
HashMap<String, String> mapdtl = new HashMap<>();
|
||||
mapdtl.put("status", "99");
|
||||
wo_dtl.update(mapdtl, "check_id='" + form.getString("check_id") + "'");
|
||||
|
||||
jo_mst.put("status", "99");
|
||||
jo_mst.put("confirm_optid", currentUserId);
|
||||
jo_mst.put("confirm_optname", nickName);
|
||||
jo_mst.put("confirm_time", now);
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
//锁定起点点位、仓位
|
||||
JSONObject from_start = new JSONObject();
|
||||
from_start.put("lock_type", "00");
|
||||
from_start.put("struct_id", jo.getString("struct_id"));
|
||||
storPublicService.updateStructAndPoint(from_start);
|
||||
}
|
||||
//确认损益单
|
||||
JSONArray ja_sunyi = WQL.getWO("QST_IVT_CHECK")
|
||||
.addParam("check_code", form.getString("check_code"))
|
||||
.addParam("flag", "7")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
for (int i = 0; i < ja_sunyi.size(); i++) {
|
||||
JSONObject jo = ja_sunyi.getJSONObject(i);
|
||||
moreOrLessService.confirm(jo);
|
||||
}
|
||||
}
|
||||
wo_mst.update(jo_mst);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getInvTypes() {
|
||||
//查询单据字段类型
|
||||
JSONArray ja = WQL.getWO("ST_PUB_QUERY_01")
|
||||
.addParam("flag", "4")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
return ja;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(JSONArray rows, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject jo = rows.getJSONObject(i);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("盘点单号", jo.getString("check_code"));
|
||||
map.put("明细序号", jo.getString("seq_no"));
|
||||
map.put("库区编码", jo.getString("sect_code"));
|
||||
map.put("库区名称", jo.getString("sect_name"));
|
||||
map.put("货位编码", jo.getString("struct_code"));
|
||||
map.put("货位名称", jo.getString("struct_name"));
|
||||
map.put("载具号", jo.getString("storagevehicle_code"));
|
||||
map.put("物料编码", jo.getString("material_code"));
|
||||
map.put("物料名称", jo.getString("material_name"));
|
||||
map.put("桶数", jo.getString("base_qty"));
|
||||
map.put("盘点桶数", jo.getString("fac_qty"));
|
||||
map.put("单位", jo.getString("qty_unit_name"));
|
||||
String check_result = jo.getString("check_result");
|
||||
if (check_result.equals("0")) {
|
||||
map.put("盘点结果", "正常");
|
||||
} else if (check_result.equals("1")) {
|
||||
map.put("盘点结果", "盘亏");
|
||||
} else if (check_result.equals("2")) {
|
||||
map.put("盘点结果", "盘盈");
|
||||
}
|
||||
String status = jo.getString("status");
|
||||
if (status.equals("01")) {
|
||||
map.put("状态", "生成");
|
||||
} else if (status.equals("04")) {
|
||||
map.put("状态", "盘点中");
|
||||
} else if (status.equals("05")) {
|
||||
map.put("状态", "已盘点");
|
||||
} else if (status.equals("06")) {
|
||||
map.put("状态", "异常处理中");
|
||||
} else if (status.equals("07")) {
|
||||
map.put("状态", "异常处理完成");
|
||||
} else if (status.equals("99")) {
|
||||
map.put("状态", "确认完成");
|
||||
}
|
||||
map.put("异常处理人", jo.getString("process_optname"));
|
||||
map.put("异常处理时间", jo.getString("process_time"));
|
||||
String process_type = jo.getString("process_type");
|
||||
if (process_type.equals("0")) {
|
||||
map.put("异常处理方式", "账务为准");
|
||||
} else if (process_type.equals("1")) {
|
||||
map.put("异常处理方式", "实物为准");
|
||||
}
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,112 @@
|
||||
package org.nl.wms.st.instor.task;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.st.instor.service.impl.HandMoveStorServiceImpl;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class HandMoveStorAcsTask extends AbstractAcsTask {
|
||||
/**
|
||||
*
|
||||
* @param taskObj 代表一条任务对象
|
||||
* @param status 代表wcs任务完成状态: //1:执行中,2:完成 ,3:acs取消
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
//任务表
|
||||
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
//出库分配表
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_MoveInvDtl");
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
String taskdtl_id = taskObj.getString("taskdtl_id");
|
||||
if (StrUtil.isEmpty(taskdtl_id)) {
|
||||
throw new BadRequestException("任务id不能为空!");
|
||||
}
|
||||
JSONObject task = wo_Task.query("taskdtl_id='"+taskdtl_id+"'").uniqueResult(0);
|
||||
if(task==null){
|
||||
throw new BadRequestException("查询不到操作的任务记录!");
|
||||
}
|
||||
String task_id = task.getString("task_id");
|
||||
if("1".equals(status)){
|
||||
map.put("work_status","02");
|
||||
wo_dtl.update(map,"task_id='"+task_id+"'");
|
||||
map.put("task_status","03");
|
||||
map.put("update_optid",currentUserId+"");
|
||||
map.put("update_optname",nickName);
|
||||
map.put("update_time",now);
|
||||
wo_Task.update(map,"taskdtl_id='"+taskdtl_id+"'");
|
||||
}else if("2".equals(status)){
|
||||
HandMoveStorServiceImpl handMoveStorServiceImpl = SpringContextHolder.getBean(HandMoveStorServiceImpl.class);
|
||||
handMoveStorServiceImpl.finishTask(task);
|
||||
}else if("3".equals(status)){
|
||||
|
||||
}else{
|
||||
throw new BadRequestException("任务状态更新异常!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param form 创建任务需要的参数
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param taskdtl_id
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void forceFinish(String taskdtl_id) {
|
||||
//出库明细表
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("st_ivt_moveinvdtl");
|
||||
//任务表
|
||||
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
JSONObject task = wo_Task.query("task_status<>'99' and taskdtl_id='"+taskdtl_id+"'").uniqueResult(0);
|
||||
if(task==null){
|
||||
throw new BadRequestException("查询不到操作的任务记录!");
|
||||
}
|
||||
|
||||
String task_id = task.getString("task_id");
|
||||
JSONObject dtl = wo_dtl.query("task_id='"+task_id+"'").uniqueResult(0);
|
||||
|
||||
HandMoveStorServiceImpl handMoveStorService = SpringContextHolder.getBean(HandMoveStorServiceImpl.class);
|
||||
task.put("moveinv_id",dtl.getString("moveinv_id"));
|
||||
handMoveStorService.finishTask(task);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param taskdtl_id
|
||||
*/
|
||||
@Override
|
||||
public void pullBack(String taskdtl_id) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param taskdtl_id
|
||||
*/
|
||||
@Override
|
||||
public void cancel(String taskdtl_id) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,383 @@
|
||||
[交易说明]
|
||||
交易名: 基础点位分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.status TYPEAS s_string
|
||||
输入.check_code TYPEAS s_string
|
||||
输入.create_mode TYPEAS s_string
|
||||
输入.check_type TYPEAS s_string
|
||||
输入.stor_id TYPEAS s_string
|
||||
输入.check_id TYPEAS s_string
|
||||
输入.buss_type TYPEAS s_string
|
||||
输入.work_status TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.material_id TYPEAS s_string
|
||||
输入.quality_scode TYPEAS s_string
|
||||
输入.pcsn TYPEAS s_string
|
||||
输入.ivt_level TYPEAS s_string
|
||||
输入.is_active TYPEAS s_string
|
||||
输入.sect_id TYPEAS s_string
|
||||
输入.moveinvdtl_id TYPEAS s_string
|
||||
输入.struct_id TYPEAS s_string
|
||||
输入.is_issued TYPEAS s_string
|
||||
输入.remark TYPEAS s_string
|
||||
输入.task_id TYPEAS s_string
|
||||
输入.struct_code TYPEAS s_string
|
||||
输入.ids TYPEAS f_string
|
||||
输入.storagevehicle_code TYPEAS s_string
|
||||
输入.deptIds TYPEAS f_string
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
checkmst.check_id AS id,
|
||||
checkmst.*
|
||||
FROM
|
||||
ST_IVT_CheckMst checkmst
|
||||
WHERE
|
||||
1 = 1
|
||||
AND checkmst.is_delete = '0'
|
||||
OPTION 输入.check_code <> ""
|
||||
checkmst.check_code like 输入.check_code
|
||||
ENDOPTION
|
||||
OPTION 输入.buss_type <> ""
|
||||
checkmst.buss_type like 输入.buss_type
|
||||
ENDOPTION
|
||||
OPTION 输入.check_type <> ""
|
||||
checkmst.check_type = 输入.check_type
|
||||
ENDOPTION
|
||||
OPTION 输入.stor_id <> ""
|
||||
checkmst.stor_id = 输入.stor_id
|
||||
ENDOPTION
|
||||
OPTION 输入.deptIds <> ""
|
||||
checkmst.sysdeptid in 输入.deptIds
|
||||
ENDOPTION
|
||||
OPTION 输入.create_mode <> ""
|
||||
checkmst.create_mode = 输入.create_mode
|
||||
ENDOPTION
|
||||
OPTION 输入.status <> ""
|
||||
checkmst.status = 输入.status
|
||||
ENDOPTION
|
||||
OPTION 输入.begin_time <> ""
|
||||
checkmst.input_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
checkmst.input_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
CheckDtl.*,
|
||||
struct.struct_code,
|
||||
struct.sect_code,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
user1.nick_name AS process_optname
|
||||
FROM
|
||||
ST_IVT_CheckDtl CheckDtl
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = CheckDtl.material_id
|
||||
LEFT JOIN st_ivt_structattr struct ON struct.struct_id = CheckDtl.struct_id
|
||||
LEFT JOIN sys_user user1 ON user1.user_id = CheckDtl.process_optid
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.check_id <> ""
|
||||
CheckDtl.check_id = 输入.check_id
|
||||
ENDOPTION
|
||||
OPTION 输入.checkdtl_id <> ""
|
||||
CheckDtl.checkdtl_id = 输入.checkdtl_id
|
||||
ENDOPTION
|
||||
OPTION 输入.status <> ""
|
||||
CheckDtl.status <= 输入.status
|
||||
ENDOPTION
|
||||
order by CheckDtl.seq_no
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
bucketcopy.material_id,
|
||||
bucketcopy.base_qty,
|
||||
bucketcopy.storage_qty,
|
||||
'42' AS qty_unit_id,
|
||||
'桶' AS qty_unit_name,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
struct.struct_id,
|
||||
struct.struct_code,
|
||||
struct.struct_name,
|
||||
struct.sect_id,
|
||||
struct.sect_code,
|
||||
struct.sect_name,
|
||||
struct.storagevehicle_id,
|
||||
struct.storagevehicle_code
|
||||
FROM
|
||||
st_ivt_structattr struct
|
||||
INNER JOIN (
|
||||
SELECT
|
||||
bucket.storagevehicle_code,
|
||||
bucket.material_id,
|
||||
sum(bucket.storage_qty) AS storage_qty,
|
||||
COUNT(bucket.bucketunique) AS base_qty
|
||||
FROM
|
||||
MD_PB_BucketRecord bucket
|
||||
WHERE
|
||||
1 = 1
|
||||
AND bucket.storage_qty > 0
|
||||
GROUP BY
|
||||
bucket.storagevehicle_code,
|
||||
bucket.material_id
|
||||
) bucketcopy ON bucketcopy.storagevehicle_code = struct.storagevehicle_code
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = bucketcopy.material_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND struct.lock_type = '00'
|
||||
AND struct.storagevehicle_id > 0
|
||||
OPTION 输入.material_id <> ""
|
||||
bucketcopy.material_id = 输入.material_id
|
||||
ENDOPTION
|
||||
OPTION 输入.remark <> ""
|
||||
(mb.material_code like 输入.remark or mb.material_name like 输入.remark)
|
||||
ENDOPTION
|
||||
OPTION 输入.ids <> ""
|
||||
struct.storagevehicle_code in (输入.ids)
|
||||
ENDOPTION
|
||||
OPTION 输入.struct_code <> ""
|
||||
struct.struct_code like 输入.struct_code
|
||||
ENDOPTION
|
||||
OPTION 输入.stor_id <> ""
|
||||
struct.stor_id = 输入.stor_id
|
||||
ENDOPTION
|
||||
OPTION 输入.sect_id <> ""
|
||||
struct.sect_id = 输入.sect_id
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
bucket.bucket_record_id,
|
||||
bucket.bucketunique,
|
||||
bucket.material_id,
|
||||
bucket.ivt_level,
|
||||
bucket.is_active,
|
||||
bucket.quality_scode,
|
||||
bucket.qty_unit_id,
|
||||
bucket.qty_unit_name,
|
||||
bucket.storage_qty AS ivt_qty,
|
||||
bucket.storage_qty AS ivt_qty_ck,
|
||||
bucket.pcsn,
|
||||
bucket.storagevehicle_code,
|
||||
bucket.storagevehicle_id,
|
||||
StorageVehicleInfo.storagevehicle_type,
|
||||
mb.material_code,
|
||||
mb.material_name
|
||||
FROM
|
||||
MD_PB_BucketRecord bucket
|
||||
INNER JOIN MD_PB_StorageVehicleInfo StorageVehicleInfo ON StorageVehicleInfo.storagevehicle_id = bucket.storagevehicle_id
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = bucket.material_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND bucket.STATUS = '03'
|
||||
OPTION 输入.storagevehicle_code <> ""
|
||||
bucket.storagevehicle_code = 输入.storagevehicle_code
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "5"
|
||||
QUERY
|
||||
SELECT
|
||||
checkdis.sect_id,
|
||||
checkdis.sect_name,
|
||||
checkdis.struct_id,
|
||||
checkdis.struct_name,
|
||||
checkdis.storagevehicle_id,
|
||||
checkdis.storagevehicle_code,
|
||||
checkdis.storagevehicle_type,
|
||||
checkdis.bucketunique,
|
||||
checkdis.material_id,
|
||||
checkdis.pcsn,
|
||||
checkdis.quality_scode,
|
||||
checkdis.ivt_level,
|
||||
checkdis.is_active,
|
||||
checkdis.qty_unit_id,
|
||||
checkdis.qty_unit_name,
|
||||
checkdis.checkdtldis_id AS source_billdtl_id,
|
||||
CheckMst.check_type AS source_bill_type,
|
||||
checkdis.check_code AS source_bill_code,
|
||||
'ST_IVT_CheckMst' AS source_bill_table,
|
||||
checkdis.ivt_qty,
|
||||
CheckMst.stor_id,
|
||||
checkdis.ivt_qty_ck - checkdis.ivt_qty AS mol_qty
|
||||
FROM
|
||||
ST_IVT_CheckDtlDis checkdis
|
||||
inner join ST_IVT_CheckMst CheckMst on CheckMst.check_id=checkdis.check_id
|
||||
where 1=1 and checkdis.ivt_qty_ck>checkdis.ivt_qty
|
||||
OPTION 输入.storagevehicle_code <> ""
|
||||
checkdis.storagevehicle_code = 输入.storagevehicle_code
|
||||
ENDOPTION
|
||||
OPTION 输入.check_id <> ""
|
||||
checkdis.check_id = 输入.check_id
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "6"
|
||||
QUERY
|
||||
SELECT
|
||||
checkdis.sect_id,
|
||||
checkdis.sect_name,
|
||||
checkdis.struct_id,
|
||||
checkdis.struct_name,
|
||||
checkdis.storagevehicle_id,
|
||||
checkdis.storagevehicle_code,
|
||||
checkdis.storagevehicle_type,
|
||||
checkdis.bucketunique,
|
||||
checkdis.material_id,
|
||||
checkdis.pcsn,
|
||||
checkdis.quality_scode,
|
||||
checkdis.ivt_level,
|
||||
checkdis.is_active,
|
||||
checkdis.qty_unit_id,
|
||||
checkdis.qty_unit_name,
|
||||
checkdis.checkdtldis_id AS source_billdtl_id,
|
||||
CheckMst.check_type AS source_bill_type,
|
||||
checkdis.check_code AS source_bill_code,
|
||||
'ST_IVT_CheckMst' AS source_bill_table,
|
||||
checkdis.ivt_qty,
|
||||
CheckMst.stor_id,
|
||||
checkdis.ivt_qty - checkdis.ivt_qty_ck AS mol_qty
|
||||
FROM
|
||||
ST_IVT_CheckDtlDis checkdis
|
||||
inner join ST_IVT_CheckMst CheckMst on CheckMst.check_id=checkdis.check_id
|
||||
where 1=1 and checkdis.ivt_qty_ck<checkdis.ivt_qty
|
||||
OPTION 输入.storagevehicle_code <> ""
|
||||
checkdis.storagevehicle_code = 输入.storagevehicle_code
|
||||
ENDOPTION
|
||||
OPTION 输入.check_id <> ""
|
||||
checkdis.check_id = 输入.check_id
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "7"
|
||||
QUERY
|
||||
SELECT
|
||||
MoreOrLessDtl.struct_id,
|
||||
MoreOrLessDtl.mol_id,
|
||||
struct.struct_code
|
||||
FROM
|
||||
ST_IVT_MoreOrLessDtl MoreOrLessDtl
|
||||
INNER JOIN ST_IVT_StructAttr struct ON struct.struct_id = MoreOrLessDtl.struct_id
|
||||
INNER JOIN ST_IVT_MoreOrLessMst MoreOrLessMst ON MoreOrLessMst.mol_id = MoreOrLessDtl.mol_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND MoreOrLessMst.`status` <> '99'
|
||||
AND MoreOrLessMst.is_delete = '0'
|
||||
OPTION 输入.check_code <> ""
|
||||
MoreOrLessDtl.source_bill_code = 输入.check_code
|
||||
ENDOPTION
|
||||
GROUP BY mol_id,struct_id
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "8"
|
||||
QUERY
|
||||
SELECT
|
||||
CheckDtl.checkdtl_id,
|
||||
CheckDtl.check_id,
|
||||
CheckDtl.check_code,
|
||||
CheckDtl.seq_no,
|
||||
CheckDtl.sect_id,
|
||||
CheckDtl.sect_name,
|
||||
CheckDtl.struct_id,
|
||||
CheckDtl.struct_name,
|
||||
CheckDtl.checkpoint_id,
|
||||
CheckDtl.storagevehicle_id,
|
||||
CheckDtl.storagevehicle_code,
|
||||
CheckDtl.material_id,
|
||||
CheckDtl.base_qty,
|
||||
CheckDtl.qty_unit_id,
|
||||
CheckDtl.qty_unit_name,
|
||||
CheckDtl.STATUS,
|
||||
CheckDtl.is_down,
|
||||
( CASE WHEN CheckDtl.fac_qty IS NULL OR CheckDtl.fac_qty = '' THEN CheckDtl.base_qty ELSE CheckDtl.fac_qty END ) AS fac_qty,
|
||||
CheckDtl.check_result,
|
||||
CheckDtl.check_optid,
|
||||
CheckDtl.check_optname,
|
||||
CheckDtl.check_time,
|
||||
CheckDtl.is_process,
|
||||
CheckDtl.process_type,
|
||||
CheckDtl.process_optid,
|
||||
CheckDtl.process_time,
|
||||
struct.struct_code,
|
||||
struct.sect_code,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
user1.nick_name AS process_optname
|
||||
FROM
|
||||
ST_IVT_CheckDtl CheckDtl
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = CheckDtl.material_id
|
||||
LEFT JOIN st_ivt_structattr struct ON struct.struct_id = CheckDtl.struct_id
|
||||
LEFT JOIN sys_user user1 ON user1.user_id = CheckDtl.process_optid
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.check_id <> ""
|
||||
CheckDtl.check_id = 输入.check_id
|
||||
ENDOPTION
|
||||
OPTION 输入.checkdtl_id <> ""
|
||||
CheckDtl.checkdtl_id = 输入.checkdtl_id
|
||||
ENDOPTION
|
||||
OPTION 输入.status <> ""
|
||||
CheckDtl.status <= 输入.status
|
||||
ENDOPTION
|
||||
order by CheckDtl.seq_no
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -0,0 +1,275 @@
|
||||
[交易说明]
|
||||
交易名: 基础点位分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.material_code TYPEAS s_string
|
||||
输入.bill_status TYPEAS s_string
|
||||
输入.bill_code TYPEAS s_string
|
||||
输入.create_mode TYPEAS s_string
|
||||
输入.bill_type TYPEAS s_string
|
||||
输入.stor_id TYPEAS s_string
|
||||
输入.moveinv_id TYPEAS s_string
|
||||
输入.buss_type TYPEAS s_string
|
||||
输入.work_status TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.material_id TYPEAS s_string
|
||||
输入.quality_scode TYPEAS s_string
|
||||
输入.pcsn TYPEAS s_string
|
||||
输入.ivt_level TYPEAS s_string
|
||||
输入.is_active TYPEAS s_string
|
||||
输入.sect_id TYPEAS s_string
|
||||
输入.moveinvdtl_id TYPEAS s_string
|
||||
输入.struct_id TYPEAS s_string
|
||||
输入.is_issued TYPEAS s_string
|
||||
输入.remark TYPEAS s_string
|
||||
输入.task_id TYPEAS s_string
|
||||
输入.struct_code TYPEAS s_string
|
||||
输入.ids TYPEAS f_string
|
||||
输入.deptIds TYPEAS f_string
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
move.moveinv_id AS id,
|
||||
move.*
|
||||
FROM
|
||||
ST_IVT_MoveInv move
|
||||
WHERE
|
||||
1 = 1
|
||||
AND move.is_delete = '0'
|
||||
AND move.moveinv_id IN (
|
||||
SELECT DISTINCT
|
||||
(movedtl.moveinv_id)
|
||||
FROM
|
||||
st_ivt_moveinvdtl movedtl
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = movedtl.material_id
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.material_code <> ""
|
||||
(mb.material_code LIKE 输入.material_code OR mb.material_name LIKE 输入.material_code)
|
||||
ENDOPTION
|
||||
)
|
||||
OPTION 输入.bill_code <> ""
|
||||
move.bill_code like 输入.bill_code
|
||||
ENDOPTION
|
||||
OPTION 输入.buss_type <> ""
|
||||
move.buss_type like 输入.buss_type
|
||||
ENDOPTION
|
||||
OPTION 输入.bill_type <> ""
|
||||
move.bill_type = 输入.bill_type
|
||||
ENDOPTION
|
||||
OPTION 输入.stor_id <> ""
|
||||
move.stor_id = 输入.stor_id
|
||||
ENDOPTION
|
||||
OPTION 输入.deptIds <> ""
|
||||
move.sysdeptid in 输入.deptIds
|
||||
ENDOPTION
|
||||
OPTION 输入.create_mode <> ""
|
||||
move.create_mode = 输入.create_mode
|
||||
ENDOPTION
|
||||
OPTION 输入.bill_status <> ""
|
||||
move.bill_status = 输入.bill_status
|
||||
ENDOPTION
|
||||
OPTION 输入.begin_time <> ""
|
||||
move.input_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
move.input_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
MoveInvDtl.*,
|
||||
mb.material_code,
|
||||
mb.material_name
|
||||
FROM
|
||||
ST_IVT_MoveInvDtl MoveInvDtl
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = MoveInvDtl.material_id
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.moveinv_id <> ""
|
||||
MoveInvDtl.moveinv_id = 输入.moveinv_id
|
||||
ENDOPTION
|
||||
OPTION 输入.moveinvdtl_id <> ""
|
||||
MoveInvDtl.moveinvdtl_id = 输入.moveinvdtl_id
|
||||
ENDOPTION
|
||||
OPTION 输入.work_status <> ""
|
||||
MoveInvDtl.work_status <= 输入.work_status
|
||||
ENDOPTION
|
||||
order by MoveInvDtl.seq_no
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
ivt2.stockrecord_id,
|
||||
ivt2.material_id,
|
||||
ivt2.pcsn,
|
||||
ivt2.quality_scode,
|
||||
ivt2.ivt_level,
|
||||
ivt2.is_active,
|
||||
ivt2.qty_unit_id,
|
||||
ivt2.qty_unit_name,
|
||||
ivt2.ivt_qty AS qty,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
struct.struct_id AS turnout_struct_id,
|
||||
struct.struct_code AS turnout_struct_code,
|
||||
struct.struct_name AS turnout_struct_name,
|
||||
struct.sect_id AS turnout_sect_id,
|
||||
struct.sect_name AS turnout_sect_name,
|
||||
struct.sect_code AS turnout_sect_code,
|
||||
struct.storagevehicle_id,
|
||||
struct.storagevehicle_code
|
||||
FROM
|
||||
st_ivt_structattr struct
|
||||
INNER JOIN ST_IVT_StructIvt ivt2 ON struct.struct_id = ivt2.struct_id
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = ivt2.material_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND struct.lock_type = '00'
|
||||
AND struct.storagevehicle_id > 0
|
||||
OPTION 输入.material_id <> ""
|
||||
ivt2.material_id = 输入.material_id
|
||||
ENDOPTION
|
||||
OPTION 输入.remark <> ""
|
||||
(mb.material_code like 输入.remark or mb.material_name like 输入.remark)
|
||||
ENDOPTION
|
||||
OPTION 输入.ids <> ""
|
||||
struct.storagevehicle_code in (输入.ids)
|
||||
ENDOPTION
|
||||
OPTION 输入.struct_code <> ""
|
||||
struct.struct_code like 输入.struct_code
|
||||
ENDOPTION
|
||||
OPTION 输入.stor_id <> ""
|
||||
ivt2.stor_id = 输入.stor_id
|
||||
ENDOPTION
|
||||
OPTION 输入.sect_id <> ""
|
||||
struct.sect_id = 输入.sect_id
|
||||
ENDOPTION
|
||||
OPTION 输入.pcsn <> ""
|
||||
ivt2.pcsn like 输入.pcsn
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "33"
|
||||
QUERY
|
||||
SELECT
|
||||
ivt2.stockrecord_id,
|
||||
ivt2.material_id,
|
||||
ivt2.pcsn,
|
||||
ivt2.quality_scode,
|
||||
ivt2.ivt_level,
|
||||
ivt2.is_active,
|
||||
ivt2.qty_unit_id,
|
||||
ivt2.qty_unit_name,
|
||||
ivt2.ivt_qty AS qty,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
struct.struct_id AS turnout_struct_id,
|
||||
struct.struct_code AS turnout_struct_code,
|
||||
struct.struct_name AS turnout_struct_name,
|
||||
struct.sect_id AS turnout_sect_id,
|
||||
struct.sect_name AS turnout_sect_name,
|
||||
struct.sect_code AS turnout_sect_code,
|
||||
struct.storagevehicle_id,
|
||||
struct.storagevehicle_code,
|
||||
point.point_code AS start_point_code
|
||||
FROM
|
||||
st_ivt_structattr struct
|
||||
INNER JOIN ST_IVT_StructIvt ivt2 ON struct.struct_id = ivt2.struct_id
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = ivt2.material_id
|
||||
LEFT JOIN SCH_BASE_Point point ON point.source_id = struct.struct_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND struct.lock_type = '00'
|
||||
AND struct.storagevehicle_id > 0
|
||||
OPTION 输入.material_id <> ""
|
||||
ivt2.material_id = 输入.material_id
|
||||
ENDOPTION
|
||||
OPTION 输入.remark <> ""
|
||||
(mb.material_code like 输入.remark or mb.material_name like 输入.remark)
|
||||
ENDOPTION
|
||||
OPTION 输入.ids <> ""
|
||||
struct.storagevehicle_code in (输入.ids)
|
||||
ENDOPTION
|
||||
OPTION 输入.struct_code <> ""
|
||||
struct.struct_code like 输入.struct_code
|
||||
ENDOPTION
|
||||
OPTION 输入.stor_id <> ""
|
||||
ivt2.stor_id = 输入.stor_id
|
||||
ENDOPTION
|
||||
OPTION 输入.sect_id <> ""
|
||||
struct.sect_id = 输入.sect_id
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
DISTINCT(taskdtl_id)
|
||||
FROM
|
||||
ST_IVT_MoveInvDtl dtl
|
||||
INNER JOIN ST_IVT_MoveInv mst ON mst.moveinv_id = dtl.moveinv_id
|
||||
INNER JOIN SCH_BASE_Task task ON task.task_id = dtl.task_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND mst.bill_status = '10'
|
||||
AND dtl.work_status = '01'
|
||||
AND dtl.is_issued = '0'
|
||||
AND task.task_status = '01'
|
||||
AND mst.is_delete = '0'
|
||||
AND task.is_delete = '0'
|
||||
OPTION 输入.moveinv_id <> ""
|
||||
dtl.moveinv_id = 输入.moveinv_id
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user