rev:修改工单页面crud

This commit is contained in:
zhangzhiqiang
2023-06-13 08:58:04 +08:00
parent b375c67792
commit 531f9780e1
21 changed files with 595 additions and 125 deletions

View File

@@ -9,6 +9,7 @@ import java.util.Date;
import org.nl.common.enums.QueryTEnum;
import org.nl.common.utils.MapOf;
import org.springframework.format.annotation.DateTimeFormat;
import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
import java.lang.reflect.Type;
@@ -33,8 +34,8 @@ public class BaseQuery<T> {
/**
* 创建时间范围查询
*/
private Date start_time;
private Date end_time;
private String start_time;
private String end_time;
/**

View File

@@ -49,7 +49,6 @@ public class DeviceScreenController {
}
@PostMapping("/deviceManage")
@Log("设备管理")
@ApiOperation("设备管理")
public ResponseEntity<Object> deviceManage(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(deviceScreenService.deviceManage(whereJson), HttpStatus.OK);

View File

@@ -5,6 +5,8 @@ import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
@@ -30,6 +32,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -159,17 +162,19 @@ public class PdmProduceWorkorderController {
return new ResponseEntity<>(TableDataInfo.build(iPdmProduceWorkorderService.reportQuery(param)),HttpStatus.OK);
}
@PostMapping("/reportQuery2")
@GetMapping("/reportQuery2")
@Log("报工数修改")
@ApiOperation("报工数修改")
@SaIgnore
public ResponseEntity<Object> reportQuery2(@RequestBody ReportQuery param) {
return new ResponseEntity<>(TableDataInfo.build(iPdmProduceWorkorderService.reportQuery(param)),HttpStatus.OK);
public ResponseEntity<Object> reportQuery2(ReportQuery param ,PageQuery pageQuery) {
Page<Object> page = PageHelper
.startPage(pageQuery.getPage()+1, pageQuery.getSize())
.setOrderBy("workorder_code desc,seq_number asc");
param.setOrderby("true");
List<Map> list = iPdmProduceWorkorderService.reportQuery(param);
TableDataInfo<Map> build = TableDataInfo.build(list);
build.setTotalElements(page.getTotal());
return new ResponseEntity<>(build,HttpStatus.OK);
}
}

View File

@@ -15,6 +15,7 @@ import org.nl.common.enums.StatusEnum;
import org.nl.common.enums.WorkerOrderEnum;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.MapOf;
import org.nl.common.utils.RedissonUtils;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
@@ -80,7 +81,9 @@ public class SpeEmpTask extends AbstractAcsTask {
public void updateTaskStatus(JSONObject param,String status) {
SchBaseTask task = taskService.getOne(new QueryWrapper<SchBaseTask>().eq("task_id", param.getString("task_id")));
try {
SpeHandles.get(task.getTask_name()).handle(param,status,task);
RedissonUtils.lock(()->{
SpeHandles.get(task.getTask_name()).handle(param,status,task);
},param.getString("task_id")+status,2);
}catch (Exception ex){
log.error("更新状态异常updateTaskStatus param:{},status:{},ex:{}",param,status,ex);
throw ex;

View File

@@ -14,6 +14,7 @@ import org.nl.common.enums.StatusEnum;
import org.nl.common.enums.WorkerOrderEnum;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.MapOf;
import org.nl.common.utils.RedissonUtils;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
@@ -81,7 +82,9 @@ public class SpeFullTask extends AbstractAcsTask {
SchBaseTask task = taskService.getById(param.getString("task_id"));
pointService.update(new UpdateWrapper<SchBasePoint>().set("lock_type","0").in("point_code",task.getPoint_code1(),task.getPoint_code2(),task.getPoint_code3()));
try {
SpeHandles.get(task.getTask_name()).handle(param,status,task);
RedissonUtils.lock(()->{
SpeHandles.get(task.getTask_name()).handle(param,status,task);
},param.getString("task_id")+status,2);
}catch (Exception ex){
log.error(OPT_NAME+"updateStatus error:{}",ex);
throw ex;
@@ -276,6 +279,14 @@ public class SpeFullTask extends AbstractAcsTask {
.set("task_status",StatusEnum.TASK_FINISH.getCode())
.set("update_name","acs")
.set("update_time",DateUtil.now()).eq("task_id",task.getTask_id()));
PdmBiDevice one = deviceService.getOne(new QueryWrapper<PdmBiDevice>().eq("device_code", task.getPoint_code2()));
if (!("fall_finish"+task.getTask_id()).equals(one.getRemark())){
deviceService.update(new UpdateWrapper<PdmBiDevice>()
.set("material_id", task.getMaterial_id())
.set("deviceinstor_qty",one.getDeviceinstor_qty().add(task.getMaterial_qty()))
.set("remark","fall_finish"+task.getTask_id())
.eq("device_code", task.getPoint_code2()));
}
break;
case STATUS_CANNEL:
cancel(param.getString("task_id"));

View File

@@ -40,8 +40,9 @@
<select id="workproceduceDevicesWeight" resultType="java.util.Map">
select
GROUP_CONCAT(sch_base_task.task_id) as tasks,GROUP_CONCAT(sch_base_task.material_id) as materials,GROUP_CONCAT(md_me_materialbase.net_weight) as weights,
pdm_bi_device.inupperlimit_qty - ifnull( sum( sch_base_task.material_qty*md_me_materialbase.net_weight ), 0 ) - pdm_bi_device.deviceinstor_qty AS currentQty,
pdm_bi_device.inupperlimit_qty - ifnull( sum( sch_base_task.material_qty*md_me_materialbase.net_weight ), 0 ) - pdm_bi_device.deviceinstor_weight AS currentQty,
pdm_bi_device.device_code,
pdm_bi_device.inupperlimit_qty,
sch_base_point.point_code
from sch_base_point
left join pdm_bi_device on pdm_bi_device.device_code = sch_base_point.device_code
@@ -58,7 +59,7 @@
and (pdm_bi_device.spec = #{spec} or pdm_bi_device.spec is null)
</if>
GROUP BY pdm_bi_device.device_code
HAVING currentQty > #{qty}
HAVING currentQty > #{qty} and pdm_bi_device.inupperlimit_qty > currentQty
</select>
<select id="getDeviceByPoint" resultType="org.nl.wms.product_manage.service.device.dao.PdmBiDevice">

View File

@@ -24,6 +24,9 @@
<if test="query.order_status != null and query.order_status != ''">
and find_in_set(ShiftOrder.workorder_status, #{query.order_status})
</if>
<if test="query.device_code != null and query.device_code != ''">
and ShiftOrder.device_code = #{query.device_code}
</if>
<if test="query.shift_type_scode != null and query.shift_type_scode != ''">
and ShiftOrder.shift_type_scode = #{query.shift_type_scode}
</if>

View File

@@ -19,24 +19,26 @@
<if test="query.device_code != null and query.device_code != ''">
and wr.device_code = #{query.device_code}
</if>
<if test="query.workorder_code != null and query.workorder_code != ''">
and wr.workorder_code = #{query.workorder_code}
<if test="query.report_status != null and query.report_status != ''">
and re.report_status in ( ${query.report_status})
</if>
<if test="query.workorder_id != null and query.workorder_id != ''">
and wr.workorder_id = #{query.workorder_id}
</if>
<if test="query.start_time != null and query.start_time != ''">
and wr.realproducestart_date >= #{query.start_time}
<if test="query.shift_type_scode != null and query.shift_type_scode != ''">
and wr.shift_type_scode = #{query.shift_type_scode}
</if>
<if test="query.start_time != null and query.start_time != ''">
and wr.realproducestart_date >= #{query.start_time}
<if test="query.begin_time != null and query.begin_time != ''">
and re.operatetime_start >= #{query.begin_time}
</if>
<if test="query.end_time != null and query.end_time != ''">
and #{query.end_time} >= wr.realproducestart_date
and #{query.end_time} >= re.operatetime_start
</if>
<if test="query.user_id != null and query.user_id != ''">
and wr.current_produce_person_id = #{query.user_id}
</if>
order by workorder_code desc,seq_number asc
<if test="query.orderby == null and query.user_id == ''">
order by workorder_code desc,seq_number asc
</if>
</select>
</mapper>

View File

@@ -20,10 +20,12 @@ public class ReportQuery {
private String workorder_code;
private String workorder_id;
private String report;
private String start_time;
private String begin_time;
private String end_time;
private String shift_type_scode;
private String user_id;
private Boolean is_report =false;
private String report_status;
private String orderby;
}

View File

@@ -18,6 +18,7 @@ import java.util.Map;
public class WorkorderQuery extends BaseQuery<PdmProduceWorkorder> {
private String workorder_code;
private String device_code;
private String material;
private String order_status;
private String workprocedure_code;

View File

@@ -152,6 +152,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
entity.setDown_time(DateUtil.now());
entity.setDown_id(SecurityUtils.getCurrentUserId());
entity.setDown_name(SecurityUtils.getCurrentNickName());
entity.setReal_qty(null);
this.updateById(entity);
this.recordWorkOrder(OptionRecord.OptionEnum.UPDATE, entity.getWorkorder_id());
@@ -322,6 +323,9 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
if (j == 9) {
workorder.setPlan_qty(new BigDecimal(Long.valueOf(col)));
}
if (j == 13) {
workorder.setIs_needmove(col.equals("")?true:false);
}
}
}
if (CollectionUtils.isEmpty(errorMap)){
@@ -583,10 +587,15 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
if (!workorder.getIs_canupdate_update()){
throw new BadRequestException("当前工单设置为不允许修改报工记录");
}
reportRecordService.update(new UpdateWrapper<PdmProduceWorkorderrecord>()
.set("nok_qty",param.getBigDecimal("nok_qty"))
.set("repare_qty",param.getBigDecimal("repare_qty"))
.set("report_qty",param.getBigDecimal("report_qty"))
UpdateWrapper<PdmProduceWorkorderrecord> updateWrapper = new UpdateWrapper<>();
if (param.getBigDecimal("nok_qty")!=null){
updateWrapper.set("nok_qty",param.getBigDecimal("nok_qty"));
}
if (param.getBigDecimal("repare_qty")!=null){
updateWrapper.set("repare_qty",param.getBigDecimal("repare_qty"));
}
updateWrapper.set("report_qty",param.getBigDecimal("report_qty"));
reportRecordService.update(updateWrapper
.eq("macoperate_id", param.getString("macoperate_id")));
}
}

View File

@@ -68,8 +68,9 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
try {
AbstractAcsTask taskHandler = (AbstractAcsTask) SpringContextHolder.getBean(Class.forName(taskObj.getHandle_class()));
taskHandler.pointConfirm((JSONObject) JSONObject.toJSON(taskObj));
SchBaseTask task = this.getOne(new QueryWrapper<SchBaseTask>().eq("task_id", task_id));
JSONArray array = new JSONArray();
array.add(taskObj);
array.add(JSON.toJSON(task));
wms.issueTaskToAcs(array);
}catch (Exception ex){
taskObj.setTask_status(StatusEnum.TASK_START_ERROR.getCode());

View File

@@ -10,24 +10,24 @@ spring:
reactive:
#endpoints: 172.31.185.110:8200,172.31.154.9:8200 #内网
# endpoints: 47.96.133.178:8200 #外网
endpoints: http://192.168.46.225:9200 #外网
endpoints: http://127.0.0.1:9200 #外网
elasticsearch:
rest:
#uris: 172.31.185.110:8200,172.31.154.9:8200 #内网
# uris: 47.96.133.178:8200 #外网
uris: http://192.168.46.225:9200 #外网
# username: elastic
# password: 123456
uris: http://127.0.0.1:9200 #外网
# username: elastic
# password: 123456
datasource:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.5}:${DB_PORT:3306}/${DB_NAME:hl_one_mes_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.5}:${DB_PORT:3306}/${DB_NAME:hl_one_mes_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.5}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
username: ${DB_USER:root}
# password: ${DB_PWD:123456}
password: ${DB_PWD:123456}
password: ${DB_PWD:942464Yy}
# 初始连接数
initial-size: 5

View File

@@ -146,9 +146,8 @@ https://juejin.cn/post/6844903775631572999
</logger>
</springProfile>
<springProfile name="dev3">
<root level="info">
<root level="debug">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="esLogAppender"/>
</root>
<logger name="jdbc.audit" level="ERROR" additivity="false">