Merge branch 'master' of http://121.40.234.130:8899/root/hl_one
This commit is contained in:
@@ -27,7 +27,7 @@ public enum AcsTaskEnum {
|
||||
//专机到深坑任务:深坑业务单独处理
|
||||
TASK_PRODUCT_WASH("3","专机-深坑任务"),
|
||||
//3个点,任务编号,缓存线满料载具列表
|
||||
TASK_CACHELINE_OUT("4","缓存线-专机出库任务"),
|
||||
TASK_CACHELINE_OUT("4","缓存线-专机缺料任务"),
|
||||
TASK_PLOTTER_MAC("5","刻字机-满料入库"),
|
||||
TASK_PLOTTER_EMPTY("6","刻字机-呼叫空框"),
|
||||
TASK_WARP_MAC("7","包装机-叫料出库"),
|
||||
|
||||
@@ -9,7 +9,6 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.anno.Log;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.common.utils.api.ResultCode;
|
||||
import org.nl.modules.common.exception.BizCoreException;
|
||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
|
||||
@@ -122,52 +122,19 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
|
||||
String task_id = row.getString("task_id");
|
||||
TaskDto taskDto = taskService.findById(task_id);
|
||||
String processing_class = taskDto.getHandle_class();
|
||||
//1:执行中,2:完成 ,3:acs取消
|
||||
String acs_task_status = row.getString("status");
|
||||
String message = "";
|
||||
String status = "";
|
||||
if ("1".equals(acs_task_status)) {
|
||||
status = AcsTaskEnum.STATUS_START.getCode();
|
||||
}
|
||||
if ("2".equals(acs_task_status)) {
|
||||
status = AcsTaskEnum.STATUS_FINISH.getCode();
|
||||
}
|
||||
if ("3".equals(acs_task_status)) {
|
||||
status = AcsTaskEnum.STATUS_CANNEL.getCode();
|
||||
}
|
||||
String status = row.getString("status");
|
||||
// 任务处理类
|
||||
try {
|
||||
Object obj = SpringContextHolder.getBean(Class.forName(processing_class));
|
||||
Method m = obj.getClass().getDeclaredMethod("updateTaskStatus", JSONObject.class, String.class);
|
||||
m.invoke(obj, row, status);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
//空指针
|
||||
if (ObjectUtil.isNull(e.getTargetException().getMessage())) {
|
||||
message = e.getTargetException().toString();
|
||||
} else {
|
||||
message = e.getTargetException().getMessage();
|
||||
}
|
||||
log.info("任务状态更新失败:{}", message);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", task_id);
|
||||
json.put("message", message);
|
||||
errArr.add(json);
|
||||
|
||||
AbstractAcsTask taskHandler = (AbstractAcsTask)SpringContextHolder.getBean(Class.forName(processing_class));
|
||||
taskHandler.updateTaskStatus(row,status);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = e.getMessage();
|
||||
log.info("任务状态更新失败:{}", message);
|
||||
|
||||
log.info("任务状态更新失败:{}", e.getMessage());
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", task_id);
|
||||
json.put("message", message);
|
||||
json.put("message", e.getMessage());
|
||||
errArr.add(json);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "任务状态反馈成功!");
|
||||
@@ -176,6 +143,22 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
|
||||
return result;
|
||||
}
|
||||
|
||||
private String acsStatus2Mes(JSONObject row) {
|
||||
//6:执行中,7:完成 ,8:acs取消 acs:123
|
||||
String acs_task_status = row.getString("status");
|
||||
String status = "";
|
||||
if ("1".equals(acs_task_status)) {
|
||||
status = StatusEnum.TASK_RUNNING.getCode();
|
||||
}
|
||||
if ("2".equals(acs_task_status)) {
|
||||
status = StatusEnum.TASK_FINISH.getCode();
|
||||
}
|
||||
if ("3".equals(acs_task_status)) {
|
||||
status = StatusEnum.TASK_CANNEL.getCode();
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> receivePointStatusFromAcs(Map<String, String> jsonObject) {
|
||||
return null;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.ext.acs.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
@@ -85,6 +86,7 @@ public class AgvInstService {
|
||||
|
||||
}
|
||||
List<Map<String,String>> collect = deviceService.workproceduceDevices(query);
|
||||
log.info("调度任务分配点位信息:", JSON.toJSONString(collect));
|
||||
List<Map<String, String>> list = collect.stream().filter(stringStringMap -> stringStringMap.get("tasks") == null || stringStringMap.get("materials").contains(task.getString("material_id"))).collect(Collectors.toList());
|
||||
task.put("acs_task_type",AcsTaskEnum.ACS_TASK_TYPE_NOBLE_SINGLE_TASK.getCode());
|
||||
task.put("is_send","1");
|
||||
@@ -101,15 +103,15 @@ public class AgvInstService {
|
||||
task.put("task_name",AcsTaskEnum.TASK_PRODUCT_CACHE.getDesc());
|
||||
task.put("acs_task_type",AcsTaskEnum.ACS_TASK_TYPE_NOBLE_SINGLE_ENTRY_TASK.getCode());
|
||||
cacheVehile = getCacheVehile(nextPoint, null);
|
||||
if (StringUtils.isEmpty(cacheVehile)){
|
||||
throw new BadRequestException("当前缓存线无可用空箱:"+nextPoint);
|
||||
}
|
||||
}
|
||||
|
||||
结果校验:{
|
||||
if (StringUtils.isBlank(nextPoint)) {
|
||||
throw new BadRequestException("逻辑非配错误,请检查代码");
|
||||
}
|
||||
}
|
||||
// basePointService.update(new UpdateWrapper<SchBasePoint>()
|
||||
// .set("lock_type",StatusEnum.LOCK_ON.getCode()).set("task_id",task.getString("task_id")).eq("point_code",nextPoint));
|
||||
|
||||
SchBaseTask schBaseTask = task.toJavaObject(SchBaseTask.class);
|
||||
schBaseTask.setBarcodeArr(cacheVehile);
|
||||
@@ -180,6 +182,7 @@ public class AgvInstService {
|
||||
schBaseTask.setPoint_code3(startPoint);
|
||||
schBaseTask.setTask_status(StatusEnum.TASK_START_END_P.getCode());
|
||||
schBaseTask.setUpdate_time(new Date());
|
||||
schBaseTask.setUpdate_name("调度服务");
|
||||
taskService.updateById(schBaseTask);
|
||||
|
||||
}
|
||||
|
||||
@@ -32,8 +32,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService{
|
||||
, "next_point_code", task.getString("point_code3")//空盘返回点
|
||||
, "task_group_id", StringUtils.isBlank(task.getString("task_group_id"))? IdUtil.getStringId():task.getString("task_group_id")
|
||||
, "priority", task.getString("priority")
|
||||
, "is_send", task.getString("is_send")
|
||||
, "is_send", task.getBoolean("is_send")?"1":"0"
|
||||
, "vehicle_code", task.getString("vehicle_code")
|
||||
, "quantity", task.getString("material_qty")
|
||||
, "barcodeArr", task.getString("barcodeArr")
|
||||
, "proprity_floor", "2"
|
||||
, "agv_system_type", task.getString("agv_system_type")
|
||||
));
|
||||
form.add(param);
|
||||
@@ -104,3 +107,4 @@ public class WmsToAcsServiceImpl implements WmsToAcsService{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,6 @@ public interface TaskService {
|
||||
*
|
||||
* @param param
|
||||
*/
|
||||
void operation(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 获取任务类型
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.enums.AcsTaskEnum;
|
||||
import org.nl.common.enums.StatusEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
@@ -176,48 +177,6 @@ public class TaskServiceImpl implements TaskService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operation(Map<String, Object> map) {
|
||||
WmsToAcsServiceImpl wms = new WmsToAcsServiceImpl();
|
||||
String task_id = MapUtil.getStr(map, "task_id");
|
||||
String method_name = MapUtil.getStr(map, "method_name");
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
if (taskObj.getString("task_status").equals(TaskStatusEnum.FINISHED.getCode())) throw new BadRequestException("任务已完成!");
|
||||
|
||||
switch (method_name) { // forceFinish, cancel
|
||||
case "immediateNotifyAcs":
|
||||
JSONArray array = new JSONArray();
|
||||
array.add(taskObj);
|
||||
wms.issueTaskToAcs(array);
|
||||
break;
|
||||
case "forceFinish":
|
||||
JSONArray finish = new JSONArray();
|
||||
JSONObject res = new JSONObject();
|
||||
res.put("task_id", task_id);
|
||||
res.put("status", AcsTaskEnum.STATUS_FINISH.getCode());
|
||||
res.put("finished_type", AcsTaskEnum.MANUAL_TASK_FINISHED_TYPE.getCode()); // 手动完成
|
||||
finish.add(res);
|
||||
acsToWmsService.receiveTaskStatusAcs(JSON.toJSONString(finish));
|
||||
break;
|
||||
case "cancel":
|
||||
JSONArray cancel = new JSONArray();
|
||||
JSONObject res2 = new JSONObject();
|
||||
res2.put("task_id", task_id);
|
||||
res2.put("status", AcsTaskEnum.STATUS_CANNEL.getCode());
|
||||
cancel.add(res2);
|
||||
acsToWmsService.receiveTaskStatusAcs(JSON.toJSONString(cancel));
|
||||
break;
|
||||
case "delete":
|
||||
JSONArray delete = new JSONArray();
|
||||
JSONObject res3 = new JSONObject();
|
||||
res3.put("task_id", task_id);
|
||||
res3.put("status", AcsTaskEnum.STATUS_CANNEL.getCode());
|
||||
delete.add(res3);
|
||||
acsToWmsService.receiveTaskStatusAcs(JSON.toJSONString(delete));
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getTaskTypes() {
|
||||
|
||||
@@ -5,28 +5,24 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.nl.common.enums.AcsTaskEnum;
|
||||
import org.nl.common.enums.InterfaceLogType;
|
||||
import org.nl.common.enums.StatusEnum;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.ext.acs.service.impl.AgvInstService;
|
||||
import org.nl.wms.product_manage.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.product_manage.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.product_manage.service.device.IPdmBiDeviceService;
|
||||
import org.nl.wms.product_manage.service.device.dao.PdmBiDevice;
|
||||
import org.nl.wms.product_manage.service.workorder.IPdmProduceWorkorderService;
|
||||
import org.nl.wms.product_manage.service.workorder.dao.PdmProduceWorkorder;
|
||||
import org.nl.wms.scheduler_manage.service.cacheline.ISchCachelineVehilematerialService;
|
||||
import org.nl.wms.scheduler_manage.service.cacheline.dao.SchCachelineVehilematerial;
|
||||
import org.nl.wms.scheduler_manage.service.point.ISchBasePointService;
|
||||
import org.nl.wms.scheduler_manage.service.point.dao.SchBasePoint;
|
||||
import org.nl.wms.scheduler_manage.service.scheduler.ISchProcessRouteService;
|
||||
@@ -38,10 +34,12 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -55,34 +53,29 @@ public class SpeEmpTask extends AbstractAcsTask {
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private IPdmBiDeviceService iDeviceService;
|
||||
@Autowired
|
||||
private AgvInstService agvInstService;
|
||||
@Autowired
|
||||
private ISchBasePointService basePointService;
|
||||
@Autowired
|
||||
private ISchCachelineVehilematerialService cacheLineVechileService;
|
||||
|
||||
@Autowired
|
||||
private ISchProcessRouteService schProcessRouteService;
|
||||
|
||||
private final Map<String,SpeStatusHandler > SpeHandles= new HashMap<>();
|
||||
private static String OPT_NAME = "ACS回调# ";
|
||||
|
||||
|
||||
public SpeEmpTask() {
|
||||
SpeHandles.put(AcsTaskEnum.TASK_CACHELINE_OUT.name() ,new Cache2Spe());
|
||||
SpeHandles.put(AcsTaskEnum.TASK_CACHELINE_OUT.getDesc() ,new Cache2Spe());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject param,String status) {
|
||||
WQLObject taskTable = WQLObject.getWQLObject("sch_base_task");
|
||||
log.info(InterfaceLogType.ACS_TO_LMS.getDesc());
|
||||
// 指令执行中
|
||||
JSONObject task = taskTable.query("task_id = '" + param.getString("task_id") + "'").uniqueResult(0);
|
||||
AcsTaskEnum taskType = AcsTaskEnum.getType(task.getString("task_type"),"TASK_");
|
||||
SchBaseTask task = taskService.getOne(new QueryWrapper<SchBaseTask>().eq("task_id", param.getString("task_id")));
|
||||
try {
|
||||
SpeHandles.get(taskType.name()).handle(param,status,task);
|
||||
SpeHandles.get(task.getTask_name()).handle(param,status,task);
|
||||
}catch (Exception ex){
|
||||
log.error(OPT_NAME+"updateStatus error:{}",ex);
|
||||
log.error("更新状态异常updateTaskStatus param:{},status:{},ex:{}",param,status,ex);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
@@ -106,20 +99,11 @@ public class SpeEmpTask extends AbstractAcsTask {
|
||||
|
||||
JSONObject form = new JSONObject(MapOf.of("start_point_code","",
|
||||
"next_point_code",param.getString("device_code"),"return_point_code", "","vehicle_code",
|
||||
"","product_area",one.getProduct_area(),"quantity", param.getString("quantity"),"type",param.getString("type"),"material_id", one.getMaterial_id()));
|
||||
"","product_area",one.getProduct_area(),"quantity", param.getString("quantity"),"type",AcsTaskEnum.TASK_CACHELINE_OUT.getCode(),"material_id", one.getMaterial_id()));
|
||||
String taskId = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
JSONObject task = packageParam(form, taskId);
|
||||
taskService.save(task.toJavaObject(SchBaseTask.class));
|
||||
task.put("cacheLine",cahceLine);
|
||||
// try {
|
||||
// pointConfirm(task);
|
||||
// //下发
|
||||
// }catch (Exception ex){
|
||||
// log.error("SpeEmpTask#点位确认异常:{}",ex.getMessage());
|
||||
// task.put("task_status", TaskStatusEnum.SURE_START_ERROR.getCode());
|
||||
// task.put("remark",ex.getMessage());
|
||||
// WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
// }
|
||||
|
||||
return taskId;
|
||||
}
|
||||
|
||||
@@ -155,9 +139,8 @@ public class SpeEmpTask extends AbstractAcsTask {
|
||||
private JSONObject packageParam(JSONObject form, String task_id) {
|
||||
JSONObject task = new JSONObject();
|
||||
参数封装:{
|
||||
AcsTaskEnum taskEnum = AcsTaskEnum.getType(form.getString("type"), "TASK_");
|
||||
task.put("task_id", task_id);
|
||||
task.put("task_name", taskEnum.getDesc());
|
||||
task.put("task_name", AcsTaskEnum.TASK_CACHELINE_OUT.getDesc());
|
||||
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
task.put("task_type", form.getString("type"));
|
||||
task.put("acs_task_type", AcsTaskEnum.ACS_TASK_TYPE_NOBLE_DOUBLE_TASK.getCode());
|
||||
@@ -184,45 +167,40 @@ public class SpeEmpTask extends AbstractAcsTask {
|
||||
|
||||
@Override
|
||||
public void cancel(String taskId) {
|
||||
log.info(OPT_NAME+"cancel taskID:{}",taskId);
|
||||
WQLObject taskTable = WQLObject.getWQLObject("sch_base_task");
|
||||
//专机-专机
|
||||
//专机-缓存线
|
||||
//缓存线出库
|
||||
taskTable.update(MapOf.of("task_status",StatusEnum.TASK_CANNEL.getCode()),"task_id = '"+taskId+"'");
|
||||
|
||||
taskService.update(new UpdateWrapper<SchBaseTask>()
|
||||
.set("task_status",StatusEnum.TASK_CANNEL.getCode()).eq("task_id",taskId));
|
||||
}
|
||||
interface SpeStatusHandler{
|
||||
void handle(JSONObject param,String status,JSONObject task);
|
||||
void handle(JSONObject param,String status,SchBaseTask task);
|
||||
}
|
||||
class Cache2Spe implements SpeStatusHandler{
|
||||
@Override
|
||||
public void handle(JSONObject param, String sta,JSONObject task) {
|
||||
public void handle(JSONObject param, String sta,SchBaseTask task) {
|
||||
AcsTaskEnum status = AcsTaskEnum.getType(sta,"status_");
|
||||
WQLObject taskTable = WQLObject.getWQLObject("sch_base_task");
|
||||
WQLObject cacheVehTable = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
|
||||
WQLObject pointTable = WQLObject.getWQLObject("SCH_BASE_Point");
|
||||
WQLObject deviceTable = WQLObject.getWQLObject("pdm_bi_device");
|
||||
|
||||
switch (status){
|
||||
case STATUS_START:
|
||||
taskTable.update(MapOf.of("task_status",StatusEnum.TASK_RUNNING.getCode(),"update_name","acs","update_time", DateUtil.now()),"task_id = '"+task.getString("task_id")+"'");
|
||||
taskService.update(new UpdateWrapper<SchBaseTask>()
|
||||
.set("task_status",StatusEnum.TASK_RUNNING.getCode())
|
||||
.set("update_name","acs")
|
||||
.set("update_time", DateUtil.now())
|
||||
.eq("task_id",task.getTask_id()));
|
||||
break;
|
||||
case STATUS_FINISH:
|
||||
taskTable.update(MapOf.of("task_status",StatusEnum.TASK_FINISH.getCode(),"update_name","acs","update_time", DateUtil.now()),"task_id = '"+task.getString("task_id")+"'");
|
||||
|
||||
String point_code2 = task.getString("point_code2");
|
||||
JSONObject pointInfo = pointTable.query("point_code = '" + point_code2 + "'").uniqueResult(0);
|
||||
JSONObject device = deviceTable.query("device_code = '" + pointInfo.getString("device_code") + "'").uniqueResult(0);
|
||||
task.getDouble("material_qty");
|
||||
double currentQty = device.getDouble("deviceinstor_qty") + task.getDouble("material_qty");
|
||||
deviceTable.update(MapOf.of("deviceinstor_qty", String.valueOf(currentQty)), "device_code = '" + pointInfo.getString("device_code") + "'");
|
||||
taskService.update(new UpdateWrapper<SchBaseTask>()
|
||||
.set("task_status",StatusEnum.TASK_FINISH.getCode())
|
||||
.set("update_name","acs")
|
||||
.set("update_time", DateUtil.now())
|
||||
.eq("task_id",task.getTask_id()));
|
||||
SchBasePoint point = basePointService.getOne(new QueryWrapper<SchBasePoint>().eq("point_code", task.getPoint_code2()));
|
||||
PdmBiDevice device = iDeviceService.getOne(new QueryWrapper<PdmBiDevice>().eq("device_code", point.getDevice_code()));
|
||||
BigDecimal currentQty = device.getDeviceinstor_qty().add(task.getMaterial_qty());
|
||||
iDeviceService.update(new UpdateWrapper<PdmBiDevice>().set("deviceinstor_qty",currentQty).eq("device_code",point.getDevice_code()));
|
||||
break;
|
||||
case STATUS_CANNEL:
|
||||
cancel(param.getString("task_id"));
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException(OPT_NAME+"未定义任务状态:"+sta);
|
||||
throw new BadRequestException("未定义任务状态:"+sta);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -238,10 +216,10 @@ public class SpeEmpTask extends AbstractAcsTask {
|
||||
ArrayList<SchBaseTask> Merge = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(array)){
|
||||
String pointCollect = array.stream().map(a->a.getPoint_code1() + "','" + a.getPoint_code2()).collect(Collectors.joining("','"));
|
||||
JSONArray needMergeCollect = WQL.getWO("sch_point").addParamMap(MapOf.of("flag", "5", "point_codes", "'" + pointCollect + "'")).process().getResultJSONArray(0);
|
||||
//区域编号对应point_code
|
||||
Map<String, List<Object>> pointRegionCollent = needMergeCollect.stream().collect(Collectors.groupingBy(o -> ((JSONObject) o).getString("point_code")));
|
||||
Set<String> mergePointCollent = needMergeCollect.stream().map(item -> ((JSONObject) item).getString("point_code")).collect(Collectors.toSet());
|
||||
List<Map<String,String>> needMergeCollect = basePointService.getAllPointRegin(pointCollect);
|
||||
//区域编号对应point_code pointRegionCollent
|
||||
Map<String, List<Map<String,String>>> pointRegionCollent = needMergeCollect.stream().collect(Collectors.groupingBy(o -> o.get("point_code")));
|
||||
Set<String> mergePointCollent = needMergeCollect.stream().map(item -> item.get("point_code")).collect(Collectors.toSet());
|
||||
//合并下发的任务
|
||||
List<SchBaseTask> notMerge = new ArrayList<>();//单独下发的任务
|
||||
List<SchBaseTask> waitingTask = new ArrayList<>();//可合并,但是只有单条任务
|
||||
@@ -316,7 +294,7 @@ public class SpeEmpTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
|
||||
private String getMergePoint(Map<String, List<Object>> pointRegionCollent, String start,String end,List<SchBaseTask> tasks,List<String> taskIds) {
|
||||
private String getMergePoint(Map<String, List<Map<String,String>>> pointRegionCollent, String start,String end,List<SchBaseTask> tasks,List<String> taskIds) {
|
||||
String findpoint = findpoint(pointRegionCollent, start, tasks, taskIds);
|
||||
if (findpoint == null){
|
||||
findpoint = findpoint(pointRegionCollent, end, tasks, taskIds);
|
||||
@@ -324,13 +302,13 @@ public class SpeEmpTask extends AbstractAcsTask {
|
||||
return findpoint;
|
||||
}
|
||||
|
||||
private String findpoint(Map<String, List<Object>> pointRegionCollent, String start, List<SchBaseTask> tasks, List<String> taskIds) {
|
||||
List<Object> objects = pointRegionCollent.get(start);
|
||||
private String findpoint(Map<String, List<Map<String,String>>> pointRegionCollent, String start, List<SchBaseTask> tasks, List<String> taskIds) {
|
||||
List<Map<String,String>> objects = pointRegionCollent.get(start);
|
||||
if (CollectionUtils.isEmpty(objects)){
|
||||
return null;
|
||||
}
|
||||
JSONObject startPointInfo = (JSONObject) objects.get(0);
|
||||
String startPointCollent = startPointInfo.getString("pointcollent");
|
||||
Map<String,String> startPointInfo = objects.get(0);
|
||||
String startPointCollent = startPointInfo.get("pointcollent");
|
||||
String[] split = startPointCollent.split(",");
|
||||
for (String s : split) {
|
||||
Optional<SchBaseTask> any = tasks.stream().filter(a -> a.getPoint_code1().equals(s) && !taskIds.contains((a.getTask_id()))).findAny();
|
||||
|
||||
@@ -66,9 +66,9 @@ public class SpeFullTask extends AbstractAcsTask {
|
||||
|
||||
|
||||
public SpeFullTask() {
|
||||
SpeHandles.put(AcsTaskEnum.TASK_PRODUCT_MAC.name() ,new Spe2Spe());
|
||||
SpeHandles.put(AcsTaskEnum.TASK_PRODUCT_CACHE.name() ,new Spe2Cache());
|
||||
SpeHandles.put(AcsTaskEnum.TASK_PRODUCT_WASH.name() ,new Spe2Wash());
|
||||
SpeHandles.put(AcsTaskEnum.TASK_PRODUCT_MAC.getDesc() ,new Spe2Spe());
|
||||
SpeHandles.put(AcsTaskEnum.TASK_PRODUCT_CACHE.getDesc() ,new Spe2Cache());
|
||||
SpeHandles.put(AcsTaskEnum.TASK_PRODUCT_WASH.getDesc() ,new Spe2Wash());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,14 +77,9 @@ public class SpeFullTask extends AbstractAcsTask {
|
||||
log.info(InterfaceLogType.ACS_TO_LMS.getDesc());
|
||||
// 指令执行中
|
||||
SchBaseTask task = taskService.getById(param.getString("task_id"));
|
||||
AcsTaskEnum taskType = AcsTaskEnum.getType(task.getTask_type(),"TASK_");
|
||||
pointService.update(new UpdateWrapper<SchBasePoint>().set("lock_type","0").in("point_code",task.getPoint_code1(),task.getPoint_code2(),task.getPoint_code3()));
|
||||
taskService.update(new UpdateWrapper<SchBaseTask>()
|
||||
.set("task_status",status)
|
||||
.set("update_name","acs")
|
||||
.set("update_time",DateUtil.now()).eq("task_id",task.getTask_id()));
|
||||
try {
|
||||
SpeHandles.get(taskType.name()).handle(param,status,task);
|
||||
SpeHandles.get(task.getTask_name()).handle(param,status,task);
|
||||
}catch (Exception ex){
|
||||
log.error(OPT_NAME+"updateStatus error:{}",ex);
|
||||
throw ex;
|
||||
@@ -115,14 +110,6 @@ public class SpeFullTask extends AbstractAcsTask {
|
||||
String taskId = IdUtil.getStringId();
|
||||
JSONObject task = packageParam(form, taskId);
|
||||
taskService.save(task.toJavaObject(SchBaseTask.class));
|
||||
// try {
|
||||
// pointConfirm(task);
|
||||
// //下发
|
||||
// }catch (Exception ex){
|
||||
// task.put("task_status", TaskStatusEnum.SURE_START_ERROR.getCode());
|
||||
// task.put("remark",ex.getMessage());
|
||||
// WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
// }
|
||||
return taskId;
|
||||
}
|
||||
|
||||
@@ -179,32 +166,23 @@ public class SpeFullTask extends AbstractAcsTask {
|
||||
.set("update_name","acs")
|
||||
.set("update_time",DateUtil.now()).eq("task_id",task.getTask_id()));
|
||||
Map<String, String> extParam = (Map)param.get("ext_param");
|
||||
//取货完成/放货完成暂不处理箱子
|
||||
if (extParam.get("put_finish") != null){
|
||||
pointService.update(new UpdateWrapper<SchBasePoint>()
|
||||
.set("vehicle_code",task.getVehicle_code2())
|
||||
.eq("point_code",task.getPoint_code3()));
|
||||
}
|
||||
if (extParam.get("take_finish") != null){
|
||||
pointService.update(new UpdateWrapper<SchBasePoint>()
|
||||
.set("vehicle_code","")
|
||||
.eq("point_code",task.getPoint_code3()));
|
||||
pointService.update(new UpdateWrapper<SchBasePoint>()
|
||||
.set("vehicle_code",task.getVehicle_code2())
|
||||
.eq("point_code",task.getPoint_code1()));
|
||||
}
|
||||
// if (extParam.get("put_finish") != null){
|
||||
log.info("放货完成:{},vechile_code:{}",task.getTask_id(),task.getVehicle_code2());
|
||||
// pointService.update(new UpdateWrapper<SchBasePoint>()
|
||||
// .set("vehicle_code",task.getVehicle_code2())
|
||||
// .eq("point_code",task.getPoint_code3()));
|
||||
// }
|
||||
// if (extParam.get("take_finish") != null){
|
||||
}
|
||||
if (extParam.get("take_finish") != null){
|
||||
log.info("取货完成:{},vechile_code:{}",task.getTask_id(),task.getVehicle_code2());
|
||||
// pointService.update(new UpdateWrapper<SchBasePoint>()
|
||||
// .set("vehicle_code","")
|
||||
// .eq("point_code",task.getPoint_code3()));
|
||||
// pointService.update(new UpdateWrapper<SchBasePoint>()
|
||||
// .set("vehicle_code",task.getVehicle_code2())
|
||||
// .eq("point_code",task.getPoint_code1()));
|
||||
// }
|
||||
}
|
||||
|
||||
break;
|
||||
case STATUS_FINISH:
|
||||
taskService.update(new UpdateWrapper<SchBaseTask>()
|
||||
@@ -232,15 +210,13 @@ public class SpeFullTask extends AbstractAcsTask {
|
||||
.set("task_status", StatusEnum.TASK_RUNNING.getCode())
|
||||
.set("update_name", "acs")
|
||||
.set("update_time", DateUtil.now()).eq("task_id", task.getTask_id());
|
||||
|
||||
if (extParam.get("outboxt")!= null){ wrapper.set("vehicle_code2",extParam.get("outboxt")); }
|
||||
if (extParam.get("outbox")!= null){ wrapper.set("vehicle_code2",extParam.get("outbox")); }
|
||||
taskService.update(wrapper);
|
||||
|
||||
//outboxt箱子更新到任务表vechile_code2?
|
||||
if (extParam.get("inboxt") != null){
|
||||
if (extParam.get("inbox") != null){
|
||||
SchCachelineVehilematerial vehilematerial = new SchCachelineVehilematerial();
|
||||
vehilematerial.setVehmaterial_id(IdUtil.getStringId());
|
||||
vehilematerial.setVehicle_code(extParam.get("inboxt"));
|
||||
vehilematerial.setVehicle_code(extParam.get("inbox"));
|
||||
vehilematerial.setMaterial_id(task.getMaterial_id());
|
||||
vehilematerial.setErr_type("0");
|
||||
vehilematerial.setCreate_time(DateUtil.now());
|
||||
@@ -270,6 +246,10 @@ public class SpeFullTask extends AbstractAcsTask {
|
||||
switch (status){
|
||||
case STATUS_START:
|
||||
Map<String, String> extParam = (Map)param.get("ext_param");
|
||||
UpdateWrapper<SchBaseTask> wrapper = new UpdateWrapper<SchBaseTask>()
|
||||
.set("task_status", StatusEnum.TASK_RUNNING.getCode())
|
||||
.set("update_name", "acs")
|
||||
.set("update_time", DateUtil.now()).eq("task_id", task.getTask_id());
|
||||
log.info("生坑到料完成:"+param.toString());
|
||||
if (extParam.get("fall_finish") != null){
|
||||
PdmBiDevice one = deviceService.getOne(new QueryWrapper<PdmBiDevice>().eq("device_code", task.getPoint_code2()));
|
||||
@@ -280,8 +260,13 @@ public class SpeFullTask extends AbstractAcsTask {
|
||||
}
|
||||
break;
|
||||
case STATUS_FINISH:
|
||||
taskService.update(new UpdateWrapper<SchBaseTask>()
|
||||
.set("task_status",StatusEnum.TASK_FINISH.getCode())
|
||||
.set("update_name","acs")
|
||||
.set("update_time",DateUtil.now()).eq("task_id",task.getTask_id()));
|
||||
break;
|
||||
case STATUS_CANNEL:
|
||||
cancel(param.getString("task_id"));
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException(OPT_NAME+"未定义任务状态:"+sta);
|
||||
|
||||
@@ -75,16 +75,15 @@ public class TaskScheduleService {
|
||||
try {
|
||||
AbstractAcsTask taskHandler = (AbstractAcsTask)SpringContextHolder.getBean(Class.forName(task.getHandle_class()));
|
||||
taskHandler.pointConfirm((JSONObject) JSONObject.toJSON(task));
|
||||
task.setTask_type(StatusEnum.TASK_START_END_P.getCode());
|
||||
}catch (Exception ex){
|
||||
task.setTask_type(StatusEnum.TASK_START_ERROR.getCode());
|
||||
task.setTask_status(StatusEnum.TASK_START_ERROR.getCode());
|
||||
task.setRemark(ex.getMessage());
|
||||
task.setUpdate_time(new Date());
|
||||
taskService.updateById(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<SchBaseTask> all = taskService.list(new QueryWrapper<SchBaseTask>().eq("is_auto_issue", "1").eq("is_delete",false).eq("task_status", StatusEnum.TASK_START_END_P.getCode()));
|
||||
List<SchBaseTask> all = taskService.list(new QueryWrapper<SchBaseTask>().eq("is_auto_issue", "1").eq("is_delete",false).eq("task_status", StatusEnum.TASK_START_END_P.getCode()).orderByAsc("point_code2"));
|
||||
//分区域:不同区域调用不同acs接口
|
||||
log.info("定时调度——2222——准备下发任务:{}", JSON.toJSONString(all.stream().map(a->a.getTask_id()+"__"+a.getPoint_code1()+a.getPoint_code2()+a.getPoint_code3()).collect(Collectors.toList())));
|
||||
Map<String, List<SchBaseTask>> areaCollent = all.stream().collect(Collectors.groupingBy(SchBaseTask::getProduct_area));
|
||||
@@ -94,7 +93,13 @@ public class TaskScheduleService {
|
||||
for (Map.Entry<String, List<SchBaseTask>> array : listMap.entrySet()) {
|
||||
//调用不同实现
|
||||
AbstractAcsTask taskHandler = (AbstractAcsTask)SpringContextHolder.getBean(Class.forName(array.getKey()));
|
||||
Merge.addAll(taskHandler.schedulerTask(array.getValue()));
|
||||
try {
|
||||
List<SchBaseTask> schBaseTasks = taskHandler.schedulerTask(array.getValue());
|
||||
Merge.addAll(schBaseTasks);
|
||||
}catch (Exception ex){
|
||||
log.error("调度任务分配异常:{}",ex);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
JSONArray arr = new JSONArray();
|
||||
for (SchBaseTask task : Merge) {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</select>
|
||||
<select id="workproceduceDevices" resultType="java.util.Map">
|
||||
select
|
||||
GROUP_CONCAT(sch_base_task.task_id),
|
||||
GROUP_CONCAT(sch_base_task.task_id) as tasks,GROUP_CONCAT(sch_base_task.material_id) as materials,
|
||||
pdm_bi_device.inupperlimit_qty - ifnull( sum( sch_base_task.material_qty ), 0 ) - pdm_bi_device.deviceinstor_qty AS currentQty,
|
||||
pdm_bi_device.device_code,
|
||||
sch_base_point.point_code
|
||||
@@ -34,7 +34,7 @@
|
||||
and (pdm_bi_device.material_id = #{material_id} or pdm_bi_device.material_id is null )
|
||||
</if>
|
||||
<if test="spec != null and spec != ''">
|
||||
and pdm_bi_device.spec = #{spec}
|
||||
and (pdm_bi_device.spec = #{spec} or pdm_bi_device.spec is null)
|
||||
</if>
|
||||
GROUP BY pdm_bi_device.device_code
|
||||
HAVING currentQty > #{qty}
|
||||
|
||||
@@ -50,4 +50,6 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
|
||||
|
||||
Map getWorkprodureById(String id);
|
||||
Map getWorkprodureByCode(String id);
|
||||
|
||||
List<Map<String,String>> getAllPointRegin(String points);
|
||||
}
|
||||
|
||||
@@ -34,4 +34,6 @@ public interface SchBasePointMapper extends BaseMapper<SchBasePoint> {
|
||||
|
||||
Map getWorkprodure(@Param("workprodureId") String workprodureId, @Param("workprodureCode") String workprodureCode);
|
||||
|
||||
List<Map<String,String>> getRegionCollent(String points);
|
||||
|
||||
}
|
||||
|
||||
@@ -106,4 +106,18 @@
|
||||
workprocedure_code = #{workprodureCode}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getRegionCollent" resultType="java.util.Map">
|
||||
SELECT
|
||||
sch_base_region.region_code,
|
||||
sch_base_point.point_code,
|
||||
GROUP_CONCAT(b.point_code) as pointcollent
|
||||
FROM
|
||||
sch_base_region
|
||||
LEFT JOIN sch_base_point ON sch_base_region.region_code = sch_base_point.region_code
|
||||
LEFT JOIN sch_base_point b ON sch_base_region.region_code = b.region_code AND b.point_code IN ( #{points} )
|
||||
WHERE
|
||||
sch_base_region.is_merge = '1'
|
||||
AND sch_base_point.point_code IN ( #{points} )
|
||||
GROUP BY sch_base_point.point_code
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -163,4 +163,9 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String,String>> getAllPointRegin(String points) {
|
||||
return this.baseMapper.getRegionCollent(points);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.BaseConverter;
|
||||
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.BaseElement;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.xml.stream.XMLStreamConstants;
|
||||
@@ -19,6 +20,9 @@ import java.util.Map;
|
||||
*/
|
||||
@Service("flow")
|
||||
public class FlowConverter implements BaseConverter {
|
||||
@Autowired
|
||||
ParamConverter paramConverter;
|
||||
|
||||
String[] labels = new String[]{"id","name","sourceRef","targetRef"};
|
||||
@Override
|
||||
@SneakyThrows
|
||||
@@ -37,6 +41,8 @@ public class FlowConverter implements BaseConverter {
|
||||
if (XMLStreamConstants.START_ELEMENT == xtr.next()){
|
||||
System.out.println(xtr.getLocalName());
|
||||
element.getParams().put(xtr.getAttributeValue(null,"id"),xtr.getAttributeValue(null,"value"));
|
||||
ParamElement process = (ParamElement)paramConverter.process(xtr);
|
||||
element.getParams().put(process.getId(),process.getValue());
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -45,3 +51,4 @@ public class FlowConverter implements BaseConverter {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ public class FlowElement extends BaseElement {
|
||||
private FlowElement targetRef;
|
||||
private String sourceRefId;
|
||||
private String targetRefId;
|
||||
private Map<String,String> params = new HashMap<>();
|
||||
private Map<String,Object> params = new HashMap<>();
|
||||
|
||||
|
||||
|
||||
@@ -55,11 +55,11 @@ public class FlowElement extends BaseElement {
|
||||
this.targetRefId = targetRefId;
|
||||
}
|
||||
|
||||
public Map<String, String> getParams() {
|
||||
public Map<String, Object> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Map<String, String> params) {
|
||||
public void setParams(Map<String, Object> params) {
|
||||
this.params = params;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.nl.wms.scheduler_manage.service.scheduler.labelConverter.impl;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.BaseConverter;
|
||||
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.BaseElement;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.xml.stream.XMLStreamConstants;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/5/19 11:00
|
||||
*/
|
||||
@Service("param")
|
||||
public class ParamConverter implements BaseConverter {
|
||||
String[] labels = new String[]{"id","value"};
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public BaseElement process(XMLStreamReader xtr) {
|
||||
ParamElement element = new ParamElement();
|
||||
setBaseLabel(element,xtr,labels);
|
||||
element.setValue(xtr.getAttributeValue(null,"value"));
|
||||
String has = xtr.getAttributeValue(null, "has");
|
||||
if (StringUtils.isNotEmpty(has)){
|
||||
int i = 0;
|
||||
while (true){
|
||||
if (i == Integer.valueOf(has)){
|
||||
break;
|
||||
}
|
||||
if (XMLStreamConstants.START_ELEMENT == xtr.next()){
|
||||
element.getItem().put(xtr.getAttributeValue(null,"spec"),xtr.getAttributeValue(null,"value"));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
element.setValue(element.getItem());
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.nl.wms.scheduler_manage.service.scheduler.labelConverter.impl;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.BaseElement;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/5/21 18:03
|
||||
*/
|
||||
@Data
|
||||
public class ParamElement extends BaseElement {
|
||||
private Object value;
|
||||
private Map<String,String> item = new HashMap<>();
|
||||
|
||||
}
|
||||
@@ -109,5 +109,13 @@ public class IStivtlostorivnCpOutController {
|
||||
return new ResponseEntity<>(iStIvtIostorinvCpOutService.getStructIvt(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/manualDiv")
|
||||
@Log("手工分配保存")
|
||||
@ApiOperation("手工分配保存")
|
||||
public ResponseEntity<Object> manualDiv(@RequestBody JSONObject whereJson){
|
||||
iStIvtIostorinvCpOutService.manualDiv(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
package org.nl.wms.storage_manage.productmanage.controller.moreOrLess;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.IStIvtMoreorlessmstCpService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.moveOrLess.dto.MoreOrlessQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,8 +21,57 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @since 2023-05-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/stIvtMoreorlessmstCp")
|
||||
@RequestMapping("/api/stIvtMoreorlessmstCp")
|
||||
public class StIvtMoreorlessmstCpController {
|
||||
|
||||
@Autowired
|
||||
private IStIvtMoreorlessmstCpService iStIvtMoreorlessmstCpService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询损溢单")
|
||||
@ApiOperation("查询损溢单")
|
||||
public ResponseEntity<Object> query(MoreOrlessQuery query, PageQuery page) {
|
||||
return new ResponseEntity<>(iStIvtMoreorlessmstCpService.pageQuery(query, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("创建损溢单")
|
||||
@ApiOperation("创建损溢单")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
|
||||
iStIvtMoreorlessmstCpService.create(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getMlDtl")
|
||||
@Log("查询损溢明细")
|
||||
@ApiOperation("查询损溢明细")
|
||||
public ResponseEntity<Object> getMlDtl(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(iStIvtMoreorlessmstCpService.getMlDtl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@Log("修改损溢单")
|
||||
@ApiOperation("修改损溢单")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
|
||||
iStIvtMoreorlessmstCpService.update(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@Log("删除入库单")
|
||||
@ApiOperation("删除入库单")
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids){
|
||||
iStIvtMoreorlessmstCpService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirm")
|
||||
@Log("完成单据")
|
||||
@ApiOperation("完成单据")
|
||||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
|
||||
iStIvtMoreorlessmstCpService.confirm(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -131,4 +131,14 @@ public interface IStIvtIostorinvCpOutService extends IService<StIvtIostorinvCp>
|
||||
* }
|
||||
*/
|
||||
List getStructIvt(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 手工分配保存
|
||||
* @param whereJson
|
||||
* {
|
||||
* rows:库存,
|
||||
* iostorinvdtl_id:明细id,
|
||||
* }
|
||||
*/
|
||||
void manualDiv(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -478,11 +479,59 @@ public class StIvtIostorinvCpOutServiceImpl extends ServiceImpl<StIvtIostorinvCp
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("materia_id", whereJson.getString("materia_id"));
|
||||
param.put("stor_id", whereJson.getString("stor_id"));
|
||||
if (ObjectUtil.isNotEmpty(whereJson.getString("sale_id"))) param.put("sale_id", whereJson.getString("sale_id"));
|
||||
if (ObjectUtil.isNotEmpty(whereJson.getString("source_billdtl_id"))) param.put("sale_id", whereJson.getString("source_billdtl_id"));
|
||||
if (ObjectUtil.isNotEmpty(whereJson.getString("search"))) param.put("remark", whereJson.getString("search"));
|
||||
if (ObjectUtil.isNotEmpty(whereJson.getString("sect_id"))) param.put("sect_id", whereJson.getString("sect_id"));
|
||||
|
||||
return iStIvtStructivtCpService.getStructIvt(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void manualDiv(JSONObject whereJson) {
|
||||
|
||||
JSONArray rows = whereJson.getJSONArray("rows");
|
||||
|
||||
// 1.组织要更新库存的集合
|
||||
ArrayList<StIvtStructivtCp> ivtDaoList = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject jsonObject = rows.getJSONObject(i);
|
||||
StIvtStructivtCp ivtDao = iStIvtStructivtCpService.getById(jsonObject.getString("stockrecord_id"));
|
||||
ivtDao.setCanuse_qty(jsonObject.getBigDecimal("plan_qty"));
|
||||
|
||||
ivtDaoList.add(ivtDao);
|
||||
}
|
||||
|
||||
// 2.插入分配表
|
||||
StIvtIostorinvdtlCp dtlDao = iostorinvdtlCpService.getById(whereJson.getString("iostorinvdtl_id"));
|
||||
iostorinvdisCpService.onductDataOutDis(ivtDaoList,dtlDao);
|
||||
|
||||
// 3.更新明细状态
|
||||
BigDecimal assign_qty = ivtDaoList.stream()
|
||||
.map(StIvtStructivtCp::getCanuse_qty)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add); // 已分配数量
|
||||
|
||||
BigDecimal unassign_qty = NumberUtil.sub(dtlDao.getUnassign_qty(), assign_qty); // 未分配重量
|
||||
|
||||
if (unassign_qty.doubleValue() != 0) {
|
||||
dtlDao.setBill_status(IOSEnum.BILL_STATUS.code("分配中"));
|
||||
} else {
|
||||
dtlDao.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
|
||||
}
|
||||
|
||||
dtlDao.setUnassign_qty(unassign_qty);
|
||||
dtlDao.setAssign_qty(assign_qty);
|
||||
iostorinvdtlCpService.updateById(dtlDao);
|
||||
|
||||
// 4.更新库存冻结数 、 锁定仓位
|
||||
StIvtIostorinvCp mstDao = this.getById(dtlDao.getIostorinv_id());
|
||||
updateIvtDiv(ivtDaoList,mstDao);
|
||||
|
||||
// 5.更新主表
|
||||
updateMst(mstDao.getIostorinv_id());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private StIvtIostorinvCp packageMstForm(StIvtIostorinvCp stIvtIostorinvCp,JSONObject whereJson,Boolean isUpdate) {
|
||||
JSONArray rows = whereJson.getJSONArray("tableData");
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package org.nl.wms.storage_manage.productmanage.service.moreOrLess;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessdtlCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessmstCp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +19,13 @@ import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreo
|
||||
*/
|
||||
public interface IStIvtMoreorlessdtlCpService extends IService<StIvtMoreorlessdtlCp> {
|
||||
|
||||
/**
|
||||
* 主单据使用
|
||||
* @param row
|
||||
* @param mst
|
||||
* @return
|
||||
*/
|
||||
double create(JSONArray row, StIvtMoreorlessmstCp mst);
|
||||
|
||||
List<Map> getMlDtl(JSONObject form);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package org.nl.wms.storage_manage.productmanage.service.moreOrLess;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessmstCp;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.moveOrLess.dto.MoreOrlessQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +19,22 @@ import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreo
|
||||
*/
|
||||
public interface IStIvtMoreorlessmstCpService extends IService<StIvtMoreorlessmstCp> {
|
||||
|
||||
Object pageQuery(MoreOrlessQuery query, PageQuery page);
|
||||
|
||||
void create(JSONObject jo);
|
||||
|
||||
List<Map> getMlDtl(JSONObject map);
|
||||
|
||||
void update(JSONObject map);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param ids
|
||||
* {
|
||||
* 主表id..
|
||||
* }
|
||||
*/
|
||||
void delete(Long[] ids);
|
||||
|
||||
void confirm(JSONObject form);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class StIvtMoreorlessmstCp implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime create_time;
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 审核人
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessdtlCp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 损溢单明细表 Mapper 接口
|
||||
@@ -13,4 +18,6 @@ import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreo
|
||||
*/
|
||||
public interface StIvtMoreorlessdtlCpMapper extends BaseMapper<StIvtMoreorlessdtlCp> {
|
||||
|
||||
List<Map> getMlDtl(@Param("map") JSONObject map);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,4 +2,19 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.mapper.StIvtMoreorlessdtlCpMapper">
|
||||
|
||||
<select id="getMlDtl" resultType="java.util.Map">
|
||||
SELECT
|
||||
dtl.*,
|
||||
mb.material_code,
|
||||
mb.material_name
|
||||
FROM
|
||||
st_ivt_moreorlessdtl_cp dtl
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dtl.material_id
|
||||
<where>
|
||||
<if test="map.mol_id != null and map.mol_id != ''">
|
||||
dtl.mol_id = #{map.mol_id}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessmstCp;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.moveOrLess.dto.MoreOrlessQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +19,6 @@ import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreo
|
||||
*/
|
||||
public interface StIvtMoreorlessmstCpMapper extends BaseMapper<StIvtMoreorlessmstCp> {
|
||||
|
||||
List<Map> getMstDetail(@Param("query") MoreOrlessQuery query, @Param("pageQuery") PageQuery pageQuery);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.mapper.StIvtMoreorlessmstCpMapper">
|
||||
<select id="getMstDetail" resultType="java.util.Map">
|
||||
SELECT
|
||||
mst.*,
|
||||
a.total_qty,
|
||||
a.struct_name,
|
||||
sa.struct_code,
|
||||
sa.struct_id,
|
||||
sa.sect_id,
|
||||
sa.sect_name
|
||||
FROM
|
||||
st_ivt_moreorlessmst_cp mst
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
dtl.struct_name,
|
||||
dtl.struct_id,
|
||||
SUM( dtl.mol_qty ) AS total_qty,
|
||||
dtl.mol_id
|
||||
FROM
|
||||
st_ivt_moreorlessdtl_yl dtl
|
||||
GROUP BY
|
||||
dtl.struct_name,
|
||||
dtl.mol_id,
|
||||
dtl.struct_id
|
||||
) a ON a.mol_id = mst.mol_id
|
||||
LEFT JOIN st_ivt_structattr sa ON sa.struct_id = a.struct_id
|
||||
<where>
|
||||
mst.is_delete = '0'
|
||||
<if test="query.start_time != null">
|
||||
and mst.create_time >= #{query.start_time}
|
||||
</if>
|
||||
<if test="query.end_time != null">
|
||||
and #{query.end_time} >= mst.create_time
|
||||
</if>
|
||||
<if test="query.stor_id != null and query.stor_id != ''">
|
||||
and mst.stor_id = #{query.stor_id}
|
||||
</if>
|
||||
<if test="query.status != null and query.status != ''">
|
||||
and mst.status = #{query.status}
|
||||
</if>
|
||||
<if test="query.mol_inv_type != null and query.mol_inv_type != ''">
|
||||
and mst.mol_inv_type = #{query.mol_inv_type}
|
||||
</if>
|
||||
<if test="query.mol_code != null and query.mol_code != ''">
|
||||
and mst.mol_code = #{query.mol_code}
|
||||
</if>
|
||||
<if test="query.mol_type != null and query.mol_type != ''">
|
||||
and mst.mol_type = #{query.mol_type}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,11 +1,31 @@
|
||||
package org.nl.wms.storage_manage.productmanage.service.moreOrLess.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtSectattrService;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtSectattr;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.IStIvtMoreorlessdtlCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessdtlCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessmstCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.mapper.StIvtMoreorlessdtlCpMapper;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.moveOrLess.dao.StIvtMoreorlessdtlYl;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.moveOrLess.dao.StIvtMoreorlessmstYl;
|
||||
import org.nl.wms.storage_manage.semimanage.MLEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 损溢单明细表 服务实现类
|
||||
@@ -17,4 +37,57 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class StIvtMoreorlessdtlCpServiceImpl extends ServiceImpl<StIvtMoreorlessdtlCpMapper, StIvtMoreorlessdtlCp> implements IStIvtMoreorlessdtlCpService {
|
||||
|
||||
@Autowired
|
||||
private IStIvtSectattrService sectattrService; // 库区属性服务
|
||||
|
||||
@Autowired
|
||||
private IStIvtStructattrService structattrService; // 仓位属性服务
|
||||
|
||||
@Override
|
||||
public List<Map> getMlDtl(JSONObject form) {
|
||||
return this.baseMapper.getMlDtl(form);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double create(JSONArray rows, StIvtMoreorlessmstCp mst) {
|
||||
double total_qty = 0;
|
||||
|
||||
if (rows.size() > 0 && ObjectUtil.isNotEmpty(mst)) {
|
||||
// 先删除在插入
|
||||
this.remove(new QueryWrapper<StIvtMoreorlessdtlCp>().eq("mol_id", mst.getMol_id()));
|
||||
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
String mol_dtl_id = IdUtil.getStringId();
|
||||
StIvtMoreorlessdtlCp row = rows.getJSONObject(i).toJavaObject(StIvtMoreorlessdtlCp.class);
|
||||
row.setMol_dtl_id(mol_dtl_id);
|
||||
row.setMol_id(mst.getMol_id());
|
||||
row.setMol_code(mst.getMol_code());
|
||||
row.setSeq_no(BigDecimal.valueOf(i + 1));
|
||||
|
||||
// 获取库区信息
|
||||
QueryWrapper<StIvtSectattr> sect_wrapper = new QueryWrapper<>();
|
||||
sect_wrapper.eq("sect_id", row.getSect_id());
|
||||
sect_wrapper.eq("is_used", true);
|
||||
StIvtSectattr sectDao = sectattrService.getOne(sect_wrapper);
|
||||
if (ObjectUtil.isEmpty(sectDao)) throw new BadRequestException("库区不存在或未启用!");
|
||||
row.setSect_name(sectDao.getSect_name());
|
||||
// 获取仓位信息
|
||||
QueryWrapper<StIvtStructattr> struct_wrapper = new QueryWrapper<>();
|
||||
struct_wrapper.eq("struct_id", row.getStruct_id());
|
||||
struct_wrapper.eq("is_used", true);
|
||||
StIvtStructattr structDao = structattrService.getOne(struct_wrapper);
|
||||
if (ObjectUtil.isEmpty(structDao)) throw new BadRequestException("仓位不存在或未启用!");
|
||||
row.setStruct_name(structDao.getStruct_name());
|
||||
|
||||
row.setStoragevehicle_id("999999");
|
||||
row.setStoragevehicle_code("999999");
|
||||
row.setStatus(MLEnum.DTL_STATUS.code("生成"));
|
||||
this.save(row);
|
||||
|
||||
//锁定货位
|
||||
structattrService.update(new UpdateWrapper<StIvtStructattr>().set("lock_type", "1").set("inv_code",mst.getMol_code()).eq("struct_id", row.getStruct_id()));
|
||||
}
|
||||
}
|
||||
return total_qty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,48 @@
|
||||
package org.nl.wms.storage_manage.productmanage.service.moreOrLess.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.jsonwebtoken.lang.Assert;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtBsrealstorattrService;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtBsrealstorattr;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
|
||||
import org.nl.wms.storage_manage.CHECKEnum;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.IStIvtMoreorlessdtlCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.IStIvtMoreorlessmstCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessdtlCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessmstCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.mapper.StIvtMoreorlessmstCpMapper;
|
||||
import org.nl.wms.storage_manage.productmanage.service.structIvt.IStIvtStructivtCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.structIvt.dao.StIvtStructivtCp;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.moveOrLess.dao.StIvtMoreorlessdtlYl;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.moveOrLess.dao.StIvtMoreorlessmstYl;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.moveOrLess.dto.MoreOrlessQuery;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.StIvtStructivtYl;
|
||||
import org.nl.wms.storage_manage.semimanage.MLEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 损溢单主表 服务实现类
|
||||
@@ -17,4 +54,193 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class StIvtMoreorlessmstCpServiceImpl extends ServiceImpl<StIvtMoreorlessmstCpMapper, StIvtMoreorlessmstCp> implements IStIvtMoreorlessmstCpService {
|
||||
|
||||
@Autowired
|
||||
private IStIvtMoreorlessdtlCpService iStIvtMoreorlessdtlCpService; // 损益明细服务
|
||||
|
||||
@Autowired
|
||||
private IStIvtBsrealstorattrService stIvtBsrealstorattrService; // 实物属性服务
|
||||
|
||||
@Autowired
|
||||
private IStIvtStructivtCpService iStIvtStructivtCpService; // 库存服务
|
||||
|
||||
@Autowired
|
||||
private IStIvtStructattrService structattrService; // 仓位属性服务
|
||||
|
||||
@Override
|
||||
public Object pageQuery(MoreOrlessQuery query, PageQuery pageQuery) {
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
List<Map> mst_detail = this.baseMapper.getMstDetail(query, pageQuery);
|
||||
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
|
||||
build.setTotalElements(page.getTotal());
|
||||
return build;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(JSONObject form) {
|
||||
JSONArray rows = form.getJSONArray("tableData");
|
||||
if (ObjectUtil.isEmpty(rows)) throw new BadRequestException("请求参数不能为空");
|
||||
|
||||
// 调用主表 插入/更新方法
|
||||
StIvtMoreorlessmstCp mlmstCP = packageMstForm(new StIvtMoreorlessmstCp(), form);
|
||||
this.save(mlmstCP);
|
||||
|
||||
//调用明细表 插入方法
|
||||
iStIvtMoreorlessdtlCpService.create(rows, mlmstCP);
|
||||
|
||||
if (form.containsKey("auto_confirm") && form.getString("auto_confirm").equals("1")) {
|
||||
JSONObject mst = new JSONObject();
|
||||
mst.put("mol_id", mlmstCP.getMol_id());
|
||||
this.confirm(mst);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> getMlDtl(JSONObject map) {
|
||||
return iStIvtMoreorlessdtlCpService.getMlDtl(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(JSONObject form) {
|
||||
Assert.notNull(new Object[]{form, form.get("mol_id")}, "请求参数不能为空");
|
||||
StIvtMoreorlessmstCp mst = form.toJavaObject(StIvtMoreorlessmstCp.class);
|
||||
this.updateById(mst);
|
||||
|
||||
JSONArray rows = form.getJSONArray("tableData");
|
||||
if (ObjectUtil.isEmpty(rows)) throw new BadRequestException("请求参数不能为空");
|
||||
// 调用明细表 插入/更新方法
|
||||
iStIvtMoreorlessdtlCpService.create(rows, mst);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
StIvtMoreorlessmstCp dao = this.getOne(new QueryWrapper<StIvtMoreorlessmstCp>().eq("mol_id", id));
|
||||
dao.setIs_delete(true);
|
||||
this.updateById(dao);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirm(JSONObject whereJson) {
|
||||
|
||||
String mol_id = (String) whereJson.get("mol_id");
|
||||
|
||||
StIvtMoreorlessmstCp mst = this.getOne(new QueryWrapper<StIvtMoreorlessmstCp>().eq("mol_id", mol_id));
|
||||
|
||||
if (!mst.getStatus().equals(MLEnum.BILL_STATUS.code("生成"))) {
|
||||
throw new BadRequestException("请选择单据状态为生成的损溢单!");
|
||||
}
|
||||
|
||||
String mol_type = mst.getMol_type();
|
||||
|
||||
List<StIvtMoreorlessdtlCp> dtl_list = iStIvtMoreorlessdtlCpService.list(new QueryWrapper<StIvtMoreorlessdtlCp>().eq("mol_id", mol_id));
|
||||
//更新库存
|
||||
if (mol_type.equals(MLEnum.MOL_TYPE.code("损"))) {
|
||||
dtl_list.forEach(dtl -> {
|
||||
StIvtStructivtCp ivt = iStIvtStructivtCpService.getOne(new QueryWrapper<StIvtStructivtCp>().eq("struct_id", dtl.getStruct_id()).eq("material_id", dtl.getMaterial_id()));
|
||||
if (ObjectUtil.isEmpty(ivt)) {
|
||||
throw new BadRequestException("未查询到相关库存!");
|
||||
}
|
||||
BigDecimal canuse_qty = ivt.getCanuse_qty();
|
||||
BigDecimal ivt_qty = ivt.getIvt_qty();
|
||||
BigDecimal mol_qty = dtl.getMol_qty();
|
||||
ivt.setCanuse_qty(NumberUtil.sub(canuse_qty, mol_qty));
|
||||
ivt.setIvt_qty(NumberUtil.sub(ivt_qty, mol_qty));
|
||||
//如果库存变为0则删除记录
|
||||
if (canuse_qty.compareTo(mol_qty) == 0 && canuse_qty.compareTo(ivt_qty) == 0) {
|
||||
iStIvtStructivtCpService.removeById(ivt.getStockrecord_id());
|
||||
} else {
|
||||
iStIvtStructivtCpService.updateById(ivt);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
dtl_list.forEach(dtl -> {
|
||||
StIvtStructivtCp ivt = iStIvtStructivtCpService.getOne(new QueryWrapper<StIvtStructivtCp>().eq("struct_id", dtl.getStruct_id()).eq("material_id", dtl.getMaterial_id()));
|
||||
BigDecimal mol_qty = dtl.getMol_qty();
|
||||
|
||||
if (ObjectUtil.isEmpty(ivt)) {
|
||||
StIvtStructattr struct_jo = structattrService.getOne(new QueryWrapper<StIvtStructattr>().eq("struct_id", dtl.getStruct_id()));
|
||||
//新增一条库存记录
|
||||
iStIvtStructivtCpService.save(new StIvtStructivtCp()
|
||||
.setStockrecord_id(IdUtil.getStringId())
|
||||
.setStruct_id(dtl.getStruct_id())
|
||||
.setStruct_code(struct_jo.getStruct_code())
|
||||
.setStruct_name(struct_jo.getStruct_name())
|
||||
.setMaterial_id(dtl.getMaterial_id())
|
||||
.setQuality_scode(dtl.getQuality_scode())
|
||||
.setPcsn(dtl.getPcsn())
|
||||
.setIvt_level(dtl.getIvt_level())
|
||||
.setIs_active(dtl.getIs_active())
|
||||
.setCanuse_qty(mol_qty)
|
||||
.setIvt_qty(mol_qty)
|
||||
.setQty_unit_id(dtl.getQty_unit_id())
|
||||
.setInstorage_time(DateUtil.now())
|
||||
.setStor_id(mst.getStor_id())
|
||||
);
|
||||
} else {
|
||||
BigDecimal canuse_qty = ivt.getCanuse_qty();
|
||||
BigDecimal ivt_qty = ivt.getIvt_qty();
|
||||
ivt.setCanuse_qty(NumberUtil.add(canuse_qty, mol_qty));
|
||||
ivt.setIvt_qty(NumberUtil.add(ivt_qty, mol_qty));
|
||||
iStIvtStructivtCpService.updateById(ivt);
|
||||
}
|
||||
|
||||
//更新明细状态
|
||||
dtl.setStatus(MLEnum.DTL_STATUS.code("确认完成"));
|
||||
iStIvtMoreorlessdtlCpService.updateById(dtl);
|
||||
});
|
||||
}
|
||||
|
||||
dtl_list.stream().map(dtl -> dtl.getStruct_id())
|
||||
.distinct()
|
||||
.forEach(struct_id -> structattrService.update(new UpdateWrapper<StIvtStructattr>().set("lock_type", "0").set("inv_code", "").eq("struct_id", struct_id)));
|
||||
|
||||
//更新损溢单主表
|
||||
mst.setStatus(MLEnum.BILL_STATUS.code("完成"));
|
||||
mst.setConfirm_optid(SecurityUtils.getCurrentUserId());
|
||||
mst.setConfirm_optname(SecurityUtils.getCurrentNickName());
|
||||
mst.setConfirm_time(DateUtil.now());
|
||||
this.updateById(mst);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private StIvtMoreorlessmstCp packageMstForm(StIvtMoreorlessmstCp mlmstCP, JSONObject whereJson) {
|
||||
JSONArray rows = whereJson.getJSONArray("tableData");
|
||||
// 新增
|
||||
mlmstCP.setMol_id(IdUtil.getStringId());
|
||||
mlmstCP.setMol_code(CodeUtil.getNewCode("MOL_CODE"));
|
||||
if (StrUtil.isEmpty(whereJson.getString("buss_type"))) {
|
||||
mlmstCP.setBuss_type(MLEnum.BILL_TYPE.code("普通损溢"));
|
||||
mlmstCP.setMol_inv_type(MLEnum.BILL_TYPE.code("普通损溢"));
|
||||
} else {
|
||||
mlmstCP.setBuss_type(whereJson.getString("buss_type"));
|
||||
mlmstCP.setMol_inv_type(whereJson.getString("buss_type"));
|
||||
}
|
||||
|
||||
mlmstCP.setMol_type(whereJson.getString("mol_type"));
|
||||
|
||||
// 获取仓库信息
|
||||
QueryWrapper<StIvtBsrealstorattr> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("stor_id", whereJson.getString("stor_id"));
|
||||
wrapper.eq("is_used", true);
|
||||
StIvtBsrealstorattr bsrealDao = stIvtBsrealstorattrService.getOne(wrapper);
|
||||
if (ObjectUtil.isEmpty(bsrealDao)) throw new BadRequestException("仓库不存在或未启用!");
|
||||
|
||||
mlmstCP.setStor_id(bsrealDao.getStor_id());
|
||||
mlmstCP.setStor_name(bsrealDao.getStor_name());
|
||||
mlmstCP.setDtl_num(BigDecimal.valueOf(rows.size()));
|
||||
mlmstCP.setCreate_mode(CHECKEnum.CREATE_MODE.code("PC产生"));
|
||||
mlmstCP.setStatus(CHECKEnum.BILL_STATUS.code("生成"));
|
||||
mlmstCP.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
mlmstCP.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
mlmstCP.setCreate_time(DateUtil.now());
|
||||
mlmstCP.setIs_delete(false);
|
||||
// TODO 暂时写死
|
||||
mlmstCP.setSysdeptid("111");
|
||||
mlmstCP.setSyscompanyid("111");
|
||||
|
||||
mlmstCP.setRemark(whereJson.getString("remark"));
|
||||
|
||||
return mlmstCP;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.structIvt.dao.StIvtStructivtCp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -46,5 +47,5 @@ public interface IStIvtStructivtCpService extends IService<StIvtStructivtCp> {
|
||||
* 明细row
|
||||
* }
|
||||
*/
|
||||
List getStructIvt(JSONObject whereJson);
|
||||
List<Map> getStructIvt(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
@@ -17,6 +18,7 @@ import java.math.BigDecimal;
|
||||
* @since 2023-05-04
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("st_ivt_structivt_cp")
|
||||
public class StIvtStructivtCp implements Serializable {
|
||||
|
||||
@@ -28,10 +28,18 @@
|
||||
|
||||
<select id="getStructIvt" resultType="java.util.Map">
|
||||
SELECT
|
||||
ivt.*
|
||||
ivt.*,
|
||||
attr.sect_name,
|
||||
attr.struct_code,
|
||||
attr.storagevehicle_code,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
unit.unit_name AS qty_unit_name
|
||||
FROM
|
||||
ST_IVT_StructIvt_CP ivt
|
||||
LEFT JOIN st_ivt_structattr attr ON ivt.struct_id = attr.struct_id
|
||||
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = mater.base_unit_id
|
||||
WHERE attr.lock_type = '0'
|
||||
<if test="stor_id != null and stor_id != ''">
|
||||
and attr.stor_id = #{stor_id}
|
||||
@@ -45,6 +53,11 @@
|
||||
<if test="sale_id != null and sale_id != ''">
|
||||
and ivt.sale_id = #{sale_id}
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
and attr.struct_code LIKE #{remark} OR
|
||||
(attr.struct_name LIKE #{remark}) OR
|
||||
(attr.storagevehicle_code LIKE #{remark})
|
||||
</if>
|
||||
order by ivt.canuse_qty ASC,ivt.struct_code ASC
|
||||
|
||||
</select>
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -87,7 +88,7 @@ public class StIvtStructivtCpServiceImpl extends ServiceImpl<StIvtStructivtCpMap
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getStructIvt(JSONObject whereJson) {
|
||||
public List<Map> getStructIvt(JSONObject whereJson) {
|
||||
return baseMapper.getStructIvt(whereJson);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
<item spec="22" value="A1_HCX_02"></item>
|
||||
</param>
|
||||
</flow>
|
||||
<flow id="A1_TWYTJ" name="推弯一体工序" sourceRef="A1_JGXL" targetRef="A1_SKQX">
|
||||
<flow id="A1_TWYTJ" name="推弯一体工序" sourceRef="A1_JGXL" targetRef="A1_TK">
|
||||
|
||||
</flow>
|
||||
<flow id="A1_TK" name="镗孔" sourceRef="A1_TWYTJ" targetRef="A1_SKQX"></flow>
|
||||
|
||||
<flow id="A1_SKQX" name="深坑清洗" sourceRef="A1_TWYTJ" targetRef="end"></flow>
|
||||
<end id="end" name="Junior Reject End" sourceRef="A1_SKQX"></end>
|
||||
</process>
|
||||
|
||||
@@ -15,13 +15,28 @@
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<span>
|
||||
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
|
||||
<el-button
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
:loading="crud.cu === 2"
|
||||
type="primary"
|
||||
@click="crud.submitCU"
|
||||
>保存</el-button>
|
||||
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="85px" label-suffix=":">
|
||||
<el-form
|
||||
ref="form"
|
||||
style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;"
|
||||
:inline="true"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
size="mini"
|
||||
label-width="85px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="单据号" prop="bill_code">
|
||||
<label slot="label">单 据 号:</label>
|
||||
<el-input v-model.trim="form.bill_code" disabled placeholder="系统生成" clearable style="width: 210px"/>
|
||||
@@ -84,7 +99,13 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<label slot="label">备 注:</label>
|
||||
<el-input v-model.trim="form.remark" style="width: 380px;" rows="2" type="textarea" :disabled="crud.status.view > 0" />
|
||||
<el-input
|
||||
v-model.trim="form.remark"
|
||||
style="width: 380px;"
|
||||
rows="2"
|
||||
type="textarea"
|
||||
:disabled="crud.status.view > 0"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@@ -128,85 +149,27 @@
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="55" align="center"/>
|
||||
<el-table-column show-overflow-tooltip prop="storagevehicle_code" label="载具号" align="center" width="150px">
|
||||
<el-table-column prop="material_code" label="物料编码" align="center" min-width="200" show-overflow-tooltip>
|
||||
<template scope="scope">
|
||||
<el-input v-show="!scope.row.edit && scope.row.is_add" v-model="scope.row.storagevehicle_code" size="mini" />
|
||||
<span v-show="scope.row.edit">{{ scope.row.storagevehicle_code }}</span>
|
||||
<span v-show="!scope.row.edit && !scope.row.is_add">{{ scope.row.storagevehicle_code }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column show-overflow-tooltip prop="bucketunique" label="桶号" width="190" align="center">
|
||||
<template scope="scope">
|
||||
<el-input v-show="!scope.row.edit && scope.row.is_add" v-model="scope.row.bucketunique" disabled class="input-with-select">
|
||||
<el-button slot="append" icon="el-icon-plus" @click="queryBucket(scope.$index, scope.row)" />
|
||||
<el-input v-show="!scope.row.edit" v-model="scope.row.material_code" disabled class="input-with-select">
|
||||
<el-button slot="append" icon="el-icon-search" @click="queryMater(scope.$index, scope.row)"/>
|
||||
</el-input>
|
||||
<span v-show="scope.row.edit">{{ scope.row.bucketunique }}</span>
|
||||
<span v-show="!scope.row.edit && !scope.row.is_add">{{ scope.row.bucketunique }}</span>
|
||||
<span v-show="scope.row.edit">{{ scope.row.material_code }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="material_code" label="物料编码" align="center" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="material_name" label="物料名称" align="center" min-width="200" show-overflow-tooltip/>
|
||||
<el-table-column prop="pcsn" label="批次号" align="center" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="quality_scode" label="品质类型" align="center" width="150px">
|
||||
<template slot-scope="scope">
|
||||
<el-select
|
||||
v-model="scope.row.quality_scode"
|
||||
size="mini"
|
||||
clearable
|
||||
class="filter-item"
|
||||
disabled
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.ST_QUALITY_SCODE"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="ivt_level" label="库存等级" align="center" width="150px">
|
||||
<template slot-scope="scope">
|
||||
<el-select
|
||||
v-model="scope.row.ivt_level"
|
||||
size="mini"
|
||||
clearable
|
||||
class="filter-item"
|
||||
placeholder="无"
|
||||
disabled
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.ST_IVT_LEVEL"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_active" label="是否可用" align="center" width="150px">
|
||||
<template slot-scope="scope">
|
||||
<el-select
|
||||
v-model="scope.row.is_active"
|
||||
size="mini"
|
||||
clearable
|
||||
class="filter-item"
|
||||
placeholder="无"
|
||||
disabled
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.is_used"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="ivt_qty" label="库存重量" align="center" :formatter="crud.formatNum3" />
|
||||
<el-table-column v-if="!crud.status.view > 0" prop="ivt_qty" label="库存重量" align="center"
|
||||
:formatter="crud.formatNum3"/>
|
||||
<el-table-column prop="mol_qty" width="220" label="损溢重量" align="center">
|
||||
<template scope="scope">
|
||||
<el-input-number v-model="scope.row.mol_qty" :disabled="scope.row.edit" :precision="3" :controls="false" :min="0" style="width: 120px" />
|
||||
<el-input-number
|
||||
v-model="scope.row.mol_qty"
|
||||
:disabled="scope.row.edit"
|
||||
:precision="3"
|
||||
:controls="false"
|
||||
:min="0"
|
||||
style="width: 120px"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="qty_unit_name" label="单位" align="center"/>
|
||||
@@ -241,9 +204,8 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<MaterDtl :dialog-show.sync="materShow" :dialog-matertype="materType" @tableChanged2="tableChanged2" />
|
||||
<MaterDtl :dialog-show.sync="materShow" @setMaterValue="tableChanged2"/>
|
||||
<StructDiv ref="child" :dialog-show.sync="structShow" @tableChanged="tableChanged"/>
|
||||
<BucketDialog :dialog-show.sync="bucketShow" @bucketChange="tableChanged2" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@@ -251,7 +213,7 @@
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import BucketDialog from '@/views/wms/storage_manage/product/productMoreOrless/NewBucketDialog'
|
||||
import CRUD, {crud, form} from '@crud/crud'
|
||||
import crudStorattr from '@/api/wms/basedata/st/storattr'
|
||||
import crudStorattr from '@/views/wms/storage_manage/basedata/basedata'
|
||||
import crudMoreOrless from '@/views/wms/storage_manage/product/productMoreOrless/moreorless'
|
||||
import MaterDtl from '@/views/wms/pub/MaterDialog'
|
||||
import StructDiv from '@/views/wms/storage_manage/product/productMoreOrless/StructDiv'
|
||||
@@ -322,31 +284,30 @@ export default {
|
||||
methods: {
|
||||
open() {
|
||||
// 查询原材料库的仓库
|
||||
crudStorattr.getStor({ 'is_materialstore': '1' }).then(res => {
|
||||
crudStorattr.getStor({'stor_type': '3'}).then(res => {
|
||||
this.storlist = res.content
|
||||
})
|
||||
},
|
||||
[CRUD.HOOK.afterToEdit]() {
|
||||
// 获取入库单明细
|
||||
crudMoreOrless.queryMolDtl({ 'mol_id': this.form.mol_id, 'struct_id': this.form.struct_id }).then(res => {
|
||||
crudMoreOrless.getMlDtl({'mol_id': this.form.mol_id}).then(res => {
|
||||
this.form.tableData = res
|
||||
// 将明细变成不可编辑
|
||||
for (let i = 0; i < this.form.tableData.length; i++) {
|
||||
const row = this.form.tableData[i]
|
||||
row.isadd = false
|
||||
row.edit = true
|
||||
this.$set(row, 'edit', false)
|
||||
this.form.tableData.splice(i, 1, row)
|
||||
}
|
||||
})
|
||||
},
|
||||
[CRUD.HOOK.afterToView]() {
|
||||
this.mater_btn = true
|
||||
crudMoreOrless.queryMolDetail({ 'mol_id': this.form.mol_id, 'struct_id': this.form.struct_id }).then(res => {
|
||||
crudMoreOrless.getMlDtl({ 'mol_id': this.form.mol_id }).then(res => {
|
||||
this.form.tableData = res
|
||||
// 将明细变成不可编辑
|
||||
for (let i = 0; i < this.form.tableData.length; i++) {
|
||||
const row = this.form.tableData[i]
|
||||
row.edit = true
|
||||
this.$set(row, 'edit', true)
|
||||
this.form.tableData.splice(i, 1, row)
|
||||
}
|
||||
})
|
||||
@@ -399,17 +360,16 @@ export default {
|
||||
},
|
||||
tableChanged2(row) {
|
||||
// 新增一行物料时,给行进行赋值
|
||||
this.nowrow.material_code = row.material_code
|
||||
this.nowrow.material_id = row.material_id
|
||||
this.nowrow.material_name = row.material_name
|
||||
this.nowrow.qty_unit_id = row.qty_unit_id
|
||||
this.nowrow.qty_unit_name = row.qty_unit_name
|
||||
this.nowrow.quality_scode = row.quality_scode
|
||||
this.nowrow.is_active = row.is_active
|
||||
this.nowrow.ivt_level = row.ivt_level
|
||||
this.nowrow.pcsn = row.pcsn
|
||||
this.nowrow.mol_qty = row.storage_qty
|
||||
this.nowrow.bucketunique = row.bucketunique
|
||||
this.$set(this.nowrow, 'material_code', row.material_code)
|
||||
this.$set(this.nowrow, 'material_id', row.material_id)
|
||||
this.$set(this.nowrow, 'material_name', row.material_name)
|
||||
this.$set(this.nowrow, 'qty_unit_id', row.base_unit_id)
|
||||
this.$set(this.nowrow, 'qty_unit_name', row.base_unit_name)
|
||||
this.$set(this.nowrow, 'struct_id', this.form.struct_id)
|
||||
this.$set(this.nowrow, 'struct_code', this.form.struct_code)
|
||||
this.$set(this.nowrow, 'sect_id', this.form.sect_id)
|
||||
this.$set(this.nowrow, 'sect_name', this.form.sect_name)
|
||||
this.$set(this.nowrow, 'struct_name', this.form.struct_name)
|
||||
this.form.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
|
||||
},
|
||||
tableChanged(row) {
|
||||
@@ -420,6 +380,11 @@ export default {
|
||||
this.form.struct_name = row.struct_name
|
||||
crudMoreOrless.getStructIvt({'struct_id': row.struct_id}).then(res => {
|
||||
this.form.tableData = res
|
||||
for (let i = 0; i < this.form.tableData.length; i++) {
|
||||
const row = this.form.tableData[i]
|
||||
this.$set(row, 'edit', false)
|
||||
this.form.tableData.splice(i, 1, row)
|
||||
}
|
||||
this.form.dtl_num = this.form.tableData.length
|
||||
})
|
||||
},
|
||||
@@ -443,7 +408,15 @@ export default {
|
||||
this.nowrow = row
|
||||
},
|
||||
async insertdtl() {
|
||||
this.form.tableData.push({ quality_scode: '02', ivt_qty: 0, mol_qty: 0, is_active: '1', ivt_level: '01', edit: false, is_add: true })
|
||||
this.form.tableData.push({
|
||||
quality_scode: '02',
|
||||
ivt_qty: 0,
|
||||
mol_qty: 0,
|
||||
is_active: '1',
|
||||
ivt_level: '01',
|
||||
edit: false,
|
||||
is_add: true
|
||||
})
|
||||
this.form.dtl_num = this.form.tableData.length
|
||||
},
|
||||
typeChange(val) {
|
||||
@@ -461,7 +434,7 @@ export default {
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
if (!row.edit) {
|
||||
if (parseFloat(row.mol_qty) <= 0) {
|
||||
if (typeof (row.mol_qty) === 'undefined' | (parseFloat(row.mol_qty) <= 0)) {
|
||||
this.crud.notify('不允许损溢数量为0!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
@@ -469,18 +442,6 @@ export default {
|
||||
this.crud.notify('物料不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (!row.storagevehicle_code) {
|
||||
this.crud.notify('载具号不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (!row.bucketunique) {
|
||||
this.crud.notify('桶号不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (!row.pcsn) {
|
||||
this.crud.notify('批次不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (this.form.mol_type === '0' && (parseFloat(row.ivt_qty) < parseFloat(row.mol_qty))) {
|
||||
this.crud.notify('不允许损数量大于库存数量!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
placeholder="输入货位编码、名称"
|
||||
prefix-icon="el-icon-search"
|
||||
class="filter-item"
|
||||
/> </el-col>
|
||||
/>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="6">
|
||||
<rrOperation/>
|
||||
@@ -122,7 +123,7 @@ export default {
|
||||
methods: {
|
||||
open() {
|
||||
this.crud.resetQuery(false)
|
||||
crudSectattr.getSect({ 'is_materialstore': '1' }).then(res => {
|
||||
crudSectattr.getSect({ 'stor_type': '3' }).then(res => {
|
||||
this.sects = res.content
|
||||
})
|
||||
if (this.sect) {
|
||||
@@ -192,23 +193,10 @@ export default {
|
||||
return
|
||||
}
|
||||
// 溢单不允许选择已锁定或者有载具的货位
|
||||
if (this.mol_type === '1') {
|
||||
if (this.checkrow.lock_type !== '00') {
|
||||
this.$message('溢单不允许选择已锁定的货位!')
|
||||
if (this.checkrow.lock_type !== '0') {
|
||||
this.$message('不允许选择已锁定的货位!')
|
||||
return
|
||||
}
|
||||
}
|
||||
// 损单不允许选择已锁定或者无载具的货位
|
||||
if (this.mol_type === '0') {
|
||||
if (this.checkrow.lock_type !== '00') {
|
||||
this.$message('损单不允许选择已锁定的货位!')
|
||||
return
|
||||
}
|
||||
if (this.checkrow.storagevehicle_code === '') {
|
||||
this.$message('损单不允许选择无载具的货位!')
|
||||
return
|
||||
}
|
||||
}
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('tableChanged', this.checkrow)
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="模糊查询">
|
||||
<el-form-item label="单据编号">
|
||||
<el-input
|
||||
v-model="query.struct_search"
|
||||
v-model="query.mol_code"
|
||||
size="mini"
|
||||
clearable
|
||||
placeholder="货位编码、名称"
|
||||
placeholder="单据编号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
<el-form-item label="单据状态">
|
||||
<el-select
|
||||
v-model="query.bill_status"
|
||||
v-model="query.status"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="单据状态"
|
||||
@@ -77,7 +77,7 @@
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.mol_bill_status"
|
||||
v-for="item in dict.MOL_BILL_STATUS"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
@@ -149,8 +149,8 @@
|
||||
<el-table-column :formatter="stateFormat" min-width="100" prop="status" label="单据状态" />
|
||||
<el-table-column label="备注" align="center" min-width="100" prop="remark" />
|
||||
<el-table-column prop="create_mode" min-width="100" :formatter="create_modeFormat" label="生成方式" />
|
||||
<el-table-column label="制单人" align="center" min-width="100" prop="input_optname" />
|
||||
<el-table-column label="制单时间" align="center" prop="input_time" min-width="150" />
|
||||
<el-table-column label="制单人" align="center" min-width="100" prop="create_name" />
|
||||
<el-table-column label="制单时间" align="center" prop="create_time" min-width="150" />
|
||||
<el-table-column label="确认人" align="center" prop="confirm_optname" min-width="150" />
|
||||
<el-table-column label="确认时间" align="center" prop="confirm_time" min-width="150" />
|
||||
</el-table>
|
||||
@@ -170,10 +170,11 @@ import pagination from '@crud/Pagination'
|
||||
import DateRangePicker from '@/components/DateRangePicker/index'
|
||||
import AddDialog from '@/views/wms/storage_manage/product/productMoreOrless/AddDialog'
|
||||
import { mapGetters } from 'vuex'
|
||||
import crudStorattr from '@/api/wms/basedata/st/storattr'
|
||||
import crudStorattr from '@/views/wms/storage_manage/basedata/basedata'
|
||||
import crudMoreOrless from '@/views/wms/storage_manage/product/productMoreOrless/moreorless'
|
||||
|
||||
export default {
|
||||
name: 'MoreOrLess',
|
||||
name: 'RawProductMl',
|
||||
components: { AddDialog, crudOperation, rrOperation, udOperation, pagination, DateRangePicker },
|
||||
cruds() {
|
||||
return CRUD({
|
||||
@@ -184,13 +185,13 @@ export default {
|
||||
size: 20
|
||||
},
|
||||
idField: 'mol_id',
|
||||
url: '/api/instor/mol',
|
||||
url: '/api/stIvtMoreorlessmstCp',
|
||||
crudMethod: { ...crudMoreOrless }
|
||||
})
|
||||
},
|
||||
mixins: [presenter(), header(), crud()],
|
||||
// 数据字典
|
||||
dicts: ['mol_bill_status', 'ST_CREATE_MODE', 'ST_MOL_TYPE'],
|
||||
dicts: ['MOL_BILL_STATUS', 'ST_CREATE_MODE', 'ST_MOL_TYPE'],
|
||||
data() {
|
||||
return {
|
||||
height: document.documentElement.clientHeight - 180 + 'px;',
|
||||
@@ -217,7 +218,7 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudStorattr.getStor({ 'is_materialstore': '1' }).then(res => {
|
||||
crudStorattr.getStor({ 'stor_type': '3' }).then(res => {
|
||||
this.storlist = res.content
|
||||
})
|
||||
},
|
||||
@@ -266,7 +267,7 @@ export default {
|
||||
}
|
||||
},
|
||||
stateFormat(row, column) {
|
||||
return this.dict.label.mol_bill_status[row.status]
|
||||
return this.dict.label.MOL_BILL_STATUS[row.status]
|
||||
},
|
||||
typeFormat(row, column) {
|
||||
return this.dict.label.ST_MOL_TYPE[row.mol_type]
|
||||
|
||||
@@ -2,7 +2,7 @@ import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: '/api/instor/mol',
|
||||
url: '/api/stIvtMoreorlessmstCp',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
@@ -10,50 +10,42 @@ export function add(data) {
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: '/api/instor/mol',
|
||||
method: 'delete',
|
||||
url: '/api/stIvtMoreorlessmstCp/delete',
|
||||
method: 'post',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: '/api/instor/mol',
|
||||
method: 'put',
|
||||
url: '/api/stIvtMoreorlessmstCp/update',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getStructIvt(params) {
|
||||
return request({
|
||||
url: '/api/instor/mol/getStructIvt',
|
||||
method: 'get',
|
||||
url: '/api/stIvtStructivtYl/getStructIvt',
|
||||
method: 'post',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function queryMolDtl(params) {
|
||||
export function getMlDtl(data) {
|
||||
return request({
|
||||
url: '/api/instor/mol/queryMolDtl',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function queryMolDetail(params) {
|
||||
return request({
|
||||
url: '/api/instor/mol/queryMolDetail',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function confirm(data) {
|
||||
return request({
|
||||
url: '/api/instor/mol/confirm',
|
||||
url: '/api/stIvtMoreorlessmstCp/getMlDtl',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getStructIvt, queryMolDtl, queryMolDetail, confirm }
|
||||
export function confirm(data) {
|
||||
return request({
|
||||
url: '/api/stIvtMoreorlessmstCp/confirm',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getStructIvt, getMlDtl, confirm }
|
||||
|
||||
@@ -212,7 +212,7 @@
|
||||
<el-table-column show-overflow-tooltip prop="point_code" width="150px" label="出库点" align="center" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
<StructIvt :dialog-show.sync="structshow" :stor-id="storId" :open-array="openParam" :rowmst="openRow" @StructIvtClosed="queryTableDtl" />
|
||||
<StructIvt :dialog-show.sync="structshow" :stor-id="storId" :open-array="openParam" :rowmst="openRow" @StructIvtClosed="closeDiv" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@@ -334,7 +334,12 @@ export default {
|
||||
|
||||
this.currentRow.remark = ''
|
||||
this.currentRow.stor_id = this.storId
|
||||
this.currentRow.assign_qty = 0
|
||||
productOut.getStructIvt(this.currentRow).then(res => {
|
||||
res.forEach(item => {
|
||||
item.edit = false
|
||||
})
|
||||
|
||||
this.openParam = res
|
||||
this.structshow = true
|
||||
this.openRow = this.currentRow
|
||||
@@ -361,6 +366,10 @@ export default {
|
||||
handleDisCurrentChange(current) {
|
||||
this.currentDis = current
|
||||
},
|
||||
closeDiv() {
|
||||
this.queryTableDtl()
|
||||
this.crud.notify('操作成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
},
|
||||
queryTableDtl() {
|
||||
productOut.getIosInvDtl({ 'iostorinv_id': this.mstrow.iostorinv_id }).then(res => {
|
||||
this.tableDtl = res
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="关键字" prop="remark">
|
||||
<el-input
|
||||
v-model="queryrow.remark"
|
||||
v-model="queryrow.search"
|
||||
clearable
|
||||
style="width: 220px"
|
||||
size="mini"
|
||||
@@ -82,7 +82,7 @@
|
||||
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="pcsn" label="批次号" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="canuse_qty" label="可出重量" :formatter="crud.formatNum3" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="plan_qty" label="重量" :formatter="crud.formatNum3" width="160" align="center">
|
||||
<el-table-column show-overflow-tooltip prop="plan_qty" label="出库重量" :formatter="crud.formatNum3" width="160" align="center">
|
||||
<template scope="scope">
|
||||
<el-input-number v-show="!scope.row.edit" v-model="scope.row.plan_qty" :precision="3" :max="100000000" />
|
||||
<span v-show="scope.row.edit">{{ scope.row.plan_qty }}</span>
|
||||
@@ -157,7 +157,13 @@ export default {
|
||||
queryStruct() {
|
||||
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) + parseFloat(this.queryrow.assign_qty)
|
||||
this.queryrow.assign_qty = 0
|
||||
this.queryrow.materia_id = this.rowmst.material_id
|
||||
this.queryrow.sale_id = this.rowmst.sale_id
|
||||
productOut.getStructIvt(this.queryrow).then(res => {
|
||||
res.forEach(item => {
|
||||
item.edit = false
|
||||
})
|
||||
|
||||
this.tableDtl = res
|
||||
})
|
||||
},
|
||||
@@ -217,7 +223,8 @@ export default {
|
||||
rows.push(item)
|
||||
}
|
||||
})
|
||||
checkoutbill.manualDiv({ 'row': this.queryrow, 'rows': rows }).then(res => {
|
||||
|
||||
productOut.manualDiv({ 'iostorinvdtl_id': this.queryrow.iostorinvdtl_id, 'rows': rows }).then(res => {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('StructIvtClosed')
|
||||
})
|
||||
@@ -230,7 +237,7 @@ export default {
|
||||
rows.push(item)
|
||||
}
|
||||
})
|
||||
checkoutbill.manualDiv({ 'row': this.queryrow, 'rows': rows }).then(res => {
|
||||
productOut.manualDiv({ 'iostorinvdtl_id': this.queryrow.iostorinvdtl_id, 'rows': rows }).then(res => {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('StructIvtClosed')
|
||||
})
|
||||
|
||||
@@ -80,6 +80,14 @@ export function getStructIvt(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function manualDiv(data) {
|
||||
return request({
|
||||
url: 'api/productOut/manualDiv',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
add,
|
||||
edit,
|
||||
@@ -90,5 +98,6 @@ export default {
|
||||
allCancel,
|
||||
setPoint,
|
||||
confirm,
|
||||
getStructIvt
|
||||
getStructIvt,
|
||||
manualDiv
|
||||
}
|
||||
|
||||
@@ -1,524 +0,0 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="crud.status.title"
|
||||
append-to-body
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
|
||||
fullscreen
|
||||
width="1200px"
|
||||
@open="open"
|
||||
@close="close"
|
||||
>
|
||||
<el-row v-show="crud.status.cu > 0" :gutter="20">
|
||||
<el-col :span="20" style="border: 1px solid white">
|
||||
<span />
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<span>
|
||||
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
|
||||
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="85px" label-suffix=":">
|
||||
<el-form-item label="单据号" prop="bill_code">
|
||||
<label slot="label">单 据 号:</label>
|
||||
<el-input v-model.trim="form.bill_code" disabled placeholder="系统生成" clearable style="width: 210px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库" prop="stor_id">
|
||||
<label slot="label">仓 库:</label>
|
||||
<el-select
|
||||
v-model="form.stor_id"
|
||||
clearable
|
||||
placeholder="仓库"
|
||||
class="filter-item"
|
||||
style="width: 210px"
|
||||
:disabled="crud.status.view > 0"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in storlist"
|
||||
:key="item.stor_id"
|
||||
:label="item.stor_name"
|
||||
:value="item.stor_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="损溢类型" prop="mol_type">
|
||||
<el-select
|
||||
v-model="form.mol_type"
|
||||
style="width: 210px"
|
||||
clearable
|
||||
class="filter-item"
|
||||
:disabled="crud.status.view > 0"
|
||||
@change="typeChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.ST_MOL_TYPE"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="货位" prop="struct_code">
|
||||
<label slot="label">货 位:</label>
|
||||
<el-input v-model.trim="form.struct_code" style="width: 210px" disabled placeholder="选择货位">
|
||||
<el-button v-show="crud.status.view <= 0" slot="append" icon="el-icon-plus" @click="queryStruct()" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="明细数" prop="detail_count">
|
||||
<label slot="label">明 细 数:</label>
|
||||
<el-input v-model.trim="form.dtl_num" size="mini" disabled style="width: 210px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="总重量" prop="total_qty">
|
||||
<label slot="label">总 重 量:</label>
|
||||
<el-input-number
|
||||
v-model="form.total_qty"
|
||||
:controls="false"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<label slot="label">备 注:</label>
|
||||
<el-input v-model.trim="form.remark" style="width: 380px;" rows="2" type="textarea" :disabled="crud.status.view > 0" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<div class="crud-opts2" style="margin-bottom: 5px;">
|
||||
<span class="crud-opts-right2">
|
||||
<!--左侧插槽-->
|
||||
<slot name="left" />
|
||||
<!--<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="warning"
|
||||
icon="el-icon-search"
|
||||
size="mini"
|
||||
:disabled="crud.status.view > 0"
|
||||
@click="resetTable()"
|
||||
>
|
||||
重置表格
|
||||
</el-button>-->
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="warning"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
:disabled="mater_btn"
|
||||
@click="insertdtl()"
|
||||
>
|
||||
新增一行
|
||||
</el-button>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="form.tableData"
|
||||
style="width: 100%;"
|
||||
size="mini"
|
||||
border
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="55" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="storagevehicle_code" label="载具号" align="center" width="150px">
|
||||
<template scope="scope">
|
||||
<el-input v-show="!scope.row.edit && scope.row.is_add" v-model="scope.row.storagevehicle_code" size="mini" />
|
||||
<span v-show="scope.row.edit">{{ scope.row.storagevehicle_code }}</span>
|
||||
<span v-show="!scope.row.edit && !scope.row.is_add">{{ scope.row.storagevehicle_code }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column show-overflow-tooltip prop="bucketunique" label="桶号" width="190" align="center">
|
||||
<template scope="scope">
|
||||
<el-input v-show="!scope.row.edit && scope.row.is_add" v-model="scope.row.bucketunique" disabled class="input-with-select">
|
||||
<el-button slot="append" icon="el-icon-plus" @click="queryBucket(scope.$index, scope.row)" />
|
||||
</el-input>
|
||||
<span v-show="scope.row.edit">{{ scope.row.bucketunique }}</span>
|
||||
<span v-show="!scope.row.edit && !scope.row.is_add">{{ scope.row.bucketunique }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="material_code" label="物料编码" align="center" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="material_name" label="物料名称" align="center" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="pcsn" label="批次号" align="center" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="quality_scode" label="品质类型" align="center" width="150px">
|
||||
<template slot-scope="scope">
|
||||
<el-select
|
||||
v-model="scope.row.quality_scode"
|
||||
size="mini"
|
||||
clearable
|
||||
class="filter-item"
|
||||
disabled
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.ST_QUALITY_SCODE"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="ivt_level" label="库存等级" align="center" width="150px">
|
||||
<template slot-scope="scope">
|
||||
<el-select
|
||||
v-model="scope.row.ivt_level"
|
||||
size="mini"
|
||||
clearable
|
||||
class="filter-item"
|
||||
placeholder="无"
|
||||
disabled
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.ST_IVT_LEVEL"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_active" label="是否可用" align="center" width="150px">
|
||||
<template slot-scope="scope">
|
||||
<el-select
|
||||
v-model="scope.row.is_active"
|
||||
size="mini"
|
||||
clearable
|
||||
class="filter-item"
|
||||
placeholder="无"
|
||||
disabled
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.is_used"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="ivt_qty" label="库存重量" align="center" :formatter="crud.formatNum3" />
|
||||
<el-table-column prop="mol_qty" width="220" label="损溢重量" align="center">
|
||||
<template scope="scope">
|
||||
<el-input-number v-model="scope.row.mol_qty" :disabled="scope.row.edit" :precision="3" :controls="false" :min="0" style="width: 120px" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="qty_unit_name" label="单位" align="center" />
|
||||
<el-table-column v-if="crud.status.cu > 0" align="center" label="操作" width="190" fixed="right">
|
||||
<template scope="scope">
|
||||
<el-button
|
||||
type="danger"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
icon="el-icon-delete"
|
||||
@click.native.prevent="deleteRow(scope.$index, form.tableData)"
|
||||
/>
|
||||
<el-button
|
||||
v-show="!scope.row.edit"
|
||||
type="primary"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
icon="el-icon-edit"
|
||||
@click="handleEdit(scope.$index, scope.row)"
|
||||
>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-show="scope.row.edit"
|
||||
type="success"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
icon="el-icon-check"
|
||||
@click="handleEdit(scope.$index, scope.row)"
|
||||
>完成
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<MaterDtl :dialog-show.sync="materShow" :dialog-matertype="materType" @tableChanged2="tableChanged2" />
|
||||
<StructDiv ref="child" :dialog-show.sync="structShow" @tableChanged="tableChanged" />
|
||||
<BucketDialog :dialog-show.sync="bucketShow" @bucketChange="tableChanged2" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import BucketDialog from '@/views/wms/storage_manage/semiproduct/semiproductMoreOrless/NewBucketDialog'
|
||||
import CRUD, { crud, form } from '@crud/crud'
|
||||
import crudStorattr from '@/api/wms/basedata/st/storattr'
|
||||
import crudMoreOrless from '@/views/wms/storage_manage/semiproduct/semiproductMoreOrless/moreorless'
|
||||
import MaterDtl from '@/views/wms/pub/MaterDialog'
|
||||
import StructDiv from '@/views/wms/storage_manage/semiproduct/semiproductMoreOrless/StructDiv'
|
||||
|
||||
const defaultForm = {
|
||||
mol_id: '',
|
||||
mol_code: '',
|
||||
mol_type: '',
|
||||
stor_id: '',
|
||||
total_qty: '0',
|
||||
dtl_num: '0',
|
||||
bill_type: '',
|
||||
remark: '',
|
||||
struct_id: '',
|
||||
sect_id: '',
|
||||
sect_name: '',
|
||||
struct_code: '',
|
||||
struct_name: '',
|
||||
tableData: []
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'AddDialog',
|
||||
components: { crudOperation, MaterDtl, StructDiv, BucketDialog },
|
||||
mixins: [crud(), form(defaultForm)],
|
||||
dicts: ['io_bill_status', 'ST_QUALITY_SCODE', 'ST_IVT_LEVEL', 'is_used', 'ST_MOL_TYPE'],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
bussConfig: {
|
||||
type: Object
|
||||
},
|
||||
openParam: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
materShow: false,
|
||||
bucketShow: false,
|
||||
structShow: false,
|
||||
materType: '',
|
||||
mater_btn: true,
|
||||
storlist: [],
|
||||
rules: {
|
||||
stor_id: [
|
||||
{ required: true, message: '仓库不能为空', trigger: 'blur' }
|
||||
],
|
||||
bill_type: [
|
||||
{ required: true, message: '业务类型不能为空', trigger: 'blur' }
|
||||
],
|
||||
biz_date: [
|
||||
{ required: true, message: '业务日期不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
// 查询原材料库的仓库
|
||||
crudStorattr.getStor({ 'is_materialstore': '1' }).then(res => {
|
||||
this.storlist = res.content
|
||||
})
|
||||
},
|
||||
[CRUD.HOOK.afterToEdit]() {
|
||||
// 获取入库单明细
|
||||
crudMoreOrless.queryMolDtl({ 'mol_id': this.form.mol_id, 'struct_id': this.form.struct_id }).then(res => {
|
||||
this.form.tableData = res
|
||||
// 将明细变成不可编辑
|
||||
for (let i = 0; i < this.form.tableData.length; i++) {
|
||||
const row = this.form.tableData[i]
|
||||
row.isadd = false
|
||||
row.edit = true
|
||||
this.form.tableData.splice(i, 1, row)
|
||||
}
|
||||
})
|
||||
},
|
||||
[CRUD.HOOK.afterToView]() {
|
||||
this.mater_btn = true
|
||||
crudMoreOrless.queryMolDetail({ 'mol_id': this.form.mol_id, 'struct_id': this.form.struct_id }).then(res => {
|
||||
this.form.tableData = res
|
||||
// 将明细变成不可编辑
|
||||
for (let i = 0; i < this.form.tableData.length; i++) {
|
||||
const row = this.form.tableData[i]
|
||||
row.edit = true
|
||||
this.form.tableData.splice(i, 1, row)
|
||||
}
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('AddChanged')
|
||||
},
|
||||
[CRUD.HOOK.beforeSubmit]() {
|
||||
debugger
|
||||
// 提交前校验
|
||||
if (this.form.tableData.length === 0) {
|
||||
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
for (let i = 0; i < this.form.tableData.length; i++) {
|
||||
if (!this.form.tableData[i].edit) {
|
||||
this.crud.notify('尚有未完成编辑的物料明细序号' + (i + 1) + ',请检查!')
|
||||
return false
|
||||
}
|
||||
const vehicle_code = this.form.tableData[i].storagevehicle_code
|
||||
const same = this.form.tableData.some(mater => mater.storagevehicle_code !== vehicle_code)
|
||||
if (same) {
|
||||
this.crud.notify('存在不同载具号', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
billTypeChange(val) {
|
||||
this.form.tableData = []
|
||||
this.form.total_qty = 0
|
||||
this.form.dtl_num = 0
|
||||
},
|
||||
resetTable() {
|
||||
if (!this.form.struct_id) {
|
||||
this.crud.notify('请先选择货物!')
|
||||
return false
|
||||
}
|
||||
if (this.crud.status.add > 0) {
|
||||
crudMoreOrless.getStructIvt({ 'struct_id': this.form.struct_id }).then(res => {
|
||||
this.form.tableData = res
|
||||
this.form.dtl_num = this.form.tableData.length
|
||||
})
|
||||
}
|
||||
if (this.crud.status.edit > 0) {
|
||||
crudMoreOrless.queryMolDtl({ 'mol_id': this.form.mol_id, 'struct_id': this.form.struct_id }).then(res => {
|
||||
this.form.tableData = res
|
||||
this.form.dtl_num = this.form.tableData.length
|
||||
})
|
||||
}
|
||||
},
|
||||
tableChanged2(row) {
|
||||
// 新增一行物料时,给行进行赋值
|
||||
this.nowrow.material_code = row.material_code
|
||||
this.nowrow.material_id = row.material_id
|
||||
this.nowrow.material_name = row.material_name
|
||||
this.nowrow.qty_unit_id = row.qty_unit_id
|
||||
this.nowrow.qty_unit_name = row.qty_unit_name
|
||||
this.nowrow.quality_scode = row.quality_scode
|
||||
this.nowrow.is_active = row.is_active
|
||||
this.nowrow.ivt_level = row.ivt_level
|
||||
this.nowrow.pcsn = row.pcsn
|
||||
this.nowrow.mol_qty = row.storage_qty
|
||||
this.nowrow.bucketunique = row.bucketunique
|
||||
this.form.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
|
||||
},
|
||||
tableChanged(row) {
|
||||
this.form.struct_id = row.struct_id
|
||||
this.form.struct_code = row.struct_code
|
||||
this.form.sect_id = row.sect_id
|
||||
this.form.sect_name = row.sect_name
|
||||
this.form.struct_name = row.struct_name
|
||||
crudMoreOrless.getStructIvt({ 'struct_id': row.struct_id }).then(res => {
|
||||
this.form.tableData = res
|
||||
this.form.dtl_num = this.form.tableData.length
|
||||
})
|
||||
},
|
||||
|
||||
async queryMater(index, row) {
|
||||
this.materShow = true
|
||||
this.nowindex = index
|
||||
this.nowrow = row
|
||||
},
|
||||
async queryStruct() {
|
||||
if (!this.form.mol_type) {
|
||||
this.crud.notify('请先选择损溢类型!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
this.structShow = true
|
||||
this.$refs.child.getMsg(this.form.mol_type)
|
||||
},
|
||||
async queryBucket(index, row) {
|
||||
this.bucketShow = true
|
||||
this.nowindex = index
|
||||
this.nowrow = row
|
||||
},
|
||||
async insertdtl() {
|
||||
this.form.tableData.push({ quality_scode: '02', ivt_qty: 0, mol_qty: 0, is_active: '1', ivt_level: '01', edit: false, is_add: true })
|
||||
this.form.dtl_num = this.form.tableData.length
|
||||
},
|
||||
typeChange(val) {
|
||||
if (val === '1') {
|
||||
this.mater_btn = false
|
||||
} else {
|
||||
this.mater_btn = true
|
||||
}
|
||||
this.form.tableData = []
|
||||
this.form.struct_id = ''
|
||||
this.form.struct_code = ''
|
||||
this.form.sect_id = ''
|
||||
this.form.sect_name = ''
|
||||
this.form.struct_name = ''
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
if (!row.edit) {
|
||||
if (parseFloat(row.mol_qty) <= 0) {
|
||||
this.crud.notify('不允许损溢数量为0!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (!row.material_id) {
|
||||
this.crud.notify('物料不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (!row.storagevehicle_code) {
|
||||
this.crud.notify('载具号不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (!row.bucketunique) {
|
||||
this.crud.notify('桶号不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (!row.pcsn) {
|
||||
this.crud.notify('批次不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (this.form.mol_type === '0' && (parseFloat(row.ivt_qty) < parseFloat(row.mol_qty))) {
|
||||
this.crud.notify('不允许损数量大于库存数量!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
}
|
||||
// 修改行的编辑状态
|
||||
row.edit = !row.edit
|
||||
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
|
||||
if (row.edit) {
|
||||
this.form.total_qty = 0
|
||||
this.form.tableData.forEach((item) => {
|
||||
this.form.total_qty = this.form.total_qty + item.mol_qty
|
||||
})
|
||||
}
|
||||
},
|
||||
deleteRow(index, rows) {
|
||||
this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].mol_qty)
|
||||
rows.splice(index, 1)
|
||||
this.form.dtl_num = this.form.tableData.length
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.crud-opts2 {
|
||||
padding: 4px 0;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.crud-opts2 .crud-opts-right2 {
|
||||
margin-left: auto;
|
||||
}
|
||||
</style>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
padding-top: 0px;
|
||||
}
|
||||
</style>
|
||||
@@ -138,12 +138,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//取满箱任务起点 一般是专机满料点和缓存线
|
||||
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialFullStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,到达取货点1,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangSpecialFullStationDeviceDriver = (HailiangSpecialFullStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialFullStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,到达出缓存线取满框点1,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
@@ -175,13 +175,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//取满箱任务起点 一般是专机满料点和缓存线
|
||||
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialFullStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,取货点1取货完成,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangSpecialFullStationDeviceDriver = (HailiangSpecialFullStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialFullStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
//入缓存线任务的起点有专机满料位 出缓存的起点是缓存线
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,缓存线取满框点1取货完成,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
@@ -213,12 +213,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//双任务-取满箱任务起点2 一般是专机满料点和缓存线
|
||||
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialFullStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,到达取货点2,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangSpecialFullStationDeviceDriver = (HailiangSpecialFullStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialFullStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,到达出缓存线取满框点2,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
@@ -249,12 +249,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//双任务-取满箱任务起点2 一般是专机满料点和缓存线
|
||||
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialFullStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,取货点2取货完成,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangSpecialFullStationDeviceDriver = (HailiangSpecialFullStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialFullStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,出缓存线取满框点2取货完成,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
@@ -285,7 +285,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位入到缓存线有到达送满框
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,缓存线入库到达送满框点1,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -320,13 +320,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到倒料位、清洗储料仓,及缓存线到倒料位、清洗储料仓有倒料点 倒料点都是倒料位、清洗储料仓
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialPourStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,到达倒料点1,设备号:{}", device_code);
|
||||
hailiangSpecialPourStationDeviceDriver = (HailiangSpecialPourStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialPourStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,到达倒料点1,设备号:{}", device_code);
|
||||
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -359,7 +359,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//送满框1 只有满料位到缓存线才有送满框1
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,缓存线入库送满框点1完成,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -392,13 +392,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位、缓存线到倒料位、清洗储料仓才有倒料完毕1
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialPourStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,倒料点1倒料完毕,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangSpecialPourStationDeviceDriver = (HailiangSpecialPourStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialPourStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,倒料点1倒料完毕,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -430,7 +430,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到缓存线放满完成后才有到达取空框1 取空框是缓存线才有
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,缓存线入库,到达取空框1,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -453,6 +453,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
Collections.reverse(insts);
|
||||
for (Instruction inst : insts) {
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
@@ -462,13 +463,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到倒料位、清洗储料仓,及缓存线到倒料位、清洗储料仓有倒料点 倒料点都是倒料位、清洗储料仓
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialPourStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,到达倒料点2,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangSpecialPourStationDeviceDriver = (HailiangSpecialPourStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialPourStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,到达倒料点2,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -500,7 +501,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到缓存线入库才有取空框1完毕
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,缓存线入库,取空框1完成,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -532,7 +533,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到缓存线才有到达送满框2
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,缓存线入库,到达送满框点2,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -564,7 +565,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到缓存线才有到送满框完毕
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,缓存线入库,送满框点2完成,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -597,7 +598,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到缓存线才有到达取空框2
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,缓存线入库,到达取空框点2,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -629,7 +630,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到缓存线才有到达取空框完毕2
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,缓存线入库,取空框点2取货完成,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -662,13 +663,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//只有满料位到倒料位、清洗储料仓,及缓存线到倒料位、清洗储料仓有倒料点 倒料点都是倒料位、清洗储料仓
|
||||
if (StrUtil.equals(inst.getPut_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialPourStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,倒料点2倒料完毕,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangSpecialPourStationDeviceDriver = (HailiangSpecialPourStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialPourStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,倒料点2倒料完毕,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.set(phase, index, inst);
|
||||
break;
|
||||
@@ -702,12 +703,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//所有任务都有到达送空框1
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialEmptyStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,到达还空框1,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangSpecialEmptyStationDeviceDriver = (HailiangSpecialEmptyStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialEmptyStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,缓存线出库,还空框1完成,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
@@ -740,12 +741,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//所有任务都有到送空框1完毕
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialEmptyStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,还空框1完成,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangSpecialEmptyStationDeviceDriver = (HailiangSpecialEmptyStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialEmptyStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,缓存线出库还空框1完成,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
@@ -778,12 +779,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//所有双任务都有到达送空框2
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialEmptyStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,到达还空框2,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangSpecialEmptyStationDeviceDriver = (HailiangSpecialEmptyStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialEmptyStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,缓存线出库到达还空框2,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
@@ -816,12 +817,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//所有双任务都有送空框完毕2
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialEmptyStationDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,还空框2完成,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangSpecialEmptyStationDeviceDriver = (HailiangSpecialEmptyStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialEmptyStationDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
log.info("开始设置phase值,设备号:{}", device_code);
|
||||
log.info("开始设置phase值,缓存线出库还空框2完成,设备号:{},指令号:{}", device_code, inst.getInstruction_code());
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(phase, index, inst);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
|
||||
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.MonitoringLargeScreenData;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
@@ -139,6 +140,7 @@ public class HailiangCleaningMachineStorageStationDeviceDriver extends AbstractO
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号is_open:" + last_is_open + "->" + is_open);
|
||||
}
|
||||
if (silo_weight != last_silo_weight) {
|
||||
MonitoringLargeScreenData.deviceNumData.put(this.device_code, this.getSilo_weight());
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号silo_weight:" + last_silo_weight + "->" + silo_weight);
|
||||
}
|
||||
if (full_number != last_full_number) {
|
||||
|
||||
@@ -230,7 +230,7 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
|
||||
//修改工单状态为自动完成
|
||||
if (mode == 1 && finish != last_finish && finish == 1 && order > 0) {
|
||||
if (mode == 1 && finish != last_finish && finish == 1 && order > 0 && now_order_prod_num == order_prod_allnum) {
|
||||
ProduceshiftorderDto pdto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
|
||||
if (pdto != null) {
|
||||
if (pdto.getOrder_status().equals(WorkerOrderEnum.PRODUCTING.getCode())) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.instruction.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -453,7 +454,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
dto2.setCreate_by(currentUsername2);
|
||||
dto2.setUpdate_by(currentUsername2);
|
||||
dto2.setUpdate_time(now2);
|
||||
dto2.setCreate_time(now2);
|
||||
Date date2 = DateUtil.parse(now2);
|
||||
Date newDate = DateUtil.offset(date2, DateField.SECOND, 2);
|
||||
dto2.setCreate_time(DateUtil.formatDateTime(newDate));
|
||||
dto2.setStart_parent_code(task2.getStart_parent_code());
|
||||
dto2.setNext_parent_code(task2.getNext_parent_code());
|
||||
dto2.setAgv_inst_type(AgvTypeEnum.getAgvInstTypeByTaskType(task2.getTask_type()));
|
||||
@@ -1094,7 +1097,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(i -> i.getLink_num().equals(link_no))
|
||||
.sorted((inst1, inst2) -> inst1.getInstruction_code().compareTo(inst2.getInstruction_code()))
|
||||
.sorted((inst1, inst2) -> inst1.getCreate_time().compareTo(inst2.getCreate_time()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user