add:新增成品入库功能
This commit is contained in:
@@ -37,6 +37,14 @@ public class RegionController {
|
|||||||
return new ResponseEntity<>(regionService.queryAll(whereJson, page), HttpStatus.OK);
|
return new ResponseEntity<>(regionService.queryAll(whereJson, page), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getPointQuery")
|
||||||
|
@Log("获取可用点位")
|
||||||
|
@ApiOperation("获取可用点位")
|
||||||
|
//@SaCheckPermission("region:list")
|
||||||
|
public ResponseEntity<Object> getPointQuery(@RequestParam Map whereJson, Pageable page) {
|
||||||
|
return new ResponseEntity<>(regionService.getPointQuery(whereJson, page), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增区域管理")
|
@Log("新增区域管理")
|
||||||
@ApiOperation("新增区域管理")
|
@ApiOperation("新增区域管理")
|
||||||
|
|||||||
@@ -82,4 +82,13 @@ public interface RegionService {
|
|||||||
* @return JSONObject
|
* @return JSONObject
|
||||||
*/
|
*/
|
||||||
JSONObject getRegionSelect(JSONObject whereJson);
|
JSONObject getRegionSelect(JSONObject whereJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
*
|
||||||
|
* @param whereJson 条件
|
||||||
|
* @param page 分页参数
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> getPointQuery(Map whereJson, Pageable page);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,4 +200,20 @@ public class RegionServiceImpl implements RegionService {
|
|||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getPointQuery(Map whereJson, Pageable page) {
|
||||||
|
String product_area = MapUtil.getStr(whereJson, "stor_id"); // 生产区域
|
||||||
|
String region_code = MapUtil.getStr(whereJson, "sect_id"); // 所属区域
|
||||||
|
String point_code = MapUtil.getStr(whereJson, "point_code");
|
||||||
|
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
|
map.put("flag", "4");
|
||||||
|
map.put("product_area",product_area);
|
||||||
|
map.put("region_code",region_code);
|
||||||
|
if (ObjectUtil.isNotEmpty(point_code)) map.put("point_code","%"+point_code+"%");
|
||||||
|
|
||||||
|
JSONObject jsonObject = WQL.getWO("QSCH_REGION_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "point.point_code ASC");
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
输入.flag TYPEAS s_string
|
输入.flag TYPEAS s_string
|
||||||
输入.region_code TYPEAS s_string
|
输入.region_code TYPEAS s_string
|
||||||
输入.product_area TYPEAS s_string
|
输入.product_area TYPEAS s_string
|
||||||
|
输入.point_code TYPEAS s_string
|
||||||
输入.value TYPEAS s_string
|
输入.value TYPEAS s_string
|
||||||
|
|
||||||
[临时表]
|
[临时表]
|
||||||
@@ -90,3 +91,33 @@
|
|||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "4"
|
||||||
|
PAGEQUERY
|
||||||
|
SELECT
|
||||||
|
point.*,
|
||||||
|
region.region_name
|
||||||
|
FROM
|
||||||
|
sch_base_point point
|
||||||
|
LEFT JOIN sch_base_region region ON point.region_code = region.region_code
|
||||||
|
WHERE
|
||||||
|
point.lock_type = '1'
|
||||||
|
and point.is_used = '1'
|
||||||
|
and point.is_delete = '0'
|
||||||
|
|
||||||
|
OPTION 输入.product_area <> ""
|
||||||
|
point.product_area = 输入.product_area
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.region_code <> ""
|
||||||
|
point.region_code = 输入.region_code
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.point_code <> ""
|
||||||
|
(point.point_code like 输入.point_code or
|
||||||
|
point.point_code like 输入.point_code)
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
ENDSELECT
|
||||||
|
ENDPAGEQUERY
|
||||||
|
ENDIF
|
||||||
|
|||||||
@@ -91,10 +91,18 @@ public class ProductInController {
|
|||||||
return new ResponseEntity<>(productInService.getDisDtl(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(productInService.getDisDtl(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/confirmvehicle")
|
||||||
|
@Log("组盘确认")
|
||||||
|
@ApiOperation("组盘确认")
|
||||||
|
public ResponseEntity<Object> confirmvehicle(@RequestBody JSONObject whereJson) {
|
||||||
|
productInService.confirmvehicle(whereJson);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/divStruct")
|
@PostMapping("/divStruct")
|
||||||
@Log("分配货位")
|
@Log("分配货位")
|
||||||
@ApiOperation("分配货位")
|
@ApiOperation("分配货位")
|
||||||
public ResponseEntity<Object> divStruct(@RequestBody Map whereJson) {
|
public ResponseEntity<Object> divStruct(@RequestBody JSONObject whereJson) {
|
||||||
productInService.divStruct(whereJson);
|
productInService.divStruct(whereJson);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
@@ -102,7 +110,7 @@ public class ProductInController {
|
|||||||
@PostMapping("/unDivStruct")
|
@PostMapping("/unDivStruct")
|
||||||
@Log("取消分配货位")
|
@Log("取消分配货位")
|
||||||
@ApiOperation("取消分配货位")
|
@ApiOperation("取消分配货位")
|
||||||
public ResponseEntity<Object> unDivStruct(@RequestBody Map whereJson) {
|
public ResponseEntity<Object> unDivStruct(@RequestBody JSONObject whereJson) {
|
||||||
productInService.unDivStruct(whereJson);
|
productInService.unDivStruct(whereJson);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
@@ -134,7 +142,6 @@ public class ProductInController {
|
|||||||
@Log("查询箱内子卷")
|
@Log("查询箱内子卷")
|
||||||
@ApiOperation("查询箱内子卷")
|
@ApiOperation("查询箱内子卷")
|
||||||
public ResponseEntity<Object> queryBoxMater(@RequestBody JSONArray whereJson) {
|
public ResponseEntity<Object> queryBoxMater(@RequestBody JSONArray whereJson) {
|
||||||
|
|
||||||
return new ResponseEntity<>(productInService.queryBoxMater(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(productInService.queryBoxMater(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,9 +50,17 @@ public interface ProductInService {
|
|||||||
*/
|
*/
|
||||||
JSONArray getIODtl(JSONObject whereJson);
|
JSONArray getIODtl(JSONObject whereJson);
|
||||||
|
|
||||||
void divStruct(Map whereJson);
|
/**
|
||||||
|
* 分配货位
|
||||||
|
* @param whereJson /
|
||||||
|
*/
|
||||||
|
void divStruct(JSONObject whereJson);
|
||||||
|
|
||||||
void unDivStruct(Map whereJson);
|
/**
|
||||||
|
* 取消分配
|
||||||
|
* @param whereJson /
|
||||||
|
*/
|
||||||
|
void unDivStruct(JSONObject whereJson);
|
||||||
|
|
||||||
void divPoint(Map whereJson);
|
void divPoint(Map whereJson);
|
||||||
|
|
||||||
@@ -79,6 +87,11 @@ public interface ProductInService {
|
|||||||
|
|
||||||
JSONArray queryTask(Map whereJson);
|
JSONArray queryTask(Map whereJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动分配
|
||||||
|
* @param whereJson /
|
||||||
|
* @return JSONObject
|
||||||
|
*/
|
||||||
JSONObject autoDis(JSONObject whereJson);
|
JSONObject autoDis(JSONObject whereJson);
|
||||||
|
|
||||||
JSONObject autoDisMove(JSONObject whereJson);
|
JSONObject autoDisMove(JSONObject whereJson);
|
||||||
@@ -88,4 +101,10 @@ public interface ProductInService {
|
|||||||
* @return JSONArray
|
* @return JSONArray
|
||||||
*/
|
*/
|
||||||
JSONArray queryStor();
|
JSONArray queryStor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组盘确认
|
||||||
|
* @param whereJson /
|
||||||
|
*/
|
||||||
|
void confirmvehicle(JSONObject whereJson);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package org.nl.wms.st.in.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
public interface StorPublicService {
|
||||||
|
/**
|
||||||
|
* 出入库仓位库存修改
|
||||||
|
* @param from 仓位库存变动信息
|
||||||
|
* {
|
||||||
|
* struct_id ,仓位标识
|
||||||
|
* material_id ,物料标识
|
||||||
|
* quality_scode ,品质类型
|
||||||
|
* pcsn ,批次
|
||||||
|
* ivt_level ,库存等级
|
||||||
|
* is_active ,是否可用
|
||||||
|
* change_qty ,变动数(必填,大于0)
|
||||||
|
* bill_type_scode ,单据类型
|
||||||
|
* inv_id,单据标识
|
||||||
|
* bill_code ,单据编号
|
||||||
|
* bill_table ,单据表名(非必填)
|
||||||
|
* qty_unit_id ,单位标识
|
||||||
|
* qty_unit_name ,单位名称
|
||||||
|
* }
|
||||||
|
* @param change_type_scode (变动类型:11-扣减可用; 12-增加可用;21-减库存; 22-加库存; 23-同时加; 24-同时减;25-同时减(配粉出库)31-加待入; 32-减待入;33-减待入加库存加可用;99-其它)
|
||||||
|
*/
|
||||||
|
void IOStor(JSONObject from, String change_type_scode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出入库仓位点位更新
|
||||||
|
* @param from 仓位点位变动信息
|
||||||
|
* {
|
||||||
|
* struct_id ,仓位id
|
||||||
|
* point_code ,点位编码
|
||||||
|
* lock_type ,锁定类型
|
||||||
|
* storagevehicle_code ,载具编码
|
||||||
|
* is_free,是否清除载具(1是,0或缺省为否)
|
||||||
|
* taskdtl_type锁定任务类型
|
||||||
|
* taskdtl_id锁定任务明细标识
|
||||||
|
* task_code锁定任务编码
|
||||||
|
* inv_type锁定单据类型
|
||||||
|
* inv_id锁定单据标识
|
||||||
|
* inv_code锁定单据编码
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
void updateStructAndPoint(JSONObject from);
|
||||||
|
void updateStructAndPoint2(JSONObject from);
|
||||||
|
}
|
||||||
@@ -16,7 +16,9 @@ import org.nl.modules.common.exception.BadRequestException;
|
|||||||
import org.nl.modules.system.util.CodeUtil;
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
import org.nl.modules.wql.WQL;
|
import org.nl.modules.wql.WQL;
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
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.modules.wql.util.WqlUtil;
|
||||||
|
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||||
import org.nl.wms.basedata.st.service.StorattrService;
|
import org.nl.wms.basedata.st.service.StorattrService;
|
||||||
import org.nl.wms.basedata.st.service.StructattrService;
|
import org.nl.wms.basedata.st.service.StructattrService;
|
||||||
import org.nl.wms.basedata.st.service.dto.StorattrDto;
|
import org.nl.wms.basedata.st.service.dto.StorattrDto;
|
||||||
@@ -24,6 +26,7 @@ import org.nl.wms.basedata.st.service.dto.StructattrDto;
|
|||||||
import org.nl.wms.sch.service.PointService;
|
import org.nl.wms.sch.service.PointService;
|
||||||
import org.nl.wms.sch.service.dto.PointDto;
|
import org.nl.wms.sch.service.dto.PointDto;
|
||||||
import org.nl.wms.st.in.service.ProductInService;
|
import org.nl.wms.st.in.service.ProductInService;
|
||||||
|
import org.nl.wms.st.in.service.StorPublicService;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -47,6 +50,8 @@ public class ProductInServiceImpl implements ProductInService {
|
|||||||
|
|
||||||
private final PointService pointService;
|
private final PointService pointService;
|
||||||
|
|
||||||
|
private final StorPublicService storPublicService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
|
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
|
||||||
@@ -342,138 +347,108 @@ public class ProductInServiceImpl implements ProductInService {
|
|||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public void divStruct(Map whereJson) {
|
public void divStruct(JSONObject whereJson) {
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||||
|
|
||||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
String sect_id = "";
|
|
||||||
String sect_code = "";
|
|
||||||
String sect_name = "";
|
|
||||||
String struct_id = "";
|
|
||||||
String struct_code = "";
|
|
||||||
String struct_name = "";
|
|
||||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableMater");
|
|
||||||
JSONObject whereJson2 = JSONObject.parseObject(JSON.toJSONString(whereJson));
|
|
||||||
HashMap<String, String> map = rows.get(0);
|
|
||||||
|
|
||||||
Boolean auto_div = false;
|
String region_code = "";
|
||||||
if (whereJson2.containsKey("auto_div")) {
|
String region_name = "";
|
||||||
auto_div = whereJson2.getBoolean("auto_div");
|
String point_id = "";
|
||||||
}
|
String point_code = "";
|
||||||
//判断该载具是否已经分配货位或者起点
|
String point_name = "";
|
||||||
JSONArray now_dis_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "17").addParam("box_no", map.get("box_no")).process().getResultJSONArray(0);
|
String is_length = "";
|
||||||
if (now_dis_rows.size() > 0 && !auto_div) {
|
|
||||||
throw new BadRequestException("该木箱已经分配过货位,无法继续分配!");
|
|
||||||
}
|
|
||||||
|
|
||||||
String point_code = map.get("point_code");
|
JSONArray rows = whereJson.getJSONArray("tableMater");
|
||||||
if (StrUtil.isNotEmpty(point_code)) {
|
JSONObject map = rows.getJSONObject(0);
|
||||||
HashMap<String, String> point_map = new HashMap<>();
|
JSONObject jsonDtl = whereJson.getJSONObject("dtl_row");
|
||||||
PointDto pointDto = pointService.findByCode(point_code);
|
|
||||||
point_map.put("point_code", pointDto.getPoint_code());
|
|
||||||
point_map.put("point_id", pointDto.getPoint_id() + "");
|
|
||||||
point_map.put("point_name", pointDto.getPoint_name());
|
|
||||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDis").update(point_map, "iostorinv_id = '" + map.get("iostorinv_id") + "' AND box_no = '" + map.get("box_no") + "'");
|
|
||||||
}
|
|
||||||
|
|
||||||
Boolean checked = whereJson2.getBoolean("checked");
|
|
||||||
//是否分配货位
|
|
||||||
if (ObjectUtil.isNotEmpty(checked) && checked) {
|
|
||||||
JSONObject jo_form = new JSONObject();
|
|
||||||
jo_form.put("box_no", map.get("box_no"));
|
|
||||||
JSONObject struct_jo = new JSONObject();
|
|
||||||
if (whereJson.containsKey("sect_id")) {
|
|
||||||
String need_sect = (String) whereJson.get("sect_id");
|
|
||||||
JSONObject need_sect_jo = WQLObject.getWQLObject("st_ivt_sectattr").query("sect_id = '" + need_sect + "'").uniqueResult(0);
|
|
||||||
//判断是否为主存区,主存区调用自动分配,虚拟区调用普通查询
|
|
||||||
if (StrUtil.isNotEmpty(need_sect) && !need_sect_jo.getString("sect_type_attr").equals("00")) {
|
|
||||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("sect_id = '" + need_sect + "' AND lock_type = '1' AND is_delete = '0' AND IFNULL( storagevehicle_code, '' ) = ''").uniqueResult(0);
|
|
||||||
} else {
|
|
||||||
jo_form.put("sect_id", whereJson.get("sect_id"));
|
|
||||||
struct_jo = this.autoDis(jo_form);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new BadRequestException("请选择需要分配的库区!");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(struct_jo)) {
|
|
||||||
throw new BadRequestException("未查询到适用仓位!");
|
|
||||||
}
|
|
||||||
sect_id = struct_jo.getString("sect_id");
|
|
||||||
sect_code = struct_jo.getString("sect_code");
|
|
||||||
sect_name = struct_jo.getString("sect_name");
|
|
||||||
struct_id = struct_jo.getString("struct_id");
|
|
||||||
struct_code = struct_jo.getString("struct_code");
|
|
||||||
struct_name = struct_jo.getString("struct_name");
|
|
||||||
} else {
|
|
||||||
//更新入库分配表仓位相关字段
|
|
||||||
sect_id = map.get("sect_id");
|
|
||||||
sect_code = map.get("sect_code");
|
|
||||||
sect_name = map.get("sect_name");
|
|
||||||
struct_id = map.get("struct_id");
|
|
||||||
struct_code = map.get("struct_code");
|
|
||||||
struct_name = map.get("struct_name");
|
|
||||||
}
|
|
||||||
HashMap<String, String> dis_map = new HashMap();
|
|
||||||
dis_map.put("sect_id", sect_id);
|
|
||||||
dis_map.put("sect_code", sect_code);
|
|
||||||
dis_map.put("sect_name", sect_name);
|
|
||||||
dis_map.put("struct_id", struct_id);
|
|
||||||
dis_map.put("struct_code", struct_code);
|
|
||||||
dis_map.put("struct_name", struct_name);
|
|
||||||
|
|
||||||
//锁定货位
|
|
||||||
JSONObject lock_map = new JSONObject();
|
|
||||||
lock_map.put("end_point", struct_code);
|
|
||||||
//查询主表信息
|
//查询主表信息
|
||||||
JSONObject mst = WQLObject.getWQLObject("st_ivt_iostorinv").query("iostorinv_id = '" + map.get("iostorinv_id") + "'").uniqueResult(0);
|
JSONObject mst = WQLObject.getWQLObject("st_ivt_iostorinv").query("iostorinv_id = '" + map.get("iostorinv_id") + "'").uniqueResult(0);
|
||||||
lock_map.put("inv_type", mst.get("bill_type"));
|
|
||||||
lock_map.put("inv_id", mst.get("iostorinv_id"));
|
|
||||||
lock_map.put("inv_code", mst.get("bill_code"));
|
|
||||||
// inbillService.operatePoint("0", lock_map);
|
|
||||||
|
|
||||||
//判断起点是否不为空
|
JSONObject jsonDis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinvdis_id = '" + map.getString("iostorinvdis_id") + "'").uniqueResult(0);
|
||||||
JSONObject ios_dis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + map.get("iostorinv_id") + "' AND box_no = '" + map.get("box_no") + "'").uniqueResult(0);
|
// 校验是否已分配
|
||||||
|
if (ObjectUtil.isNotEmpty(jsonDis.getString("struct_id"))) {
|
||||||
JSONObject sect_jo = WQLObject.getWQLObject("st_ivt_sectattr").query("sect_id ='" + sect_id + "'").uniqueResult(0);
|
throw new BadRequestException("该明细已分配,无法继续分配!");
|
||||||
boolean is_virtual = false;
|
|
||||||
if (sect_jo.getString("sect_type_attr").equals("09")) {
|
|
||||||
is_virtual = true;
|
|
||||||
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
|
||||||
dis_map.put("task_id", task_id);
|
|
||||||
dis_map.put("work_status", "01");
|
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotEmpty(ios_dis.getString("point_id")) && !is_virtual) {
|
// 校验是否已组盘
|
||||||
// Boolean transfer = whereJson2.getBoolean("transfer",false);
|
if (ObjectUtil.isEmpty(jsonDis.getString("storagevehicle_code"))) {
|
||||||
Boolean transfer = whereJson2.getBoolean("transfer");
|
throw new BadRequestException("请先进行组盘");
|
||||||
if (ObjectUtil.isEmpty(transfer)) {
|
}
|
||||||
transfer = false;
|
|
||||||
|
Boolean checked = whereJson.getBoolean("checked");
|
||||||
|
if (ObjectUtil.isNotEmpty(checked) && checked) {
|
||||||
|
// 自动分配
|
||||||
|
JSONObject jsonParam = new JSONObject();
|
||||||
|
JSONObject jsonPoint = new JSONObject();
|
||||||
|
if (whereJson.containsKey("sect_id")) {
|
||||||
|
jsonParam.put("sect_id", whereJson.get("sect_id"));
|
||||||
|
jsonParam.put("stor_id", whereJson.get("stor_id"));
|
||||||
|
jsonParam.put("material_id", jsonDtl.getString("material_id"));
|
||||||
|
jsonPoint = this.autoDis(jsonParam);
|
||||||
|
is_length = jsonPoint.getString("is_length");
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException("请选择需要分配的区域!");
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建任务并下发
|
if (ObjectUtil.isEmpty(jsonPoint)) {
|
||||||
// InTask task = new InTask();
|
throw new BadRequestException("未查询到适用点位!");
|
||||||
JSONObject task_form = new JSONObject();
|
}
|
||||||
task_form.put("task_type", "010501");
|
|
||||||
task_form.put("start_device_code", map.get("point_code"));
|
region_code = jsonPoint.getString("region_code");
|
||||||
task_form.put("next_device_code", struct_code);
|
region_name = jsonPoint.getString("region_name");
|
||||||
task_form.put("vehicle_code", map.get("box_no"));
|
point_id = jsonPoint.getString("point_id");
|
||||||
task_form.put("storagevehicle_type", map.get("storagevehicle_type"));
|
point_code = jsonPoint.getString("point_code");
|
||||||
// String task_id = task.createTask(task_form);
|
point_name = jsonPoint.getString("point_name");
|
||||||
// 下发
|
} else {
|
||||||
// task.immediateNotifyAcs(task_id);
|
// 指定货位: 判断所选货位是否满足物料
|
||||||
/* if (whereJson.containsKey("auto_issue")) {
|
// 判断物料是否超长
|
||||||
}*/
|
JSONObject jsonMater = materTab.query("material_id = '" + map.getString("material_id") + "'").uniqueResult(0);
|
||||||
// dis_map.put("task_id", task_id);
|
|
||||||
dis_map.put("work_status", "01");
|
String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MATERIAL_LENGTH_UP").getValue();
|
||||||
|
double material_length = jsonMater.getDoubleValue("length");
|
||||||
|
double material_length_up = Double.valueOf(length_up);
|
||||||
|
|
||||||
|
if (material_length > material_length_up) {
|
||||||
|
throw new BadRequestException("物料超长,请自动分配");
|
||||||
|
}
|
||||||
|
|
||||||
|
region_code = map.getString("region_code");
|
||||||
|
region_name = map.getString("region_name");
|
||||||
|
point_id = map.getString("struct_id");
|
||||||
|
point_code = map.getString("struct_code");
|
||||||
|
point_name = map.getString("struct_name");
|
||||||
}
|
}
|
||||||
|
|
||||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDis").update(dis_map, "iostorinv_id = '" + map.get("iostorinv_id") + "' AND box_no = '" + map.get("box_no") + "'");
|
HashMap<String, String> dis_map = new HashMap();
|
||||||
|
dis_map.put("region_code", region_code);
|
||||||
|
dis_map.put("region_name", region_name);
|
||||||
|
dis_map.put("struct_id", point_id);
|
||||||
|
dis_map.put("struct_code", point_code);
|
||||||
|
dis_map.put("struct_name", point_name);
|
||||||
|
|
||||||
//修改库存
|
//锁定货位
|
||||||
|
JSONObject jsonPoint1 = pointTab.query("point_id = '" + point_id + "'").uniqueResult(0);
|
||||||
|
jsonPoint1.put("lock_type", "2");
|
||||||
|
pointTab.update(jsonPoint1);
|
||||||
|
// 判断是否需要锁定两个货位
|
||||||
|
if (is_length.equals("1")) {
|
||||||
|
JSONObject jsonPoint2 = pointTab.query("point_id = '" + jsonPoint1.getString("control_point") + "'").uniqueResult(0);
|
||||||
|
jsonPoint2.put("lock_type", "2");
|
||||||
|
pointTab.update(jsonPoint2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新分配明细
|
||||||
|
WQLObject.getWQLObject("ST_IVT_IOStorInvDis").update(dis_map, "iostorinv_id = '" + map.get("iostorinv_id") + "'");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 更新库存
|
||||||
|
*/
|
||||||
//直接取出入库分配表的库存
|
//直接取出入库分配表的库存
|
||||||
JSONArray dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + map.get("iostorinv_id") + "' AND box_no = '" + map.get("box_no") + "'").getResultJSONArray(0);
|
JSONArray dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + map.get("iostorinv_id") + "'").getResultJSONArray(0);
|
||||||
JSONObject mst_jo = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '" + map.get("iostorinv_id") + "'").uniqueResult(0);
|
|
||||||
for (int i = 0; i < dis_rows.size(); i++) {
|
for (int i = 0; i < dis_rows.size(); i++) {
|
||||||
JSONObject dis_jo = dis_rows.getJSONObject(i);
|
JSONObject dis_jo = dis_rows.getJSONObject(i);
|
||||||
JSONObject i_form = new JSONObject();
|
JSONObject i_form = new JSONObject();
|
||||||
@@ -481,95 +456,86 @@ public class ProductInServiceImpl implements ProductInService {
|
|||||||
i_form.put("material_id", dis_jo.getString("material_id"));
|
i_form.put("material_id", dis_jo.getString("material_id"));
|
||||||
i_form.put("pcsn", dis_jo.getString("pcsn"));
|
i_form.put("pcsn", dis_jo.getString("pcsn"));
|
||||||
i_form.put("change_qty", dis_jo.getString("plan_qty"));
|
i_form.put("change_qty", dis_jo.getString("plan_qty"));
|
||||||
i_form.put("bill_type_scode", mst_jo.getString("bill_type"));
|
i_form.put("bill_type_scode", mst.getString("bill_type"));
|
||||||
i_form.put("quality_scode", "01");
|
i_form.put("quality_scode", "01");
|
||||||
i_form.put("inv_id", mst_jo.getString("iostorinv_id"));
|
i_form.put("inv_id", mst.getString("iostorinv_id"));
|
||||||
i_form.put("bill_code", mst_jo.getString("bill_code"));
|
i_form.put("bill_code", mst.getString("bill_code"));
|
||||||
i_form.put("bill_table", "ST_IVT_IOStorInv");
|
i_form.put("bill_table", "ST_IVT_IOStorInv");
|
||||||
i_form.put("qty_unit_id", dis_jo.getString("qty_unit_id"));
|
i_form.put("qty_unit_id", dis_jo.getString("qty_unit_id"));
|
||||||
i_form.put("qty_unit_name", dis_jo.getString("qty_unit_name"));
|
i_form.put("qty_unit_name", dis_jo.getString("qty_unit_name"));
|
||||||
// storPublicService.IOStor(i_form, "31");
|
storPublicService.IOStor(i_form, "31");
|
||||||
|
|
||||||
JSONObject dtl_jo = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "'").uniqueResult(0);
|
JSONObject dtl_jo = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "'").uniqueResult(0);
|
||||||
if (StrUtil.isNotEmpty(ios_dis.getString("point_id")) || is_virtual) {
|
|
||||||
if (dtl_jo.getDoubleValue("unassign_qty") == 0) {
|
if (dtl_jo.getDoubleValue("unassign_qty") == 0) {
|
||||||
//判断该明细下是否还存在未分配货位的分配明细
|
//判断该明细下是否还存在未分配货位的分配明细
|
||||||
JSONArray disdiv_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "' AND (struct_id = '' OR struct_id is null) AND (point_id = '' OR point_id is null)").getResultJSONArray(0);
|
JSONArray disdiv_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "' AND (struct_id = '' OR struct_id is null)").getResultJSONArray(0);
|
||||||
if (disdiv_rows.size() == 0) {
|
if (disdiv_rows.size() == 0) {
|
||||||
dtl_jo.put("bill_status", "40");
|
dtl_jo.put("bill_status", "30");
|
||||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").update(dtl_jo);
|
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").update(dtl_jo);
|
||||||
//判断主表下的明细是否都为40
|
//判断主表下的明细是否都为40
|
||||||
JSONArray dtl_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinv_id = '" + dis_jo.getString("iostorinv_id") + "' AND bill_status < '40'").getResultJSONArray(0);
|
JSONArray dtl_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinv_id = '" + dis_jo.getString("iostorinv_id") + "' AND bill_status < '30'").getResultJSONArray(0);
|
||||||
if (dtl_rows.size() == 0) {
|
if (dtl_rows.size() == 0) {
|
||||||
mst_jo.put("bill_status", "40");
|
mst.put("bill_status", "30");
|
||||||
mst_jo.put("dis_optid", currentUserId);
|
mst.put("dis_optid", currentUserId);
|
||||||
mst_jo.put("dis_optname", nickName);
|
mst.put("dis_optname", nickName);
|
||||||
mst_jo.put("dis_time", now);
|
mst.put("dis_time", now);
|
||||||
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst_jo);
|
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst);
|
||||||
} else {
|
} else {
|
||||||
mst_jo.put("bill_status", "30");
|
mst.put("bill_status", "20");
|
||||||
mst_jo.put("dis_optid", currentUserId);
|
mst.put("dis_optid", currentUserId);
|
||||||
mst_jo.put("dis_optname", nickName);
|
mst.put("dis_optname", nickName);
|
||||||
mst_jo.put("dis_time", now);
|
mst.put("dis_time", now);
|
||||||
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst_jo);
|
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
dtl_jo.put("bill_status", "30");
|
|
||||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").update(dtl_jo);
|
|
||||||
mst_jo.put("bill_status", "30");
|
|
||||||
mst_jo.put("dis_optid", currentUserId);
|
|
||||||
mst_jo.put("dis_optname", nickName);
|
|
||||||
mst_jo.put("dis_time", now);
|
|
||||||
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst_jo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果是虚拟区,直接更新完成分配任务
|
|
||||||
if (is_virtual) {
|
|
||||||
JSONObject dis_form = new JSONObject();
|
|
||||||
dis_form.put("task_id", dis_map.get("task_id"));
|
|
||||||
// inbillService.confirmDis(dis_form);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public void unDivStruct(Map jo) {
|
public void unDivStruct(JSONObject jo) {
|
||||||
WQLObject dis_wql = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
|
WQLObject dis_wql = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
|
||||||
WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point");
|
WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point");
|
||||||
WQLObject struct_table = WQLObject.getWQLObject("ST_IVT_StructAttr");
|
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||||
|
|
||||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) jo.get("tableMater");
|
JSONArray rows = jo.getJSONArray("tableMater");
|
||||||
HashMap<String, String> whereJson = rows.get(0);
|
JSONObject whereJson = rows.getJSONObject(0);
|
||||||
|
|
||||||
//解锁原货位点位
|
//解锁原货位点位
|
||||||
HashMap unlock_map = new HashMap();
|
JSONObject jsonPoint1 = point_table.query("point_code = '" + whereJson.getString("struct_code") + "'").uniqueResult(0);
|
||||||
unlock_map.put("lock_type", "1");
|
jsonPoint1.put("lock_type", "1");
|
||||||
unlock_map.put("taskdtl_type", "");
|
point_table.update(jsonPoint1);
|
||||||
unlock_map.put("taskdtl_id", "");
|
|
||||||
unlock_map.put("task_code", "");
|
// 判断此物料是否超长
|
||||||
unlock_map.put("inv_type", "");
|
JSONObject jsonMater = materTab.query("material_id = '" + whereJson.getString("material_id") + "'").uniqueResult(0);
|
||||||
unlock_map.put("inv_id", "");
|
|
||||||
unlock_map.put("inv_code", "");
|
String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MATERIAL_LENGTH_UP").getValue();
|
||||||
point_table.update(unlock_map, "point_code = '" + whereJson.get("struct_code") + "'");
|
double material_length = jsonMater.getDoubleValue("length");
|
||||||
struct_table.update(unlock_map, "struct_code = '" + whereJson.get("struct_code") + "'");
|
double material_length_up = Double.valueOf(length_up);
|
||||||
|
|
||||||
|
if (material_length > material_length_up) {
|
||||||
|
// 超长则解锁对应点位
|
||||||
|
JSONObject jsonPoint2 = point_table.query("point_id = '" + jsonPoint1.getString("control_point") + "'").uniqueResult(0);
|
||||||
|
jsonPoint2.put("lock_type","1");
|
||||||
|
point_table.update(jsonPoint2);
|
||||||
|
}
|
||||||
|
|
||||||
//减去原货位的待入数
|
//减去原货位的待入数
|
||||||
JSONArray dis_rows = dis_wql.query("struct_code = '" + whereJson.get("struct_code") + "' AND work_status < '99'").getResultJSONArray(0);
|
JSONArray dis_rows = dis_wql.query("struct_code = '" + whereJson.get("struct_code") + "' AND work_status < '99'").getResultJSONArray(0);
|
||||||
if (dis_rows.size() <= 0) {
|
if (dis_rows.size() <= 0) {
|
||||||
throw new BadRequestException("数据参数有误!");
|
throw new BadRequestException("数据参数有误!");
|
||||||
}
|
}
|
||||||
StructattrDto old_struct = structattrService.findByCode((String) whereJson.get("struct_code"));
|
|
||||||
JSONObject mst_jo = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '" + dis_rows.getJSONObject(0).getString("iostorinv_id") + "'").uniqueResult(0);
|
JSONObject mst_jo = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '" + dis_rows.getJSONObject(0).getString("iostorinv_id") + "'").uniqueResult(0);
|
||||||
for (int i = 0; i < dis_rows.size(); i++) {
|
for (int i = 0; i < dis_rows.size(); i++) {
|
||||||
JSONObject i_form = new JSONObject();
|
JSONObject i_form = new JSONObject();
|
||||||
JSONObject dis_row = dis_rows.getJSONObject(i);
|
JSONObject dis_row = dis_rows.getJSONObject(i);
|
||||||
i_form.put("struct_id", old_struct.getStruct_id());
|
i_form.put("struct_id", dis_row.getString("struct_id"));
|
||||||
i_form.put("material_id", dis_row.getString("material_id"));
|
i_form.put("material_id", dis_row.getString("material_id"));
|
||||||
i_form.put("quality_scode", dis_row.getString("quality_scode"));
|
i_form.put("quality_scode", "01");
|
||||||
i_form.put("pcsn", dis_row.getString("pcsn"));
|
i_form.put("pcsn", dis_row.getString("pcsn"));
|
||||||
i_form.put("ivt_level", dis_row.getString("ivt_level"));
|
|
||||||
i_form.put("change_qty", dis_row.getString("plan_qty"));
|
i_form.put("change_qty", dis_row.getString("plan_qty"));
|
||||||
i_form.put("bill_type_scode", mst_jo.getString("bill_type"));
|
i_form.put("bill_type_scode", mst_jo.getString("bill_type"));
|
||||||
i_form.put("inv_id", mst_jo.getString("iostorinv_id"));
|
i_form.put("inv_id", mst_jo.getString("iostorinv_id"));
|
||||||
@@ -577,28 +543,23 @@ public class ProductInServiceImpl implements ProductInService {
|
|||||||
i_form.put("bill_table", "ST_IVT_IOStorInv");
|
i_form.put("bill_table", "ST_IVT_IOStorInv");
|
||||||
i_form.put("qty_unit_id", dis_row.getString("qty_unit_id"));
|
i_form.put("qty_unit_id", dis_row.getString("qty_unit_id"));
|
||||||
i_form.put("qty_unit_name", dis_row.getString("qty_unit_name"));
|
i_form.put("qty_unit_name", dis_row.getString("qty_unit_name"));
|
||||||
// storPublicService.IOStor(i_form, "32");
|
storPublicService.IOStor(i_form, "32");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新分配状态
|
//更新分配状态
|
||||||
HashMap<String, String> map = new HashMap<>();
|
HashMap<String, String> map = new HashMap<>();
|
||||||
map.put("point_id", "");
|
map.put("region_code", "");
|
||||||
map.put("sect_id", "");
|
map.put("region_name", "");
|
||||||
map.put("sect_code", "");
|
|
||||||
map.put("sect_name", "");
|
|
||||||
map.put("struct_id", "");
|
map.put("struct_id", "");
|
||||||
map.put("struct_code", "");
|
map.put("struct_code", "");
|
||||||
map.put("struct_name", "");
|
map.put("struct_name", "");
|
||||||
map.put("work_status", "00");
|
map.put("work_status", "00");
|
||||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDis").update(map, "iostorinv_id = '" + mst_jo.get("iostorinv_id") + "' AND box_no = '" + whereJson.get("box_no") + "'");
|
WQLObject.getWQLObject("ST_IVT_IOStorInvDis").update(map, "iostorinv_id = '" + mst_jo.get("iostorinv_id") + "'");
|
||||||
|
|
||||||
//修改明细状态
|
//修改明细状态
|
||||||
JSONObject dtl_jo = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinvdtl_id = '" + dis_rows.getJSONObject(0).getString("iostorinvdtl_id") + "'").uniqueResult(0);
|
|
||||||
|
|
||||||
HashMap<String, String> dtl_map = new HashMap<>();
|
HashMap<String, String> dtl_map = new HashMap<>();
|
||||||
dtl_map.put("bill_status", "10");
|
dtl_map.put("bill_status", "10");
|
||||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").update(dtl_map, "iostorinv_id = '" + mst_jo.get("iostorinv_id") + "' AND box_no = '" + whereJson.get("box_no") + "'");
|
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").update(dtl_map, "iostorinv_id = '" + mst_jo.get("iostorinv_id") + "'");
|
||||||
|
|
||||||
//更新主表状态
|
//更新主表状态
|
||||||
JSONArray dtl_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinv_id = '" + mst_jo.get("iostorinv_id") + "' AND bill_status IN ('20','30')").getResultJSONArray(0);
|
JSONArray dtl_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinv_id = '" + mst_jo.get("iostorinv_id") + "' AND bill_status IN ('20','30')").getResultJSONArray(0);
|
||||||
@@ -692,288 +653,69 @@ public class ProductInServiceImpl implements ProductInService {
|
|||||||
public JSONObject autoDis(JSONObject whereJson) {
|
public JSONObject autoDis(JSONObject whereJson) {
|
||||||
/*
|
/*
|
||||||
* 分配逻辑:
|
* 分配逻辑:
|
||||||
* 1、先查找该木箱内属于什么物料、订单,定位到具体的块、排,查看是否存在空位
|
* 1、如果物料超长则占用两个货位并把物料放在一层 (暂时用系统参数)
|
||||||
* a、存在的话,优先放在这一块这一排中(遍历)
|
* 2、如果物料超重则尽量把物料放在一层(暂时用系统参数)
|
||||||
* b、不存在则根据该订单物料大概数量、选择数量相近的一个空巷道
|
|
||||||
* 1)存在空巷道
|
|
||||||
* 2)不存在,则找一个双通有空位置、数量相近的巷道
|
|
||||||
* */
|
* */
|
||||||
|
|
||||||
|
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表
|
||||||
|
|
||||||
JSONObject struct_jo = new JSONObject();
|
JSONObject struct_jo = new JSONObject();
|
||||||
|
String material_id = whereJson.getString("material_id");
|
||||||
|
String region_code = whereJson.getString("sect_id");
|
||||||
|
String product_area = whereJson.getString("stor_id");
|
||||||
|
|
||||||
String box_no = whereJson.getString("box_no");
|
JSONObject jsonMater = materTab.query("material_id = '" + material_id + "'").uniqueResult(0);
|
||||||
|
|
||||||
String sect_id = whereJson.getString("sect_id");
|
// 判断物料是否超长
|
||||||
|
String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MATERIAL_LENGTH_UP").getValue();
|
||||||
|
double material_length = jsonMater.getDoubleValue("length");
|
||||||
|
double material_length_up = Double.valueOf(length_up);
|
||||||
|
|
||||||
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + box_no + "' AND status < 3").uniqueResult(0);
|
if (material_length > material_length_up) {
|
||||||
|
// 超长:找一层两个货位
|
||||||
|
JSONArray pointArr = WQL.getWO("QST_IVT_DIS_01").addParam("flag", "1")
|
||||||
|
.addParam("region_code", region_code)
|
||||||
|
.addParam("product_area", product_area)
|
||||||
|
.process().getResultJSONArray(0);
|
||||||
|
|
||||||
String material_code = sub_jo.getString("product_name");
|
for (int i = 0; i < pointArr.size(); i++) {
|
||||||
|
JSONObject json = pointArr.getJSONObject(i);
|
||||||
|
// 查询此点位对应的点位是否是无货未锁定状态
|
||||||
|
JSONObject jsonControlPoint = pointTab.query("point_id = '" + json.getString("control_point") +
|
||||||
|
"' and is_delete = '0' and is_used = '1' and point_status = '1' and lock_type = '1'").uniqueResult(0);
|
||||||
|
|
||||||
String sale_order_name = sub_jo.getString("sale_order_name");
|
if (ObjectUtil.isNotEmpty(jsonControlPoint)) {
|
||||||
|
json.put("is_length", "1");
|
||||||
HashMap<String, String> row_map = new HashMap<>();
|
struct_jo = json;
|
||||||
row_map.put("material_code", material_code);
|
|
||||||
row_map.put("sale_order_name", sale_order_name);
|
|
||||||
row_map.put("sect_id", sect_id);
|
|
||||||
row_map.put("flag", "11");
|
|
||||||
//查询到当前可用的巷道
|
|
||||||
JSONArray rowArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
|
||||||
|
|
||||||
for (int i = 0; i < rowArr.size(); i++) {
|
|
||||||
JSONObject row_jo = rowArr.getJSONObject(i);
|
|
||||||
|
|
||||||
String block_num = row_jo.getString("block_num");
|
|
||||||
String row_num = row_jo.getString("row_num");
|
|
||||||
String placement_type = row_jo.getString("placement_type");
|
|
||||||
|
|
||||||
// 判断此排是否有除:入库锁、移入锁以外的锁
|
|
||||||
JSONArray isLock = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
|
|
||||||
if (ObjectUtil.isEmpty(isLock)) {
|
|
||||||
if (placement_type.equals("02")) {
|
|
||||||
// 左通
|
|
||||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
|
|
||||||
break;
|
|
||||||
} else if (placement_type.equals("03")) {
|
|
||||||
// 右通
|
|
||||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// 双通
|
continue;
|
||||||
|
|
||||||
// 先倒序找到第一个木箱、判断上一个是否有货位
|
|
||||||
JSONObject jsonDescBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
|
|
||||||
|
|
||||||
JSONObject jsonDescStruct = new JSONObject();
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonDescBox)) {
|
|
||||||
String out_order_seq = jsonDescBox.getString("out_order_seq");
|
|
||||||
jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
|
||||||
} else {
|
|
||||||
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
|
|
||||||
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
|
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
|
|
||||||
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
|
|
||||||
jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonDescStruct)) {
|
|
||||||
struct_jo = jsonDescStruct;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
// 没有就正序找到第一个物料、判断上一个是否有货位
|
|
||||||
JSONObject jsonAscBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
|
|
||||||
|
|
||||||
JSONObject jsonAscStruct = new JSONObject();
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonAscBox)) {
|
|
||||||
String out_order_seq2 = jsonAscBox.getString("out_order_seq");
|
|
||||||
// 上一个货位顺序号
|
|
||||||
jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
|
||||||
} else {
|
|
||||||
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
|
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
|
|
||||||
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
|
|
||||||
jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonAscStruct)) {
|
|
||||||
struct_jo = jsonAscStruct;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
// 说明这排有任务在执行,新开一排
|
|
||||||
//根据分切计划查询该订单物料大概还有多少未入
|
|
||||||
row_map.put("flag", "12");
|
|
||||||
JSONArray plan_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
|
||||||
if (ObjectUtil.isEmpty(plan_rows)) {
|
|
||||||
plan_rows = new JSONArray();
|
|
||||||
}
|
|
||||||
//查询该销售订单及行号有多少个生成状态的箱子
|
|
||||||
row_map.put("flag", "27");
|
|
||||||
JSONArray box_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
|
||||||
if (ObjectUtil.isEmpty(box_rows)) {
|
|
||||||
box_rows = new JSONArray();
|
|
||||||
}
|
|
||||||
int box_num = (int) Math.ceil(plan_rows.size() / 2) + box_rows.size();
|
|
||||||
|
|
||||||
//查询数量与订单物料箱子数量相近的一排
|
|
||||||
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("sect_id", sect_id).addParam("flag", "13").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num),block_num,row_num").process().uniqueResult(0);
|
|
||||||
if (ObjectUtil.isNotEmpty(empty_row)) {
|
|
||||||
String block_num2 = empty_row.getString("block_num");
|
|
||||||
String row_num2 = empty_row.getString("row_num");
|
|
||||||
String placement_type2 = empty_row.getString("placement_type");
|
|
||||||
|
|
||||||
if (placement_type.equals("02")) {
|
|
||||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//如果查询不到空的一排,则查询有空位双通的一排
|
|
||||||
JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().getResultJSONArray(0);
|
|
||||||
|
|
||||||
for (int j = 0; j < haveArr.size(); j++) {
|
|
||||||
JSONObject have_row = haveArr.getJSONObject(j);
|
|
||||||
|
|
||||||
String block_num3 = have_row.getString("block_num");
|
|
||||||
String row_num3 = have_row.getString("row_num");
|
|
||||||
|
|
||||||
JSONArray isLock2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
|
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(isLock2)) {
|
|
||||||
// 先倒序找到第一个木箱、判断上一个是否有货位
|
|
||||||
JSONObject jsonDescBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
|
|
||||||
|
|
||||||
JSONObject jsonDescStruct2 = new JSONObject();
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonDescBox2)) {
|
|
||||||
String out_order_seq = jsonDescBox2.getString("out_order_seq");
|
|
||||||
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
|
||||||
} else {
|
|
||||||
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
|
|
||||||
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
|
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
|
|
||||||
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
|
|
||||||
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonDescStruct2)) {
|
|
||||||
struct_jo = jsonDescStruct2;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
// 没有就正序找到第一个物料、判断上一个是否有货位
|
|
||||||
JSONObject jsonAscBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
|
|
||||||
|
|
||||||
JSONObject jsonAscStruct2 = new JSONObject();
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonAscBox2)) {
|
|
||||||
String out_order_seq2 = jsonAscBox2.getString("out_order_seq");
|
|
||||||
// 上一个货位顺序号
|
|
||||||
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
|
||||||
} else {
|
|
||||||
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
|
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
|
|
||||||
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
|
|
||||||
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonAscStruct2)) {
|
|
||||||
struct_jo = jsonAscStruct2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 未超长:判断是否超重
|
||||||
|
String weight_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MATERIAL_WEIGHT_UP").getValue();
|
||||||
|
double material_weight = jsonMater.getDoubleValue("net_weight");
|
||||||
|
double material_weight_up = Double.valueOf(weight_up);
|
||||||
|
|
||||||
|
if (material_weight > material_weight_up) {
|
||||||
|
// 超重: 尽量放在一层
|
||||||
|
struct_jo = WQL.getWO("QST_IVT_DIS_01").addParam("flag", "2")
|
||||||
|
.addParam("region_code", region_code)
|
||||||
|
.addParam("product_area", product_area)
|
||||||
|
.process().uniqueResult(0);
|
||||||
} else {
|
} else {
|
||||||
continue;
|
// 未超重: 尽量放在三层
|
||||||
}
|
struct_jo = WQL.getWO("QST_IVT_DIS_01").addParam("flag", "3")
|
||||||
}
|
.addParam("region_code", region_code)
|
||||||
|
.addParam("product_area", product_area)
|
||||||
if (ObjectUtil.isEmpty(rowArr) || ObjectUtil.isEmpty(struct_jo)) {
|
.process().uniqueResult(0);
|
||||||
//如果不存在相同订单物料的巷道 或者未找到相同物料订单号巷道中的货位 则
|
|
||||||
|
|
||||||
//根据分切计划查询该订单物料大概还有多少未入
|
|
||||||
row_map.put("flag", "12");
|
|
||||||
JSONArray plan_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
|
||||||
if (ObjectUtil.isEmpty(plan_rows)) {
|
|
||||||
plan_rows = new JSONArray();
|
|
||||||
}
|
|
||||||
//查询该销售订单及行号有多少个生成状态的箱子
|
|
||||||
row_map.put("flag", "27");
|
|
||||||
JSONArray box_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
|
||||||
if (ObjectUtil.isEmpty(box_rows)) {
|
|
||||||
box_rows = new JSONArray();
|
|
||||||
}
|
|
||||||
int box_num = (int) Math.ceil(plan_rows.size() / 2) + box_rows.size();
|
|
||||||
|
|
||||||
//查询数量与订单物料箱子数量相近的一排
|
|
||||||
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("sect_id", sect_id).addParam("flag", "13").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num),block_num,row_num").process().uniqueResult(0);
|
|
||||||
if (ObjectUtil.isNotEmpty(empty_row)) {
|
|
||||||
String block_num = empty_row.getString("block_num");
|
|
||||||
String row_num = empty_row.getString("row_num");
|
|
||||||
String placement_type = empty_row.getString("placement_type");
|
|
||||||
|
|
||||||
if (placement_type.equals("02")) {
|
|
||||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND placement_type = '" + placement_type + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
|
|
||||||
} else {
|
|
||||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND placement_type = '" + placement_type + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
//如果查询不到空的一排,则查询有空位双通的一排
|
|
||||||
JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().getResultJSONArray(0);
|
|
||||||
for (int j = 0; j < haveArr.size(); j++) {
|
|
||||||
JSONObject have_row = haveArr.getJSONObject(j);
|
|
||||||
|
|
||||||
String block_num3 = have_row.getString("block_num");
|
|
||||||
String row_num3 = have_row.getString("row_num");
|
|
||||||
|
|
||||||
JSONArray isLock2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
|
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(isLock2)) {
|
|
||||||
// 先倒序找到第一个木箱、判断上一个是否有货位
|
|
||||||
JSONObject jsonDescBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
|
|
||||||
|
|
||||||
JSONObject jsonDescStruct2 = new JSONObject();
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonDescBox2)) {
|
|
||||||
String out_order_seq = jsonDescBox2.getString("out_order_seq");
|
|
||||||
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
|
||||||
} else {
|
|
||||||
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
|
|
||||||
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
|
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
|
|
||||||
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
|
|
||||||
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonDescStruct2)) {
|
|
||||||
struct_jo = jsonDescStruct2;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
// 没有就正序找到第一个物料、判断上一个是否有货位
|
|
||||||
JSONObject jsonAscBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
|
|
||||||
|
|
||||||
JSONObject jsonAscStruct2 = new JSONObject();
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonAscBox2)) {
|
|
||||||
String out_order_seq2 = jsonAscBox2.getString("out_order_seq");
|
|
||||||
// 上一个货位顺序号
|
|
||||||
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
|
||||||
} else {
|
|
||||||
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
|
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
|
|
||||||
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
|
|
||||||
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonAscStruct2)) {
|
|
||||||
struct_jo = jsonAscStruct2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(struct_jo)) {
|
if (ObjectUtil.isEmpty(struct_jo)) {
|
||||||
throw new BadRequestException("未查询到可用的仓位!");
|
throw new BadRequestException("未找到可用点位!");
|
||||||
}
|
}
|
||||||
return struct_jo;
|
return struct_jo;
|
||||||
}
|
}
|
||||||
@@ -1279,6 +1021,30 @@ public class ProductInServiceImpl implements ProductInService {
|
|||||||
return resultJSONArray;
|
return resultJSONArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void confirmvehicle(JSONObject whereJson) {
|
||||||
|
WQLObject vehicleTab = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
||||||
|
WQLObject disTab = WQLObject.getWQLObject("st_ivt_iostorinvdis");
|
||||||
|
|
||||||
|
String storagevehicle_code = whereJson.getString("storagevehicle_code");
|
||||||
|
|
||||||
|
// 校验载具是否存在
|
||||||
|
JSONObject jsonVehicle = vehicleTab.query("storagevehicle_code = '" + storagevehicle_code + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(jsonVehicle)) throw new BadRequestException("载具不存在");
|
||||||
|
|
||||||
|
// 更新分配明细载具号
|
||||||
|
JSONObject jsonDis = disTab.query("iostorinvdis_id = '" + whereJson.getString("iostorinvdis_id") + "'").uniqueResult(0);
|
||||||
|
// 校验此明细是否已经分配
|
||||||
|
if (ObjectUtil.isNotEmpty(jsonDis.getString("struct_id"))) {
|
||||||
|
throw new BadRequestException("此明细已分配不可组盘!");
|
||||||
|
}
|
||||||
|
jsonDis.put("storagevehicle_id", jsonVehicle.getString("storagevehicle_id"));
|
||||||
|
jsonDis.put("storagevehicle_code", jsonVehicle.getString("storagevehicle_code"));
|
||||||
|
disTab.update(jsonDis);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public JSONObject queryEmpStruct(JSONObject whereJson) {
|
public JSONObject queryEmpStruct(JSONObject whereJson) {
|
||||||
JSONObject struct_jo = new JSONObject();
|
JSONObject struct_jo = new JSONObject();
|
||||||
String sect_id = whereJson.getString("sect_id");
|
String sect_id = whereJson.getString("sect_id");
|
||||||
|
|||||||
@@ -0,0 +1,558 @@
|
|||||||
|
package org.nl.wms.st.in.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.modules.wql.WQL;
|
||||||
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.wms.st.in.service.StorPublicService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PC端出入库新增
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class StorPublicServiceImpl implements StorPublicService {
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
void createStor(JSONObject from) {
|
||||||
|
// 货位库存表
|
||||||
|
WQLObject wql_StructIvt = WQLObject.getWQLObject("ST_IVT_StructIvt");
|
||||||
|
// 查询货位信息
|
||||||
|
JSONObject jo = WQL.getWO("ST_PUB_QUERY_01")
|
||||||
|
.addParam("flag", "1")
|
||||||
|
.addParam("id", from.getString("struct_id"))
|
||||||
|
.process().uniqueResult(0);
|
||||||
|
if (jo == null) {
|
||||||
|
throw new BadRequestException("点位不存在或者未启用:" + from.getString("struct_id"));
|
||||||
|
}
|
||||||
|
// 查询物料信息
|
||||||
|
JSONObject jo_WMSMaterial = WQL.getWO("ST_PUB_QUERY_01")
|
||||||
|
.addParam("flag", "2")
|
||||||
|
.addParam("material_id", from.getString("material_id"))
|
||||||
|
.process()
|
||||||
|
.uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(jo_WMSMaterial)) {
|
||||||
|
throw new BadRequestException("物料不存在或者未启用:" + from.getString("material_id"));
|
||||||
|
}
|
||||||
|
from.put("stockrecord_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||||
|
from.put("struct_code", jo.getString("point_code"));
|
||||||
|
from.put("struct_name", jo.getString("point_name"));
|
||||||
|
from.put("product_area", jo.getString("product_area"));
|
||||||
|
from.put("instorage_time", DateUtil.now());
|
||||||
|
wql_StructIvt.insert(from);
|
||||||
|
// 更新库存变动日志
|
||||||
|
from.put("result_qty", from.getDoubleValue("ivt_qty"));
|
||||||
|
from.put("stor_code", jo.getString("stor_code"));
|
||||||
|
// this.createStructIvtFlow(from);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
void createStructIvtFlow(JSONObject from) {
|
||||||
|
// 仓位库存变动记录表
|
||||||
|
WQLObject wql_StructIvtFlow = WQLObject.getWQLObject("ST_IVT_StructIvtFlow");
|
||||||
|
// 库区物流日表
|
||||||
|
WQLObject wql_IOSectDaily = WQLObject.getWQLObject("ST_IVT_IOStorDaily");
|
||||||
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
|
|
||||||
|
from.put("change_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||||
|
from.put("change_time", DateUtil.now());
|
||||||
|
from.put("change_person_id", currentUserId + "");
|
||||||
|
from.put("change_person_name", nickName);
|
||||||
|
|
||||||
|
String change_type_scode = from.getString("change_type_scode");
|
||||||
|
String bill_code = from.getString("bill_code");
|
||||||
|
|
||||||
|
wql_StructIvtFlow.insert(from);
|
||||||
|
//拆拼盘不汇总到日表,库存变动记录还是要有记录
|
||||||
|
if (bill_code.startsWith("YK") || bill_code.startsWith("CPP")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("22,23,33,21,24,25,34".contains(change_type_scode)) {
|
||||||
|
String sect_date = DateUtil.today();
|
||||||
|
// 出查询更新条件
|
||||||
|
String sql_where = "stor_id = '" + from.getString("stor_id") +
|
||||||
|
"' and sect_date = '" + sect_date +
|
||||||
|
"' and material_id = '" + from.getString("material_id") +
|
||||||
|
"' and pcsn = '" + from.getString("pcsn") +
|
||||||
|
"' and quality_scode = '" + from.getString("quality_scode") + "'";
|
||||||
|
JSONObject jo = wql_IOSectDaily.query(sql_where).uniqueResult(0);
|
||||||
|
if (jo == null) {// 新增
|
||||||
|
String sql_where_before = "stor_id = '" + from.getString("stor_id") +
|
||||||
|
"' and material_id = '" + from.getString("material_id") +
|
||||||
|
"' and pcsn = '" + from.getString("pcsn") +
|
||||||
|
"' and quality_scode = '" + from.getString("quality_scode") + "'";
|
||||||
|
JSONObject jo_before = wql_IOSectDaily.query(sql_where_before, "sect_date desc").uniqueResult(0);
|
||||||
|
if (jo_before == null) {
|
||||||
|
from.put("start_num", "0");
|
||||||
|
} else {
|
||||||
|
from.put("start_num", jo_before.getDoubleValue("end_num"));
|
||||||
|
}
|
||||||
|
from.put("sect_date", sect_date);
|
||||||
|
if ("22,33".contains(change_type_scode)) {
|
||||||
|
from.put("in_num", from.getDoubleValue("change_qty"));
|
||||||
|
from.put("out_num", "0");
|
||||||
|
from.put("end_num", from.getDoubleValue("start_num") + from.getDoubleValue("change_qty"));
|
||||||
|
from.put("more_num", "0");
|
||||||
|
from.put("less_num", "0");
|
||||||
|
} else if ("21,25,34".contains(change_type_scode)) {
|
||||||
|
from.put("in_num", "0");
|
||||||
|
from.put("out_num", from.getDoubleValue("change_qty"));
|
||||||
|
from.put("end_num", from.getDoubleValue("start_num") - from.getDoubleValue("change_qty"));
|
||||||
|
from.put("more_num", "0");
|
||||||
|
from.put("less_num", "0");
|
||||||
|
} else if ("23".contains(change_type_scode)) {
|
||||||
|
from.put("in_num", "0");
|
||||||
|
from.put("out_num", "0");
|
||||||
|
from.put("end_num", from.getDoubleValue("start_num") + from.getDoubleValue("change_qty"));
|
||||||
|
from.put("more_num", from.getDoubleValue("change_qty"));
|
||||||
|
from.put("less_num", "0");
|
||||||
|
} else if ("24".contains(change_type_scode)) {
|
||||||
|
from.put("in_num", "0");
|
||||||
|
from.put("out_num", "0");
|
||||||
|
from.put("end_num", from.getDoubleValue("start_num") - from.getDoubleValue("change_qty"));
|
||||||
|
from.put("more_num", "0");
|
||||||
|
from.put("less_num", from.getDoubleValue("change_qty"));
|
||||||
|
}
|
||||||
|
|
||||||
|
from.put("stordaily_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||||
|
wql_IOSectDaily.insert(from);
|
||||||
|
} else {// 更新
|
||||||
|
HashMap<String, String> map = new HashMap<String, String>();
|
||||||
|
if ("22,33".contains(change_type_scode)) {
|
||||||
|
map.put("in_num", (from.getDoubleValue("change_qty") + jo.getDoubleValue("in_num")) + "");
|
||||||
|
map.put("end_num", (from.getDoubleValue("change_qty") + jo.getDoubleValue("end_num")) + "");
|
||||||
|
} else if ("21,25,34".contains(change_type_scode)) {
|
||||||
|
map.put("out_num", (from.getDoubleValue("change_qty") + jo.getDoubleValue("out_num")) + "");
|
||||||
|
map.put("end_num", (jo.getDoubleValue("end_num") - from.getDoubleValue("change_qty")) + "");
|
||||||
|
} else if ("24".contains(change_type_scode)) {
|
||||||
|
map.put("less_num", (from.getDoubleValue("change_qty") + jo.getDoubleValue("less_num")) + "");
|
||||||
|
map.put("end_num", (jo.getDoubleValue("end_num") - from.getDoubleValue("change_qty")) + "");
|
||||||
|
} else if ("23".contains(change_type_scode)) {
|
||||||
|
map.put("more_num", (from.getDoubleValue("change_qty") + jo.getDoubleValue("more_num")) + "");
|
||||||
|
map.put("end_num", (from.getDoubleValue("change_qty") + jo.getDoubleValue("end_num")) + "");
|
||||||
|
}
|
||||||
|
wql_IOSectDaily.update(map, sql_where);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void IOStor(JSONObject from, String change_type_scode) {
|
||||||
|
// 仓位库存表
|
||||||
|
WQLObject wql = WQLObject.getWQLObject("ST_IVT_StructIvt");
|
||||||
|
String struct_id_In = "";
|
||||||
|
String material_id_In = "";
|
||||||
|
String pcsn_In = "";
|
||||||
|
String storagevehicle_code = from.getString("storagevehicle_code");
|
||||||
|
String quality_scode_In = "";
|
||||||
|
double change_qty = 0;
|
||||||
|
if (ObjectUtil.isEmpty(from)) {
|
||||||
|
throw new BadRequestException("输入from异常,请检查");
|
||||||
|
}
|
||||||
|
if (StrUtil.isBlank(change_type_scode)) {
|
||||||
|
throw new BadRequestException("变动类型不能为空");
|
||||||
|
}
|
||||||
|
from.put("change_type_scode", change_type_scode);
|
||||||
|
struct_id_In = from.getString("struct_id");
|
||||||
|
if (StrUtil.isBlank(struct_id_In)) {
|
||||||
|
throw new BadRequestException("货位不能为空");
|
||||||
|
}
|
||||||
|
material_id_In = from.getString("material_id");
|
||||||
|
if (StrUtil.isBlank(material_id_In)) {
|
||||||
|
throw new BadRequestException("物料不能为空");
|
||||||
|
}
|
||||||
|
pcsn_In = from.getString("pcsn");
|
||||||
|
if (StrUtil.isBlank(pcsn_In)) {
|
||||||
|
throw new BadRequestException("物料批次不能为空");
|
||||||
|
}
|
||||||
|
quality_scode_In = from.getString("quality_scode");
|
||||||
|
if (StrUtil.isBlank(quality_scode_In)) {
|
||||||
|
throw new BadRequestException("品质类型不能为空");
|
||||||
|
}
|
||||||
|
change_qty = from.getDoubleValue("change_qty");
|
||||||
|
if (change_qty <= 0) {
|
||||||
|
throw new BadRequestException("变动数异常,请检查");
|
||||||
|
}
|
||||||
|
/*"struct_id = '" + struct_id_In +
|
||||||
|
"' and material_id = '" + material_id_In +
|
||||||
|
"' and pcsn = '" + pcsn_In +
|
||||||
|
"' and quality_scode = '" + quality_scode_In + "'";*/
|
||||||
|
// 查询条件
|
||||||
|
StringBuffer sql_where = new StringBuffer("struct_id = '");
|
||||||
|
sql_where.append(struct_id_In);
|
||||||
|
sql_where.append("' and material_id = '");
|
||||||
|
sql_where.append(material_id_In);
|
||||||
|
sql_where.append("' and pcsn = '");
|
||||||
|
sql_where.append(pcsn_In);
|
||||||
|
sql_where.append("' and quality_scode = '");
|
||||||
|
sql_where.append(quality_scode_In);
|
||||||
|
sql_where.append("'");
|
||||||
|
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
|
map.put("flag", "1");
|
||||||
|
map.put("struct_id", struct_id_In);
|
||||||
|
map.put("material_id", material_id_In);
|
||||||
|
map.put("pcsn", pcsn_In);
|
||||||
|
map.put("quality_scode", quality_scode_In);
|
||||||
|
if (StrUtil.equals(change_type_scode, "12")) {
|
||||||
|
if (ObjectUtil.isNotEmpty(storagevehicle_code)) map.put("storagevehicle_code",storagevehicle_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取仓位物料信息
|
||||||
|
// JSONObject jo_in = wql.query(sql_where.toString()).uniqueResult(0);
|
||||||
|
JSONObject jo_in = WQL.getWO("QST_IVT_STORPUBLIC").addParamMap(map).process().uniqueResult(0);
|
||||||
|
switch (change_type_scode) {
|
||||||
|
case "11": //11加冻结、减可用:出库分配、移库移出
|
||||||
|
if (jo_in != null) {
|
||||||
|
double ivt_qty = jo_in.getDoubleValue("ivt_qty");
|
||||||
|
double canuse_qty = NumberUtil.sub(jo_in.getDoubleValue("canuse_qty"), change_qty);
|
||||||
|
if (canuse_qty < 0) {
|
||||||
|
throw new BadRequestException("可用数不允许为负数!");
|
||||||
|
}
|
||||||
|
jo_in.put("canuse_qty", canuse_qty);
|
||||||
|
jo_in.put("frozen_qty", jo_in.getDoubleValue("frozen_qty") + change_qty);
|
||||||
|
|
||||||
|
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||||
|
if (ivt_num_now != ivt_qty) {
|
||||||
|
throw new BadRequestException("输入数据异常,请检查");
|
||||||
|
}
|
||||||
|
|
||||||
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'");
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException(struct_id_In + "仓位库存异常,请检查");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "12": //12减冻结、加可用:出库分配取消、移库移出取消
|
||||||
|
if (jo_in != null) {
|
||||||
|
double ivt_qty = jo_in.getDoubleValue("ivt_qty");
|
||||||
|
jo_in.put("canuse_qty", jo_in.getDoubleValue("canuse_qty") + change_qty);
|
||||||
|
jo_in.put("frozen_qty", NumberUtil.sub(jo_in.getDoubleValue("frozen_qty"), change_qty));
|
||||||
|
|
||||||
|
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||||
|
if (ivt_num_now != ivt_qty) {
|
||||||
|
throw new BadRequestException("输入数据异常,请检查");
|
||||||
|
}
|
||||||
|
if (jo_in.getDoubleValue("frozen_qty") < 0) {
|
||||||
|
throw new BadRequestException("冻结数不允许为负数!");
|
||||||
|
}
|
||||||
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'");
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException(struct_id_In + "仓位库存异常,请检查");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "21": //21减冻结、减库存:出库确认、移库移出确认
|
||||||
|
if (jo_in != null) {
|
||||||
|
jo_in.put("ivt_qty", NumberUtil.sub(jo_in.getDoubleValue("ivt_qty"), change_qty));
|
||||||
|
double ivt_qty = jo_in.getDoubleValue("ivt_qty");
|
||||||
|
jo_in.put("frozen_qty", NumberUtil.sub(jo_in.getDoubleValue("frozen_qty"), change_qty));
|
||||||
|
|
||||||
|
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||||
|
if (ivt_num_now != ivt_qty) {
|
||||||
|
throw new BadRequestException("输入数据异常,请检查");
|
||||||
|
}
|
||||||
|
if (jo_in.getDoubleValue("ivt_qty") < 0) {
|
||||||
|
throw new BadRequestException("库存数不允许为负数!");
|
||||||
|
}
|
||||||
|
if (jo_in.getDoubleValue("frozen_qty") < 0) {
|
||||||
|
throw new BadRequestException("冻结数不允许为负数!");
|
||||||
|
}
|
||||||
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'");
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException(struct_id_In + "仓位库存异常,请检查");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "22": //22加冻结、加库存:出库确认取消、移库移出确认取消
|
||||||
|
if (jo_in != null) {
|
||||||
|
jo_in.put("ivt_qty", jo_in.getDoubleValue("ivt_qty") + change_qty);
|
||||||
|
double ivt_qty = jo_in.getDoubleValue("ivt_qty");
|
||||||
|
jo_in.put("frozen_qty", jo_in.getDoubleValue("frozen_qty") + change_qty);
|
||||||
|
|
||||||
|
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||||
|
if (ivt_num_now != ivt_qty) {
|
||||||
|
throw new BadRequestException("输入数据异常,请检查");
|
||||||
|
}
|
||||||
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'");
|
||||||
|
} else {
|
||||||
|
from.put("canuse_qty", "0");
|
||||||
|
from.put("ivt_qty", change_qty);
|
||||||
|
from.put("frozen_qty", change_qty);
|
||||||
|
from.put("warehousing_qty", "0");
|
||||||
|
this.createStor(from);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "23": //23同时加:质检(新)、损益单(溢)、损益单(损取消)
|
||||||
|
if (jo_in != null) {
|
||||||
|
jo_in.put("ivt_qty", jo_in.getDoubleValue("ivt_qty") + change_qty);
|
||||||
|
double ivt_qty = jo_in.getDoubleValue("ivt_qty");
|
||||||
|
jo_in.put("canuse_qty", jo_in.getDoubleValue("canuse_qty") + change_qty);
|
||||||
|
|
||||||
|
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||||
|
if (ivt_num_now != ivt_qty) {
|
||||||
|
throw new BadRequestException("输入数据异常,请检查");
|
||||||
|
}
|
||||||
|
if (jo_in.getDoubleValue("canuse_qty") < 0) {
|
||||||
|
throw new BadRequestException("可用数不允许为负数!");
|
||||||
|
}
|
||||||
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'");
|
||||||
|
} else {
|
||||||
|
from.put("canuse_qty", change_qty);
|
||||||
|
from.put("ivt_qty", change_qty);
|
||||||
|
from.put("frozen_qty", "0");
|
||||||
|
from.put("warehousing_qty", "0");
|
||||||
|
this.createStor(from);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "24": //24同时减:质检(旧)、损益单(溢取消)、损益单(损)
|
||||||
|
case "25": //25同时减:配粉出库确认
|
||||||
|
if (jo_in != null) {
|
||||||
|
jo_in.put("ivt_qty", NumberUtil.sub(jo_in.getDoubleValue("ivt_qty"), change_qty));
|
||||||
|
double ivt_qty = jo_in.getDoubleValue("ivt_qty");
|
||||||
|
jo_in.put("canuse_qty", NumberUtil.sub(jo_in.getDoubleValue("canuse_qty"), change_qty));
|
||||||
|
|
||||||
|
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||||
|
if (ivt_num_now != ivt_qty) {
|
||||||
|
throw new BadRequestException("输入数据异常,请检查");
|
||||||
|
}
|
||||||
|
if (jo_in.getDoubleValue("ivt_qty") < 0) {
|
||||||
|
throw new BadRequestException("库存数不允许为负数!");
|
||||||
|
}
|
||||||
|
if (jo_in.getDoubleValue("canuse_qty") < 0) {
|
||||||
|
throw new BadRequestException("可用数不允许为负数!");
|
||||||
|
}
|
||||||
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'");
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException(struct_id_In + "仓位库存异常,请检查");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "31": //31加待入:入库分配、移库移入
|
||||||
|
if (jo_in != null) {
|
||||||
|
jo_in.put("warehousing_qty", jo_in.getDoubleValue("warehousing_qty") + change_qty);
|
||||||
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'");
|
||||||
|
} else {
|
||||||
|
from.put("canuse_qty", "0");
|
||||||
|
from.put("ivt_qty", "0");
|
||||||
|
from.put("frozen_qty", "0");
|
||||||
|
from.put("warehousing_qty", change_qty);
|
||||||
|
this.createStor(from);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "32": //32减待入:入库分配取消、移库移入取消
|
||||||
|
if (jo_in != null) {
|
||||||
|
jo_in.put("warehousing_qty", NumberUtil.sub(jo_in.getDoubleValue("warehousing_qty"), change_qty));
|
||||||
|
if (jo_in.getDoubleValue("warehousing_qty") < 0) {
|
||||||
|
throw new BadRequestException("待入数不允许为负数!");
|
||||||
|
}
|
||||||
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'");
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException(struct_id_In + "仓位库存异常,请检查");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "33": //33减待入、加库存、加可用:入库确认、移库移入确认
|
||||||
|
if (jo_in != null) {
|
||||||
|
jo_in.put("ivt_qty", jo_in.getDoubleValue("ivt_qty") + change_qty);
|
||||||
|
double ivt_qty = jo_in.getDoubleValue("ivt_qty");
|
||||||
|
jo_in.put("canuse_qty", jo_in.getDoubleValue("canuse_qty") + change_qty);
|
||||||
|
jo_in.put("warehousing_qty", NumberUtil.sub(jo_in.getDoubleValue("warehousing_qty"), change_qty));
|
||||||
|
|
||||||
|
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||||
|
if (ivt_num_now != ivt_qty) {
|
||||||
|
throw new BadRequestException("输入数据异常,请检查");
|
||||||
|
}
|
||||||
|
if (jo_in.getDoubleValue("warehousing_qty") < 0) {
|
||||||
|
throw new BadRequestException("待入数不允许为负数!");
|
||||||
|
}
|
||||||
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'");
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException(struct_id_In + "仓位库存异常,请检查");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "34": //34加待入、减库存、减可用:入库确认取消、移库移入确认取消
|
||||||
|
if (jo_in != null) {
|
||||||
|
jo_in.put("ivt_qty", NumberUtil.sub(jo_in.getDoubleValue("ivt_qty"), change_qty));
|
||||||
|
double ivt_qty = jo_in.getDoubleValue("ivt_qty");
|
||||||
|
jo_in.put("canuse_qty", NumberUtil.sub(jo_in.getDoubleValue("canuse_qty"), change_qty));
|
||||||
|
jo_in.put("warehousing_qty", jo_in.getDoubleValue("warehousing_qty") + change_qty);
|
||||||
|
|
||||||
|
double ivt_num_now = jo_in.getDoubleValue("canuse_qty") + jo_in.getDoubleValue("frozen_qty");
|
||||||
|
if (ivt_num_now != ivt_qty) {
|
||||||
|
throw new BadRequestException("输入数据异常,请检查");
|
||||||
|
}
|
||||||
|
if (jo_in.getDoubleValue("ivt_qty") < 0) {
|
||||||
|
throw new BadRequestException("库存数不允许为负数!");
|
||||||
|
}
|
||||||
|
if (jo_in.getDoubleValue("canuse_qty") < 0) {
|
||||||
|
throw new BadRequestException("可用数不允许为负数!");
|
||||||
|
}
|
||||||
|
wql.update(jo_in, "stockrecord_id='" + jo_in.getString("stockrecord_id") + "'");
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException(struct_id_In + "仓位库存异常,请检查");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new BadRequestException("变动类型不存在:" + change_type_scode);
|
||||||
|
}
|
||||||
|
if (jo_in != null) {
|
||||||
|
if (jo_in.getDoubleValue("ivt_qty") == 0 && jo_in.getDoubleValue("canuse_qty") == 0 && jo_in.getDoubleValue("warehousing_qty") == 0) {
|
||||||
|
wql.delete(sql_where.toString());
|
||||||
|
}
|
||||||
|
// 更新库存变动日志
|
||||||
|
jo_in.put("result_qty", jo_in.getDoubleValue("ivt_qty"));
|
||||||
|
jo_in.put("change_type_scode", change_type_scode);
|
||||||
|
jo_in.put("bill_type_scode", from.getString("bill_type_scode"));
|
||||||
|
jo_in.put("inv_id", from.getString("inv_id"));
|
||||||
|
jo_in.put("bill_code", from.getString("bill_code"));
|
||||||
|
jo_in.put("bill_table", from.getString("bill_table"));
|
||||||
|
jo_in.put("change_qty", from.getString("change_qty"));
|
||||||
|
// 查询货位信息
|
||||||
|
JSONObject jo = WQL.getWO("ST_PUB_QUERY_01")
|
||||||
|
.addParam("flag", "1")
|
||||||
|
.addParam("id", from.getString("struct_id"))
|
||||||
|
.process().uniqueResult(0);
|
||||||
|
if (jo == null) {
|
||||||
|
throw new BadRequestException("仓位不存在或者未启用:" + from.getString("struct_id"));
|
||||||
|
}
|
||||||
|
jo_in.put("stor_code", jo.getString("stor_code"));
|
||||||
|
jo_in.put("stor_id", jo.getString("stor_id"));
|
||||||
|
jo_in.put("stor_name", jo.getString("stor_name"));
|
||||||
|
// this.createStructIvtFlow(jo_in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateStructAndPoint(JSONObject from) {
|
||||||
|
//货位表
|
||||||
|
WQLObject wo_Struct = WQLObject.getWQLObject("ST_IVT_StructAttr");
|
||||||
|
//点位表
|
||||||
|
WQLObject wo_Point = WQLObject.getWQLObject("SCH_BASE_Point");
|
||||||
|
//载具表
|
||||||
|
WQLObject wo_Storage = WQLObject.getWQLObject("MD_PB_StorageVehicleInfo");
|
||||||
|
String struct_id = from.getString("struct_id");
|
||||||
|
String point_code = from.getString("point_code");
|
||||||
|
//锁定类型
|
||||||
|
String lock_type = from.getString("lock_type");
|
||||||
|
//载具编码
|
||||||
|
String storagevehicle_code = from.getString("storagevehicle_code");
|
||||||
|
if (StrUtil.isEmpty(struct_id) && StrUtil.isEmpty(point_code)) {
|
||||||
|
throw new BadRequestException("点位仓位更新出入参数异常!");
|
||||||
|
}
|
||||||
|
if (StrUtil.isEmpty(lock_type)) {
|
||||||
|
throw new BadRequestException("点位仓位更新出入参数异常!");
|
||||||
|
}
|
||||||
|
JSONObject jo = WQL.getWO("ST_PUB_QUERY_01")
|
||||||
|
.addParam("flag", "3")
|
||||||
|
.addParam("id", struct_id)
|
||||||
|
.addParam("point_code", point_code)
|
||||||
|
.process().uniqueResult(0);
|
||||||
|
if (jo == null) {
|
||||||
|
throw new BadRequestException("点位仓位更新未查询到符合条件的点位仓位!");
|
||||||
|
}
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
if (lock_type.equals("1")) {//解锁
|
||||||
|
map.put("lock_type", lock_type);
|
||||||
|
map.put("task_code", "");
|
||||||
|
map.put("inv_type", "");
|
||||||
|
map.put("inv_id", "");
|
||||||
|
map.put("inv_code", "");
|
||||||
|
map.put("point_status", "1");
|
||||||
|
map.put("storagevehicle_code", "");
|
||||||
|
map.put("vehicle_code", "");
|
||||||
|
if (from.containsKey("is_free") && !from.getString("is_free").equals("1") && StrUtil.isNotEmpty(storagevehicle_code)) {
|
||||||
|
map.put("storagevehicle_code", storagevehicle_code);
|
||||||
|
map.put("storagevehicle_qty", "1");
|
||||||
|
map.put("vehicle_code", storagevehicle_code);
|
||||||
|
map.put("point_status", "01");
|
||||||
|
}
|
||||||
|
wo_Struct.update(map, "struct_id = '" + jo.getString("struct_id") + "'");
|
||||||
|
wo_Point.update(map, "point_id = '" + jo.getString("point_id") + "'");
|
||||||
|
} else {//锁定
|
||||||
|
map.put("lock_type", lock_type);
|
||||||
|
map.put("taskdtl_type", from.getString("task_type"));
|
||||||
|
map.put("taskdtl_id", from.getString("task_id"));
|
||||||
|
map.put("task_code", from.getString("task_code"));
|
||||||
|
map.put("inv_type", from.getString("inv_type"));
|
||||||
|
map.put("inv_id", from.getString("inv_id"));
|
||||||
|
map.put("inv_code", from.getString("inv_code"));
|
||||||
|
if (StrUtil.isNotEmpty(storagevehicle_code)) {
|
||||||
|
map.put("storagevehicle_code", storagevehicle_code);
|
||||||
|
map.put("storagevehicle_qty", "1");
|
||||||
|
map.put("vehicle_code", storagevehicle_code);
|
||||||
|
map.put("point_status", "01");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wo_Struct.update(map, "struct_id = '" + jo.getString("struct_id") + "'");
|
||||||
|
wo_Point.update(map, "point_id = '" + jo.getString("point_id") + "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateStructAndPoint2(JSONObject from) {
|
||||||
|
//货位表
|
||||||
|
WQLObject wo_Struct = WQLObject.getWQLObject("ST_IVT_StructAttr");
|
||||||
|
//点位表
|
||||||
|
WQLObject wo_Point = WQLObject.getWQLObject("SCH_BASE_Point");
|
||||||
|
//载具表
|
||||||
|
WQLObject wo_Storage = WQLObject.getWQLObject("MD_PB_StorageVehicleInfo");
|
||||||
|
String struct_id = from.getString("struct_id");
|
||||||
|
String point_code = from.getString("point_code");
|
||||||
|
//锁定类型
|
||||||
|
String lock_type = from.getString("lock_type");
|
||||||
|
//载具编码
|
||||||
|
String storagevehicle_code = from.getString("storagevehicle_code");
|
||||||
|
if (StrUtil.isEmpty(struct_id) && StrUtil.isEmpty(point_code)) {
|
||||||
|
throw new BadRequestException("点位仓位更新出入参数异常!");
|
||||||
|
}
|
||||||
|
if (StrUtil.isEmpty(lock_type)) {
|
||||||
|
throw new BadRequestException("点位仓位更新出入参数异常!");
|
||||||
|
}
|
||||||
|
JSONObject jo = WQL.getWO("ST_PUB_QUERY_01")
|
||||||
|
.addParam("flag", "3")
|
||||||
|
.addParam("id", struct_id)
|
||||||
|
.addParam("point_code", point_code)
|
||||||
|
.process().uniqueResult(0);
|
||||||
|
if (jo == null) {
|
||||||
|
throw new BadRequestException("点位仓位更新未查询到符合条件的点位仓位!");
|
||||||
|
}
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
if (lock_type.equals("1")) {//解锁
|
||||||
|
map.put("lock_type", lock_type);
|
||||||
|
map.put("task_code", "");
|
||||||
|
map.put("inv_type", "");
|
||||||
|
map.put("inv_id", "");
|
||||||
|
map.put("inv_code", "");
|
||||||
|
map.put("point_status", "1");
|
||||||
|
wo_Struct.update(map, "struct_id = '" + jo.getString("struct_id") + "'");
|
||||||
|
wo_Point.update(map, "point_id = '" + jo.getString("point_id") + "'");
|
||||||
|
} else {//锁定
|
||||||
|
map.put("lock_type", lock_type);
|
||||||
|
map.put("taskdtl_type", from.getString("task_type"));
|
||||||
|
map.put("taskdtl_id", from.getString("task_id"));
|
||||||
|
map.put("task_code", from.getString("task_code"));
|
||||||
|
map.put("inv_type", from.getString("inv_type"));
|
||||||
|
map.put("inv_id", from.getString("inv_id"));
|
||||||
|
map.put("inv_code", from.getString("inv_code"));
|
||||||
|
if (StrUtil.isNotEmpty(storagevehicle_code)) {
|
||||||
|
map.put("storagevehicle_code", storagevehicle_code);
|
||||||
|
map.put("storagevehicle_qty", "1");
|
||||||
|
map.put("vehicle_code", storagevehicle_code);
|
||||||
|
map.put("point_status", "01");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wo_Struct.update(map, "struct_id = '" + jo.getString("struct_id") + "'");
|
||||||
|
wo_Point.update(map, "point_id = '" + jo.getString("point_id") + "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
[交易说明]
|
||||||
|
交易名: 成品入库分配逻辑
|
||||||
|
所属模块:
|
||||||
|
功能简述:
|
||||||
|
版权所有:
|
||||||
|
表引用:
|
||||||
|
版本经历:
|
||||||
|
|
||||||
|
[数据库]
|
||||||
|
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||||
|
|
||||||
|
[IO定义]
|
||||||
|
#################################################
|
||||||
|
## 表字段对应输入参数
|
||||||
|
#################################################
|
||||||
|
输入.flag TYPEAS s_string
|
||||||
|
输入.region_code TYPEAS s_string
|
||||||
|
输入.product_area TYPEAS s_string
|
||||||
|
|
||||||
|
|
||||||
|
[临时表]
|
||||||
|
--这边列出来的临时表就会在运行期动态创建
|
||||||
|
|
||||||
|
[临时变量]
|
||||||
|
--所有中间过程变量均可在此处定义
|
||||||
|
|
||||||
|
[业务过程]
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 1、输入输出检查 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 2、主过程前处理 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 3、业务主过程 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
IF 输入.flag = "1"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
*,
|
||||||
|
region.region_name
|
||||||
|
FROM
|
||||||
|
sch_base_point point
|
||||||
|
LEFT JOIN sch_base_region region ON point.region_code = region.region_code
|
||||||
|
WHERE
|
||||||
|
point.lock_type = '1'
|
||||||
|
AND point.point_status = '1'
|
||||||
|
AND point.is_delete = '0'
|
||||||
|
AND point.is_used = '1'
|
||||||
|
AND point.layer_num = '1'
|
||||||
|
AND IFNULL(point.control_point,'') <> ''
|
||||||
|
|
||||||
|
OPTION 输入.product_area <> ""
|
||||||
|
point.product_area = 输入.product_area
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.region_code <> ""
|
||||||
|
point.region_code = 输入.region_code
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
order by point.point_code ASC
|
||||||
|
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "2"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
*,
|
||||||
|
region.region_name
|
||||||
|
FROM
|
||||||
|
sch_base_point point
|
||||||
|
LEFT JOIN sch_base_region region ON point.region_code = region.region_code
|
||||||
|
WHERE
|
||||||
|
point.lock_type = '1'
|
||||||
|
AND point.point_status = '1'
|
||||||
|
AND point.is_delete = '0'
|
||||||
|
AND point.is_used = '1'
|
||||||
|
|
||||||
|
OPTION 输入.product_area <> ""
|
||||||
|
point.product_area = 输入.product_area
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.region_code <> ""
|
||||||
|
point.region_code = 输入.region_code
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
order by point.layer_num ASC,point.point_code ASC
|
||||||
|
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "3"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
*,
|
||||||
|
region_name
|
||||||
|
FROM
|
||||||
|
sch_base_point point
|
||||||
|
LEFT JOIN sch_base_region region ON point.region_code = region.region_code
|
||||||
|
WHERE
|
||||||
|
point.lock_type = '1'
|
||||||
|
AND point.point_status = '1'
|
||||||
|
AND point.is_delete = '0'
|
||||||
|
AND point.is_used = '1'
|
||||||
|
|
||||||
|
OPTION 输入.product_area <> ""
|
||||||
|
point.product_area = 输入.product_area
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.region_code <> ""
|
||||||
|
point.region_code = 输入.region_code
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
order by point.layer_num DESC,point.point_code ASC
|
||||||
|
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
[交易说明]
|
||||||
|
交易名:
|
||||||
|
所属模块:
|
||||||
|
功能简述:
|
||||||
|
版权所有:
|
||||||
|
表引用:
|
||||||
|
版本经历:
|
||||||
|
|
||||||
|
[数据库]
|
||||||
|
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||||
|
|
||||||
|
[IO定义]
|
||||||
|
#################################################
|
||||||
|
## 表字段对应输入参数
|
||||||
|
#################################################
|
||||||
|
输入.flag TYPEAS s_string
|
||||||
|
输入.struct_id TYPEAS s_string
|
||||||
|
输入.material_id TYPEAS s_string
|
||||||
|
输入.pcsn TYPEAS s_string
|
||||||
|
输入.quality_scode TYPEAS s_string
|
||||||
|
输入.storagevehicle_code TYPEAS s_string
|
||||||
|
|
||||||
|
|
||||||
|
[临时表]
|
||||||
|
--这边列出来的临时表就会在运行期动态创建
|
||||||
|
|
||||||
|
[临时变量]
|
||||||
|
--所有中间过程变量均可在此处定义
|
||||||
|
|
||||||
|
[业务过程]
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 1、输入输出检查 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 2、主过程前处理 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 3、业务主过程 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
IF 输入.flag = "1"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
ivt.*
|
||||||
|
FROM
|
||||||
|
st_ivt_structivt ivt
|
||||||
|
LEFT JOIN sch_base_point point ON point.point_id = ivt.struct_id
|
||||||
|
WHERE
|
||||||
|
1=1
|
||||||
|
|
||||||
|
OPTION 输入.struct_id <> ""
|
||||||
|
ivt.struct_id = 输入.struct_id
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.material_id <> ""
|
||||||
|
ivt.material_id = 输入.material_id
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.pcsn <> ""
|
||||||
|
ivt.pcsn = 输入.pcsn
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.quality_scode <> ""
|
||||||
|
ivt.quality_scode = 输入.quality_scode
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.storagevehicle_code <> ""
|
||||||
|
point.vehicle_code = 输入.storagevehicle_code
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
[交易说明]
|
||||||
|
交易名: 物料更新接口
|
||||||
|
所属模块:
|
||||||
|
功能简述:
|
||||||
|
版权所有:
|
||||||
|
表引用:
|
||||||
|
版本经历:
|
||||||
|
|
||||||
|
[数据库]
|
||||||
|
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||||
|
|
||||||
|
[IO定义]
|
||||||
|
#################################################
|
||||||
|
## 表字段对应输入参数
|
||||||
|
#################################################
|
||||||
|
//sql类型
|
||||||
|
输入.flag TYPEAS s_string
|
||||||
|
//
|
||||||
|
输入.id TYPEAS s_string
|
||||||
|
//
|
||||||
|
输入.material_id TYPEAS s_string
|
||||||
|
//
|
||||||
|
输入.point_code TYPEAS s_string
|
||||||
|
//
|
||||||
|
输入.ids TYPEAS f_string
|
||||||
|
[临时表]
|
||||||
|
--这边列出来的临时表就会在运行期动态创建
|
||||||
|
|
||||||
|
[临时变量]
|
||||||
|
--所有中间过程变量均可在此处定义
|
||||||
|
|
||||||
|
[业务过程]
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 1、输入输出检查 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 2、主过程前处理 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 3、业务主过程 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
IF 输入.flag = "1"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
struct.*
|
||||||
|
FROM
|
||||||
|
sch_base_point struct
|
||||||
|
WHERE
|
||||||
|
struct.is_delete = '0'
|
||||||
|
AND struct.is_used = '1'
|
||||||
|
|
||||||
|
OPTION 输入.id <> ""
|
||||||
|
struct.point_id = 输入.id
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "2"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
mater.material_id
|
||||||
|
FROM
|
||||||
|
md_me_materialbase mater
|
||||||
|
WHERE
|
||||||
|
mater.is_delete = '0'
|
||||||
|
AND mater.is_used = '1'
|
||||||
|
OPTION 输入.material_id <> ""
|
||||||
|
mater.material_id = 输入.material_id
|
||||||
|
ENDOPTION
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "3"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
struct.struct_id,
|
||||||
|
struct.struct_code,
|
||||||
|
point.point_code,
|
||||||
|
point.point_id,
|
||||||
|
struct.storagevehicle_code
|
||||||
|
FROM
|
||||||
|
SCH_BASE_Point point
|
||||||
|
left join ST_IVT_StructAttr struct on point.source_id=struct.struct_id
|
||||||
|
WHERE 1=1
|
||||||
|
OPTION 输入.id <> ""
|
||||||
|
struct.struct_id = 输入.id
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.point_code <> ""
|
||||||
|
point.point_code = 输入.point_code
|
||||||
|
ENDOPTION
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "4"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
max(value) AS CODE,
|
||||||
|
max(label) AS NAME
|
||||||
|
FROM
|
||||||
|
sys_dict
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
|
AND CODE LIKE '%INV_TYPE%'
|
||||||
|
|
||||||
|
group by value
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
205
mes/qd/src/views/wms/pub/StructDialog.vue
Normal file
205
mes/qd/src/views/wms/pub/StructDialog.vue
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
title="货位选择"
|
||||||
|
append-to-body
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
destroy-on-close
|
||||||
|
width="1000px"
|
||||||
|
@close="close"
|
||||||
|
@open="open"
|
||||||
|
>
|
||||||
|
<!-- 搜索 -->
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-cascader
|
||||||
|
v-model="query.sect"
|
||||||
|
placeholder="所属库区"
|
||||||
|
:options="sects"
|
||||||
|
:props="{ checkStrictly: true }"
|
||||||
|
clearable
|
||||||
|
@change="sectQueryChange"
|
||||||
|
/>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-input
|
||||||
|
v-model="query.point_code"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
size="mini"
|
||||||
|
placeholder="输入点位编码、名称"
|
||||||
|
prefix-icon="el-icon-search"
|
||||||
|
class="filter-item"
|
||||||
|
/> </el-col>
|
||||||
|
|
||||||
|
<el-col :span="6">
|
||||||
|
<rrOperation />
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<!--表格渲染-->
|
||||||
|
<el-table
|
||||||
|
ref="table"
|
||||||
|
v-loading="crud.loading"
|
||||||
|
:data="crud.data"
|
||||||
|
style="width: 100%;"
|
||||||
|
border
|
||||||
|
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||||
|
@select="handleSelectionChange"
|
||||||
|
@select-all="onSelectAll"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
|
<el-table-column prop="point_code" label="点位编码" />
|
||||||
|
<el-table-column prop="point_name" label="点位名称" />
|
||||||
|
<el-table-column prop="region_name" label="区域名称" />
|
||||||
|
<el-table-column prop="product_area" label="生产区域" />
|
||||||
|
</el-table>
|
||||||
|
<!--分页组件-->
|
||||||
|
<pagination />
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="submit">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import CRUD, { header, presenter } from '@crud/crud'
|
||||||
|
import rrOperation from '@crud/RR.operation'
|
||||||
|
import pagination from '@crud/Pagination'
|
||||||
|
import crudRegion from '@/api/wms/sch/region'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'StructDialog',
|
||||||
|
components: { rrOperation, pagination },
|
||||||
|
cruds() {
|
||||||
|
return CRUD({
|
||||||
|
title: '点位',
|
||||||
|
optShow: {},
|
||||||
|
url: 'api/region/getPointQuery',
|
||||||
|
idField: 'region_code',
|
||||||
|
sort: 'region_code,desc',
|
||||||
|
query: { search: '', is_lock: '1', lock_type: '', sect_id: '', stor_id: '' },
|
||||||
|
crudMethod: { ...crudRegion }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
mixins: [presenter(), header()],
|
||||||
|
props: {
|
||||||
|
dialogShow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
sectProp: {
|
||||||
|
type: Object
|
||||||
|
},
|
||||||
|
storId: {
|
||||||
|
type: String,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
sects: [],
|
||||||
|
classes: [],
|
||||||
|
dialogVisible: false,
|
||||||
|
sect: {},
|
||||||
|
checkrow: {},
|
||||||
|
rows: [],
|
||||||
|
dialogDis: true,
|
||||||
|
lock: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
dialogShow: {
|
||||||
|
handler(newValue, oldValue) {
|
||||||
|
this.dialogVisible = newValue
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sectProp: {
|
||||||
|
handler(newValue, oldValue) {
|
||||||
|
debugger
|
||||||
|
this.sect = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* 接受父组件传值
|
||||||
|
* @param msg
|
||||||
|
*/
|
||||||
|
getMsg(msg) {
|
||||||
|
this.dialogDis = msg
|
||||||
|
this.lock = '1'
|
||||||
|
},
|
||||||
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
|
this.query.lock_type = this.lock
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
open() {
|
||||||
|
crudRegion.getRegionSelect({ 'stor_id': this.storId }).then(res => {
|
||||||
|
this.sects = res.content
|
||||||
|
})
|
||||||
|
if (this.sect) {
|
||||||
|
this.query.sect = this.sect
|
||||||
|
if (this.sect.length === 1) {
|
||||||
|
this.query.stor_id = this.sect[0]
|
||||||
|
this.query.stor_id = this.storId
|
||||||
|
}
|
||||||
|
if (this.sect.length === 0) {
|
||||||
|
this.query.sect_id = ''
|
||||||
|
this.query.stor_id = ''
|
||||||
|
}
|
||||||
|
if (this.sect.length === 2) {
|
||||||
|
this.query.stor_id = this.sect[0]
|
||||||
|
this.query.sect_id = this.sect[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.query.is_lock = '1'
|
||||||
|
this.query.lock_type = this.lock
|
||||||
|
this.query.is_used = '1'
|
||||||
|
debugger
|
||||||
|
this.query.stor_id = this.storId
|
||||||
|
this.crud.toQuery()
|
||||||
|
},
|
||||||
|
handleSelectionChange(val, row) {
|
||||||
|
if (val.length > 1) {
|
||||||
|
this.$refs.table.clearSelection()
|
||||||
|
this.$refs.table.toggleRowSelection(val.pop())
|
||||||
|
} else {
|
||||||
|
this.checkrow = row
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sectQueryChange(val) {
|
||||||
|
if (val.length === 1) {
|
||||||
|
this.crud.query.stor_id = val[0]
|
||||||
|
this.crud.query.sect_id = ''
|
||||||
|
}
|
||||||
|
if (val.length === 0) {
|
||||||
|
this.crud.query.sect_id = ''
|
||||||
|
this.crud.query.stor_id = ''
|
||||||
|
}
|
||||||
|
if (val.length === 2) {
|
||||||
|
this.crud.query.stor_id = val[0]
|
||||||
|
this.crud.query.sect_id = val[1]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onSelectAll() {
|
||||||
|
this.$refs.table.clearSelection()
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.crud.resetQuery()
|
||||||
|
this.query.sect = null
|
||||||
|
this.$emit('update:dialogShow', false)
|
||||||
|
},
|
||||||
|
submit() {
|
||||||
|
this.rows = this.$refs.table.selection
|
||||||
|
if (this.rows.length <= 0) {
|
||||||
|
this.$message('请先勾选仓位')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$emit('update:dialogShow', false)
|
||||||
|
this.$emit('tableChanged', this.checkrow)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
<span class="crud-opts-right2">
|
<span class="crud-opts-right2">
|
||||||
<!--左侧插槽-->
|
<!--左侧插槽-->
|
||||||
<slot name="left"/>
|
<slot name="left"/>
|
||||||
<!-- <el-button
|
<el-button
|
||||||
slot="left"
|
slot="left"
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
@click="confirmvehicle()"
|
@click="confirmvehicle()"
|
||||||
>
|
>
|
||||||
组盘确认
|
组盘确认
|
||||||
</el-button>-->
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
slot="left"
|
slot="left"
|
||||||
:loading="divBtn"
|
:loading="divBtn"
|
||||||
@@ -152,6 +152,7 @@
|
|||||||
max-height="300"
|
max-height="300"
|
||||||
border
|
border
|
||||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||||
|
@row-click="clcikRowDis"
|
||||||
>
|
>
|
||||||
<el-table-column show-overflow-tooltip type="index" label="序号" align="center" />
|
<el-table-column show-overflow-tooltip type="index" label="序号" align="center" />
|
||||||
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码" align="center" />
|
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码" align="center" />
|
||||||
@@ -175,22 +176,20 @@
|
|||||||
</el-table>
|
</el-table>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!-- <StructDiv ref="child" :stor-id="storId" :dialog-show.sync="structShow" :sect-prop="sectProp"-->
|
<StructDiv ref="child" :stor-id="storId" :dialog-show.sync="structShow" :sect-prop="sectProp" @tableChanged="tableChanged"/>
|
||||||
<!-- @tableChanged="tableChanged"/>-->
|
|
||||||
|
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import CRUD, { crud } from '@crud/crud'
|
import CRUD, { crud } from '@crud/crud'
|
||||||
// import StructDiv from '@/views/wms/pub/StructDialog'
|
import StructDiv from '@/views/wms/pub/StructDialog'
|
||||||
import crudProductIn from '@/views/wms/st/productIn/productin'
|
import crudProductIn from '@/views/wms/st/productIn/productin'
|
||||||
import crudPoint from '@/api/wms/sch/point'
|
import crudPoint from '@/api/wms/sch/point'
|
||||||
import crudRegion from '@/api/wms/sch/region'
|
import crudRegion from '@/api/wms/sch/region'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DivDialog',
|
name: 'DivDialog',
|
||||||
components: { },
|
components: { StructDiv },
|
||||||
mixins: [crud()],
|
mixins: [crud()],
|
||||||
dicts: ['IO_BILL_STATUS'],
|
dicts: ['IO_BILL_STATUS'],
|
||||||
props: {
|
props: {
|
||||||
@@ -229,12 +228,13 @@ export default {
|
|||||||
bucketShow: false,
|
bucketShow: false,
|
||||||
sects: [],
|
sects: [],
|
||||||
sect_val: null,
|
sect_val: null,
|
||||||
|
dis_row: null,
|
||||||
form: {
|
form: {
|
||||||
dtl_row: null,
|
dtl_row: null,
|
||||||
bucketunique: '',
|
|
||||||
storage_qty: '',
|
storage_qty: '',
|
||||||
|
sect_id: '',
|
||||||
|
stor_id: '',
|
||||||
point_code: null,
|
point_code: null,
|
||||||
storagevehicle_code: '',
|
|
||||||
checked: true,
|
checked: true,
|
||||||
tableMater: []
|
tableMater: []
|
||||||
},
|
},
|
||||||
@@ -282,6 +282,9 @@ export default {
|
|||||||
this.form.tableMater = res
|
this.form.tableMater = res
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
clcikRowDis(row, column, event) {
|
||||||
|
this.dis_row = row
|
||||||
|
},
|
||||||
vehicleCheck() {
|
vehicleCheck() {
|
||||||
if (!this.form.dtl_row) {
|
if (!this.form.dtl_row) {
|
||||||
this.crud.notify('请选择一条入库明细', CRUD.NOTIFICATION_TYPE.INFO)
|
this.crud.notify('请选择一条入库明细', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
@@ -349,22 +352,15 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
confirmvehicle() {
|
confirmvehicle() {
|
||||||
if (this.form.tableMater.length <= 0) {
|
if (this.dis_row === null) {
|
||||||
this.crud.notify('至少添加一条载具明细', CRUD.NOTIFICATION_TYPE.INFO)
|
this.crud.notify('请先选择一条分配明细!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const carrier_no = this.form.tableMater[0].storagevehicle_code
|
if (this.dis_row.storagevehicle_code === '') {
|
||||||
const flag = this.form.tableMater.every(mater => mater.storagevehicle_code === carrier_no)
|
this.crud.notify('载具号不能为空', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
if (!flag) {
|
|
||||||
this.crud.notify('请选择唯一载具进行组盘!', CRUD.NOTIFICATION_TYPE.INFO)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const flag2 = this.form.tableMater.some(mater => mater.point_code !== this.form.point_code && mater.point_code)
|
crudProductIn.confirmvehicle(this.dis_row).then(res => {
|
||||||
if (flag2) {
|
|
||||||
this.crud.notify('请选择相同入库点!', CRUD.NOTIFICATION_TYPE.INFO)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
crudProductIn.confirmvehicle(this.form).then(res => {
|
|
||||||
crudProductIn.getIODtl({ 'bill_code': this.form.dtl_row.bill_code }).then(res => {
|
crudProductIn.getIODtl({ 'bill_code': this.form.dtl_row.bill_code }).then(res => {
|
||||||
this.openParam = res
|
this.openParam = res
|
||||||
})
|
})
|
||||||
@@ -411,14 +407,15 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
tableChanged(row) {
|
tableChanged(row) {
|
||||||
|
this.form.sect_id = this.sect_id
|
||||||
|
this.form.stor_id = this.stor_id
|
||||||
// 新增一行物料时,给行进行赋值
|
// 新增一行物料时,给行进行赋值
|
||||||
for (let i = 0; i < this.form.tableMater.length; i++) {
|
for (let i = 0; i < this.form.tableMater.length; i++) {
|
||||||
this.form.tableMater[i].struct_code = row.struct_code
|
this.form.tableMater[i].struct_id = row.point_id
|
||||||
this.form.tableMater[i].sect_id = row.sect_id
|
this.form.tableMater[i].struct_code = row.point_code
|
||||||
this.form.tableMater[i].struct_id = row.struct_id
|
this.form.tableMater[i].struct_name = row.point_name
|
||||||
this.form.tableMater[i].struct_name = row.struct_name
|
this.form.tableMater[i].region_code = row.region_code
|
||||||
this.form.tableMater[i].sect_code = row.sect_code
|
this.form.tableMater[i].region_name = row.region_name
|
||||||
this.form.tableMater[i].sect_name = row.sect_name
|
|
||||||
this.form.tableMater.splice(i, 1, this.form.tableMater[i]) // 通过splice 替换数据 触发视图更新
|
this.form.tableMater.splice(i, 1, this.form.tableMater[i]) // 通过splice 替换数据 触发视图更新
|
||||||
}
|
}
|
||||||
crudProductIn.divStruct(this.form).then(res => {
|
crudProductIn.divStruct(this.form).then(res => {
|
||||||
@@ -429,7 +426,6 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
bucketChange(row) {
|
bucketChange(row) {
|
||||||
debugger
|
|
||||||
this.bucketObj = row
|
this.bucketObj = row
|
||||||
this.form.bucketunique = row.bucketunique
|
this.form.bucketunique = row.bucketunique
|
||||||
this.form.storage_qty = row.storage_qty
|
this.form.storage_qty = row.storage_qty
|
||||||
@@ -455,8 +451,8 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
divStruct() {
|
divStruct() {
|
||||||
if (this.form.tableMater.length === 0) {
|
if (this.dis_row === null) {
|
||||||
this.crud.notify('请先选择一条明细!', CRUD.NOTIFICATION_TYPE.INFO)
|
this.crud.notify('请先选择一条分配明细!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 如果勾选了,直接跳后台
|
// 如果勾选了,直接跳后台
|
||||||
|
|||||||
Reference in New Issue
Block a user