出入窑缓存区

This commit is contained in:
lyd
2022-11-01 20:06:33 +08:00
parent 7acc2d0fb6
commit a40ea20ce8
10 changed files with 1026 additions and 3 deletions

View File

@@ -70,6 +70,8 @@ public class ProducetaskServiceImpl implements ProducetaskService {
String cust_id = MapUtil.getStr(whereJson, "cust_id");
String workprocedure_id = MapUtil.getStr(whereJson, "workprocedure_id");
String producetask_status = MapUtil.getStr(whereJson, "producetask_status");
String material_name = MapUtil.getStr(whereJson, "material_name");
String device_name = MapUtil.getStr(whereJson, "device_name");
JSONObject map = new JSONObject();
map.put("flag", "1");
map.put("material_id", material_id);
@@ -78,6 +80,12 @@ public class ProducetaskServiceImpl implements ProducetaskService {
map.put("cust_id", cust_id);
map.put("workprocedure_id", workprocedure_id);
map.put("producetask_status", producetask_status);
if (ObjectUtil.isNotEmpty(material_name)) {
map.put("material_name", "%" + material_name + "%");
}
if (ObjectUtil.isNotEmpty(device_name)) {
map.put("device_name", "%" + device_name + "%");
}
if (ObjectUtil.isNotEmpty(search)) {
map.put("search", "%" + search + "%");
}

View File

@@ -19,9 +19,11 @@
输入.device_id TYPEAS s_string
输入.produceline_id TYPEAS s_string
输入.cust_id TYPEAS s_string
输入.workprocedure_id TYPEAS s_string
输入.workprocedure_id TYPEAS s_string
输入.producetask_id TYPEAS s_string
输入.producetask_status TYPEAS s_string
输入.producetask_status TYPEAS s_string
输入.material_name TYPEAS s_string
输入.device_name TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
@@ -52,7 +54,7 @@
device.workprocedure_id,
device.device_name,
material.material_name,
material.material_code,
produceline.produceline_name
FROM
PDM_MG_produceTask task
@@ -77,6 +79,12 @@
OPTION 输入.produceline_id <> ""
(task.produceline_id = 输入.produceline_id)
ENDOPTION
OPTION 输入.material_name <> ""
(material.material_name like 输入.material_name)
ENDOPTION
OPTION 输入.device_name <> ""
(device.device_name like 输入.device_name)
ENDOPTION
OPTION 输入.producetask_status <> ""
(task.producetask_status = 输入.producetask_status)
ENDOPTION

View File

@@ -0,0 +1,47 @@
package org.nl.wms.st.basedata.rest;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.annotation.Log;
import org.nl.wms.st.basedata.service.InKilnService;
import org.nl.wms.st.basedata.service.dto.StructattrDto;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author: lyd
* @description: 入窑缓存库
* @Date: 2022/11/1
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "入窑缓存库")
@RequestMapping("/api/inkilncache")
@Slf4j
public class KilnController {
private final InKilnService inKilnService;
@GetMapping
@Log("查询出/入窑缓存库仓位")
@ApiOperation("查询出/入窑缓存库仓位")
public ResponseEntity<Object> inKilnCacheQuery(@RequestParam Map whereJson, Pageable page){
return new ResponseEntity<>(inKilnService.kilnCacheQuery(whereJson,page), HttpStatus.OK);
}
@PostMapping
@Log("修改出/入窑缓存库仓位")
@ApiOperation("修改出/入窑缓存库仓位")
public ResponseEntity<Object> update(@RequestBody JSONObject dto){
inKilnService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
}

View File

@@ -0,0 +1,27 @@
package org.nl.wms.st.basedata.service;
import com.alibaba.fastjson.JSONObject;
import org.springframework.data.domain.Pageable;
import java.util.Map;
/**
* @author: lyd
* @description: 入窑缓存库
* @Date: 2022/11/1
*/
public interface InKilnService {
/**
*
* @param whereJson
* @param page
* @return
*/
Map<String,Object> kilnCacheQuery(Map whereJson, Pageable page);
/**
* 修改入窑库存
* @param dto
*/
void update(JSONObject dto);
}

View File

@@ -0,0 +1,136 @@
package org.nl.wms.st.basedata.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import org.nl.utils.SecurityUtils;
import org.nl.wms.st.basedata.service.InKilnService;
import org.nl.wql.WQL;
import org.nl.wql.core.bean.WQLObject;
import org.nl.wql.util.WqlUtil;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @author: lyd
* @description: 出/入窑缓存库
* @Date: 2022/11/1
*/
@Service
public class KilnServiceImpl implements InKilnService {
@Override
public Map<String, Object> kilnCacheQuery(Map whereJson, Pageable page) {
JSONObject map = new JSONObject();
map.put("flag", "1");
if (ObjectUtil.isNotEmpty(whereJson.get("point_code")))
map.put("point_code", "%" + whereJson.get("point_code") + "%");
map.put("point_status", whereJson.get("point_status"));
map.put("lock_type", whereJson.get("lock_type"));
map.put("is_used", whereJson.get("is_used"));
map.put("area_type", whereJson.get("area_type"));
JSONObject json = WQL.getWO("SCH_Base_Kiln01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "point.point_code");
return json;
}
@Override
public void update(JSONObject jsonObject) {
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
String stockrecordId = jsonObject.getString("stockrecord_id");
String material_id = jsonObject.getString("material_id");
String vehicle_code = jsonObject.getString("vehicle_code");
String point_status = jsonObject.getString("point_status");
String ivt_qty = jsonObject.getString("ivt_qty");
WQLObject structIvtTab = WQLObject.getWQLObject("ST_IVT_StructIvt");
WQLObject vehicleGroupTab = WQLObject.getWQLObject("st_buss_vehiclegroup");
WQLObject materialTab = WQLObject.getWQLObject("MD_ME_Material");
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point");
JSONObject vehicleGroupObj = null;
if (ObjectUtil.isNotEmpty(vehicle_code)) {
vehicleGroupObj = vehicleGroupTab.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
}
if (point_status.equals("00")) { // 空位
// 删除仓位库存
structIvtTab.delete("struct_id = '" + jsonObject.getString("struct_id") + "'");
} else if (point_status.equals("01")) { // 空载具
// 删除组盘
if (ObjectUtil.isNotEmpty(vehicleGroupObj))
vehicleGroupTab.delete(vehicleGroupObj);
} else {
if (ObjectUtil.isEmpty(stockrecordId)) { // 仓位库存id为空就插入
JSONObject structIvt = new JSONObject();
structIvt.put("stockrecord_id", IdUtil.getSnowflake(1, 1).nextId());
structIvt.put("struct_id", jsonObject.getString("struct_id"));
if (ObjectUtil.isNotEmpty(vehicle_code))
structIvt.put("vehicle_code", jsonObject.getString("vehicle_code"));
structIvt.put("workprocedure_id", jsonObject.getString("workprocedure_id"));
if (ObjectUtil.isNotEmpty(material_id))
structIvt.put("material_id", jsonObject.getString("material_id"));
structIvt.put("producetask_id", jsonObject.getString("producetask_id"));
if (ObjectUtil.isNotEmpty(jsonObject.getString("ivt_qty"))) {
structIvt.put("canuse_qty", ivt_qty);
structIvt.put("ivt_qty", ivt_qty);
}
structIvt.put("frozen_qty", 0);
structIvt.put("warehousing_qty", 0);
structIvt.put("is_full", 0);
structIvtTab.insert(structIvt);
} else { // 不为空就修改
JSONObject structIvt = structIvtTab.query("stockrecord_id = '" + stockrecordId + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(vehicle_code))
structIvt.put("vehicle_code", jsonObject.getString("vehicle_code"));
if (ObjectUtil.isNotEmpty(material_id))
structIvt.put("material_id", jsonObject.getString("material_id"));
structIvt.put("producetask_id", jsonObject.getString("producetask_id"));
if (ObjectUtil.isNotEmpty(jsonObject.getString("ivt_qty"))) {
structIvt.put("canuse_qty", ivt_qty);
structIvt.put("ivt_qty", ivt_qty);
}
structIvtTab.update(structIvt);
}
// 组盘表
// 存在相应载具的话删掉在存
if (ObjectUtil.isNotEmpty(vehicleGroupObj)) vehicleGroupTab.delete(vehicleGroupObj);
JSONObject vehicleGroup = new JSONObject();
vehicleGroup.put("group_id", IdUtil.getSnowflake(1, 1).nextId());
vehicleGroup.put("vehicle_code", vehicle_code);
vehicleGroup.put("is_autopackage", 1);
if (ObjectUtil.isNotEmpty(material_id)) {
vehicleGroup.put("material_id", jsonObject.getString("material_id"));
JSONObject material = materialTab.query("material_id = '" + jsonObject.getString("material_id") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(material)) {
vehicleGroup.put("material_code", material.getString("material_code"));
vehicleGroup.put("material_name", material.getString("material_name"));
vehicleGroup.put("material_spec", material.getString("material_spec"));
}
}
vehicleGroup.put("task_id", IdUtil.simpleUUID());
vehicleGroup.put("create_id", currentUserId);
vehicleGroup.put("create_name", nickName);
vehicleGroup.put("create_time", now);
vehicleGroup.put("update_optid", currentUserId);
vehicleGroup.put("update_optname", nickName);
vehicleGroup.put("update_time", now);
vehicleGroup.put("producetask_id", jsonObject.getString("producetask_id"));
vehicleGroup.put("device_id", jsonObject.getString("device_id"));
vehicleGroup.put("qty", ivt_qty);
vehicleGroup.put("is_full", "1");
vehicleGroup.put("material_move_id", IdUtil.simpleUUID());
vehicleGroupTab.insert(vehicleGroup);
}
// 点位修改
JSONObject point = pointTab.query("point_id = '" + jsonObject.getString("point_id") + "'").uniqueResult(0);
point.put("point_status", point_status);
point.put("lock_type", jsonObject.getString("lock_type"));
pointTab.update(point);
}
}

View File

@@ -0,0 +1,75 @@
[交易说明]
交易名: 入窑缓存库
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.point_code TYPEAS s_string
输入.point_status TYPEAS s_string
输入.lock_type TYPEAS s_string
输入.is_used TYPEAS s_string
输入.area_type TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
point.*,
structattr.struct_id,
structivt.stockrecord_id,
structivt.material_id,
material.material_name
FROM
sch_base_point point
LEFT JOIN st_ivt_structattr structattr ON structattr.struct_code = point.point_code
LEFT JOIN st_ivt_structivt structivt ON structivt.struct_id = structattr.struct_id
LEFT JOIN md_me_material material ON material.material_id = structivt.material_id
WHERE
area_type = 输入.area_type
OPTION 输入.point_code <> ""
point.point_code LIKE 输入.point_code
OR
point.point_name LIKE 输入.point_code
ENDOPTION
OPTION 输入.point_status <> ""
point.point_status = 输入.point_status
ENDOPTION
OPTION 输入.lock_type <> ""
point.lock_type = 输入.lock_type
ENDOPTION
OPTION 输入.is_used <> ""
point.is_used = 输入.is_used
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF