This commit is contained in:
2023-05-31 09:13:36 +08:00
50 changed files with 502 additions and 198 deletions

View File

@@ -56,8 +56,8 @@ public enum AcsTaskEnum {
ACS_TASK_TYPE_NOBLE_DOUBLE_TASK("1","诺宝双工任务"), ACS_TASK_TYPE_NOBLE_DOUBLE_TASK("1","诺宝双工任务"),
ACS_TASK_TYPE_NOBLE_SINGLE_TASK("2","诺宝单工任务"), ACS_TASK_TYPE_NOBLE_SINGLE_TASK("2","诺宝单工任务"),
ACS_TASK_TYPE_NOBLE_DOUBLE_ENTRY_TASK("3","诺宝双入-双任务"), ACS_TASK_TYPE_NOBLE_DOUBLE_ENTRY_TASK("4","诺宝双入-双任务"),
ACS_TASK_TYPE_NOBLE_SINGLE_ENTRY_TASK("4","诺宝单入-单任务"), ACS_TASK_TYPE_NOBLE_SINGLE_ENTRY_TASK("3","诺宝单入-单任务"),
ACS_TASK_TYPE_NOBLE_POINT_POINT_TASK("5","诺宝点对点任务"), ACS_TASK_TYPE_NOBLE_POINT_POINT_TASK("5","诺宝点对点任务"),
ACS_TASK_TYPE_WEIGHING_TASK_OF_PS20("6","PS20称重任务刻字-包装)"), ACS_TASK_TYPE_WEIGHING_TASK_OF_PS20("6","PS20称重任务刻字-包装)"),
ACS_TASK_TYPE_NON_WEIGHING_TASK_OF_PS20("7","PS20不称重任务刻字-包装)"), ACS_TASK_TYPE_NON_WEIGHING_TASK_OF_PS20("7","PS20不称重任务刻字-包装)"),

View File

@@ -34,7 +34,7 @@ public class RedissonUtils {
if (isLock){ if (isLock){
process.process(); process.process();
} else { } else {
throw new BadRequestException("当前业务 key:"+key+"正在锁定请稍后再试"); throw new BadRequestException("当前业务 key:"+key+"正在执行请稍后再试");
} }
}finally { }finally {
if (isLock){ if (isLock){

View File

@@ -120,7 +120,6 @@ public class AcsToWmsController {
} }
@GetMapping("/taskPublish") @GetMapping("/taskPublish")
@Log("taskPublish") @Log("taskPublish")
@ApiOperation("taskPublish") @ApiOperation("taskPublish")

View File

@@ -163,14 +163,17 @@ public class AgvInstService {
//3.agv根据对应载具列表行进扫码匹配匹配到对应物料则创建点对点任务 //3.agv根据对应载具列表行进扫码匹配匹配到对应物料则创建点对点任务
public void empMatter(JSONObject task){ public void empMatter(JSONObject task){
//参数 //参数
String startPoint = task.getString("cacheLine"); String startPoint = task.getString("point_code1");
String cacheVehile = getCacheVehile(startPoint, task.getString("material_id")); String cacheVehile = getCacheVehile(startPoint, task.getString("material_id"));
if (StringUtils.isBlank(cacheVehile)) { if (StringUtils.isBlank(cacheVehile)) {
throw new BadRequestException("缓存线:"+startPoint+"没有物料"+task.getString("material_id")+"对应可用载具"); throw new BadRequestException("缓存线:"+startPoint+"没有物料"+task.getString("material_id")+"对应可用载具");
} }
//判断当前物料载具已经任务分配数量:如果>物料已经分配任务。说明满了,不允许再分配 //判断当前物料载具已经任务分配数量:如果>物料已经分配任务。说明满了,不允许再分配
List<SchBaseTask> allocateTask = taskService.list(new QueryWrapper<SchBaseTask>().eq("point_code1", startPoint).eq("material_id", task.getString("material_id")).lt("task_status", StatusEnum.TASK_FINISH.getCode())); List<SchBaseTask> allocateTask = taskService.list(new QueryWrapper<SchBaseTask>()
if (allocateTask.size()>=cacheVehile.split(",").length){ .eq("point_code1", startPoint)
.eq("material_id", task.getString("material_id"))
.in("task_status", "4","5","6"));
if (allocateTask.size()>cacheVehile.split(",").length){
log.error("callMatter 缓存线:{}上含有物料:{}的载具分配完任务id:{}",startPoint,task.getString("material_id"),allocateTask.stream().map(SchBaseTask::getTask_id).collect(Collectors.joining(","))); log.error("callMatter 缓存线:{}上含有物料:{}的载具分配完任务id:{}",startPoint,task.getString("material_id"),allocateTask.stream().map(SchBaseTask::getTask_id).collect(Collectors.joining(",")));
throw new BadRequestException(String.format("缓存线%s上含物料%s的载具已分配完",startPoint,task.getString("material_id"))); throw new BadRequestException(String.format("缓存线%s上含物料%s的载具已分配完",startPoint,task.getString("material_id")));
} }
@@ -191,7 +194,7 @@ public class AgvInstService {
if (StringUtils.isNotEmpty(cacheLine)){ if (StringUtils.isNotEmpty(cacheLine)){
int count = taskService.count(new QueryWrapper<SchBaseTask>().eq("point_code2", cacheLine).lt("task_status", StatusEnum.TASK_FINISH.getCode())); int count = taskService.count(new QueryWrapper<SchBaseTask>().eq("point_code2", cacheLine).lt("task_status", StatusEnum.TASK_FINISH.getCode()));
String status = StringUtils.isBlank(materialId) ? StatusEnum.CACHE_VEL_EMT.getCode() : StatusEnum.CACHE_VEL_FULL.getCode(); String status = StringUtils.isBlank(materialId) ? StatusEnum.CACHE_VEL_EMT.getCode() : StatusEnum.CACHE_VEL_FULL.getCode();
List<SchCachelineVehicle> vehicle = cachelineVehicleService.getCachelineVehicle(MapOf.of("vehicle_status", status, "material_id", materialId)); List<SchCachelineVehicle> vehicle = cachelineVehicleService.getCachelineVehicle(MapOf.of("vehicle_status", status, "material_id", materialId, "cacheLine",cacheLine));
if (vehicle.size()>0){ if (vehicle.size()>0){
if (vehicle.size()>count){ if (vehicle.size()>count){
return vehicle.stream().map(SchCachelineVehicle::getVehicle_code).collect(Collectors.joining(",")); return vehicle.stream().map(SchCachelineVehicle::getVehicle_code).collect(Collectors.joining(","));

View File

@@ -1,5 +1,6 @@
package org.nl.wms.masterdata_manage.service.vehicle; package org.nl.wms.masterdata_manage.service.vehicle;
import com.alibaba.fastjson.JSONObject;
import org.nl.common.domain.query.PageQuery; import org.nl.common.domain.query.PageQuery;
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbBucketrecord; import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbBucketrecord;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
@@ -24,4 +25,6 @@ public interface IMdPbBucketrecordService extends IService<MdPbBucketrecord> {
* @return Object / * @return Object /
*/ */
Object queryAll(Map whereJson, PageQuery page); Object queryAll(Map whereJson, PageQuery page);
void createBucke(MdPbBucketrecord dao);
} }

View File

@@ -1,6 +1,8 @@
package org.nl.wms.masterdata_manage.service.vehicle.dao; package org.nl.wms.masterdata_manage.service.vehicle.dao;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
@@ -28,6 +30,7 @@ public class MdPbBucketrecord implements Serializable {
/** /**
* 桶记录标识 * 桶记录标识
*/ */
@TableId
private Long bucket_record_id; private Long bucket_record_id;
/** /**
@@ -43,7 +46,7 @@ public class MdPbBucketrecord implements Serializable {
/** /**
* 物料标识 * 物料标识
*/ */
private Long material_id; private String material_id;
/** /**
* 批次 * 批次

View File

@@ -1,6 +1,8 @@
package org.nl.wms.masterdata_manage.service.vehicle.dao; package org.nl.wms.masterdata_manage.service.vehicle.dao;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date; import java.util.Date;
import java.io.Serializable; import java.io.Serializable;
@@ -27,6 +29,7 @@ public class MdPbStoragevehicleext implements Serializable {
/** /**
* 载具扩展标识 * 载具扩展标识
*/ */
@TableId
private String storagevehicleext_id; private String storagevehicleext_id;
/** /**

View File

@@ -1,16 +1,29 @@
package org.nl.wms.masterdata_manage.service.vehicle.impl; package org.nl.wms.masterdata_manage.service.vehicle.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import org.nl.common.TableDataInfo; import org.nl.common.TableDataInfo;
import org.nl.common.domain.query.PageQuery; import org.nl.common.domain.query.PageQuery;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.masterdata_manage.MasterEnum;
import org.nl.wms.masterdata_manage.service.vehicle.IMdPbStoragevehicleextService;
import org.nl.wms.masterdata_manage.service.vehicle.IMdPbStoragevehicleinfoService;
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbBucketrecord; import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbBucketrecord;
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbStoragevehicleext;
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbStoragevehicleinfo;
import org.nl.wms.masterdata_manage.service.vehicle.dao.mapper.MdPbBucketrecordMapper; import org.nl.wms.masterdata_manage.service.vehicle.dao.mapper.MdPbBucketrecordMapper;
import org.nl.wms.masterdata_manage.service.vehicle.IMdPbBucketrecordService; import org.nl.wms.masterdata_manage.service.vehicle.IMdPbBucketrecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.wms.storage_manage.IOSEnum;
import org.nl.wms.storage_manage.IVTEnum;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -25,6 +38,10 @@ import java.util.Map;
@Service @Service
public class MdPbBucketrecordServiceImpl extends ServiceImpl<MdPbBucketrecordMapper, MdPbBucketrecord> implements IMdPbBucketrecordService { public class MdPbBucketrecordServiceImpl extends ServiceImpl<MdPbBucketrecordMapper, MdPbBucketrecord> implements IMdPbBucketrecordService {
@Autowired
protected IMdPbStoragevehicleinfoService iMdPbStoragevehicleinfoService; // 载具服务
@Override @Override
public Object queryAll(Map whereJson, PageQuery pageQuery) { public Object queryAll(Map whereJson, PageQuery pageQuery) {
Page<Object> page = PageHelper.startPage(pageQuery.getPage()+1, pageQuery.getSize()); Page<Object> page = PageHelper.startPage(pageQuery.getPage()+1, pageQuery.getSize());
@@ -33,4 +50,32 @@ public class MdPbBucketrecordServiceImpl extends ServiceImpl<MdPbBucketrecordMap
build.setTotalElements(page.getTotal()); build.setTotalElements(page.getTotal());
return build; return build;
} }
@Override
public void createBucke(MdPbBucketrecord dao) {
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getOne(
new QueryWrapper<MdPbStoragevehicleinfo>().lambda()
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code, dao.getStoragevehicle_code())
);
dao.setBucket_record_id(IdUtil.getLongId());
dao.setStoragevehicle_type("1"); // TODO 暂时写死
dao.setIvt_level(IVTEnum.IVT_LEVEL.code("一级"));
dao.setIs_active("1");
dao.setQuality_scode(IVTEnum.QUALITY_SCODE.code("待检品"));
dao.setPrint_times(BigDecimal.valueOf(0));
dao.setCreate_id(Long.valueOf(SecurityUtils.getCurrentUserId()));
dao.setCreate_name(SecurityUtils.getCurrentNickName());
dao.setCreate_time(DateUtil.now());
dao.setStoragevehicle_id(Long.valueOf(vehicleDao.getStoragevehicle_id()));
dao.setStoragevehicle_code(vehicleDao.getStoragevehicle_code());
dao.setMakeup_optid(Long.valueOf(SecurityUtils.getCurrentUserId()));
dao.setMakeup_optname(SecurityUtils.getCurrentNickName());
dao.setMakeup_time(DateUtil.now());
dao.setInstor_optid(Long.valueOf(SecurityUtils.getCurrentUserId()));
dao.setInstor_optname(SecurityUtils.getCurrentNickName());
dao.setInstor_time(DateUtil.now());
this.save(dao);
}
} }

View File

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.jsonwebtoken.lang.Assert;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
@@ -670,15 +671,18 @@ public class CacheLineHandServiceImpl implements CacheLineHandService {
String device_code = param.getString("wcsdevice_code"); String device_code = param.getString("wcsdevice_code");
//载具编码 //载具编码
String vehicle_code = param.getString("vehicle_code"); String vehicle_code = param.getString("vehicle_code");
if (StringUtils.isEmpty(vehicle_code)){
throw new BadRequestException("载具号不能为空");
}
//缓存线位置编码 //缓存线位置编码
// 封装给acs的数据 // 封装给acs的数据
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
// 1 扫码异常-入箱扫码 2 出箱扫码 // 1 扫码异常-入箱扫码 2 出箱扫码
jsonObject.put("type", type); jsonObject.put("type", type);
// jsonObject.put("position_code", position_code);
jsonObject.put("device_code", device_code); jsonObject.put("device_code", device_code);
jsonObject.put("vehicle_code", vehicle_code); jsonObject.put("vehicle_code", vehicle_code);
vehilematerialService.remove(new QueryWrapper<SchCachelineVehilematerial>().eq("vehicle_code",vehicle_code));
try { try {
return RestBusinessTemplate.execute(() -> AcsUtil.notifyAcs("api/wms/issuedBarcode", jsonObject)); return RestBusinessTemplate.execute(() -> AcsUtil.notifyAcs("api/wms/issuedBarcode", jsonObject));
} catch (NullPointerException e) { } catch (NullPointerException e) {

View File

@@ -8,6 +8,8 @@ import lombok.RequiredArgsConstructor;
import org.nl.common.TableDataInfo; import org.nl.common.TableDataInfo;
import org.nl.common.anno.Log; import org.nl.common.anno.Log;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.RedissonUtils;
import org.nl.common.utils.api.RestBusinessTemplate;
import org.nl.common.utils.api.ResultCode; import org.nl.common.utils.api.ResultCode;
import org.nl.modules.common.exception.BizCoreException; import org.nl.modules.common.exception.BizCoreException;
import org.nl.wms.mps.service.ProduceshiftorderService; import org.nl.wms.mps.service.ProduceshiftorderService;
@@ -93,7 +95,10 @@ public class ProduceshiftorderController{
@Log("看板开工") @Log("看板开工")
@ApiOperation("看板开工") @ApiOperation("看板开工")
public ResponseEntity<Object> openStart(@RequestBody JSONObject param) { public ResponseEntity<Object> openStart(@RequestBody JSONObject param) {
return new ResponseEntity<>(iPdmProduceWorkorderService.openStart(param), HttpStatus.OK); RedissonUtils.lock(()->{
iPdmProduceWorkorderService.openStart(param);
},param.getString("workorder_id"),null);
return new ResponseEntity<>(RestBusinessTemplate.execute(() -> new JSONObject()),HttpStatus.OK);
} }
@PostMapping("/saveReport") @PostMapping("/saveReport")

View File

@@ -50,7 +50,6 @@ public class TaskServiceImpl implements TaskService {
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
map.put("flag", "1"); map.put("flag", "1");
JSONObject whereJson = JSONObject.parseObject(JSON.toJSONString(form)); JSONObject whereJson = JSONObject.parseObject(JSON.toJSONString(form));
String task_status = whereJson.getString("task_status"); String task_status = whereJson.getString("task_status");

View File

@@ -97,8 +97,8 @@ public class SpeEmpTask extends AbstractAcsTask {
throw new BadRequestException(String.format("设备%s存在未完成任务", param.getString("device_code"))); throw new BadRequestException(String.format("设备%s存在未完成任务", param.getString("device_code")));
} }
JSONObject form = new JSONObject(MapOf.of("start_point_code","", JSONObject form = new JSONObject(MapOf.of("start_point_code",cahceLine,
"next_point_code",param.getString("device_code"),"return_point_code", "","vehicle_code", "next_point_code",param.getString("device_code"),"return_point_code", cahceLine,"vehicle_code",
"","product_area",one.getProduct_area(),"quantity", param.getString("quantity"),"type",AcsTaskEnum.TASK_CACHELINE_OUT.getCode(),"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() + ""; String taskId = IdUtil.getSnowflake(1, 1).nextId() + "";
JSONObject task = packageParam(form, taskId); JSONObject task = packageParam(form, taskId);
@@ -143,7 +143,7 @@ public class SpeEmpTask extends AbstractAcsTask {
task.put("task_name", AcsTaskEnum.TASK_CACHELINE_OUT.getDesc()); task.put("task_name", AcsTaskEnum.TASK_CACHELINE_OUT.getDesc());
task.put("task_code", CodeUtil.getNewCode("TASK_CODE")); task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
task.put("task_type", form.getString("type")); task.put("task_type", form.getString("type"));
task.put("acs_task_type", AcsTaskEnum.ACS_TASK_TYPE_NOBLE_DOUBLE_TASK.getCode()); task.put("acs_task_type", AcsTaskEnum.ACS_TASK_TYPE_NOBLE_SINGLE_TASK.getCode());
task.put("task_status", TaskStatusEnum.CREATED.getCode()); task.put("task_status", TaskStatusEnum.CREATED.getCode());
task.put("point_code1", form.getString("start_point_code")); task.put("point_code1", form.getString("start_point_code"));
task.put("point_code2", form.getString("next_point_code")); task.put("point_code2", form.getString("next_point_code"));
@@ -216,7 +216,8 @@ public class SpeEmpTask extends AbstractAcsTask {
ArrayList<SchBaseTask> Merge = new ArrayList<>(); ArrayList<SchBaseTask> Merge = new ArrayList<>();
if (!CollectionUtils.isEmpty(array)){ if (!CollectionUtils.isEmpty(array)){
String pointCollect = array.stream().map(a->a.getPoint_code1() + "','" + a.getPoint_code2()).collect(Collectors.joining("','")); String pointCollect = array.stream().map(a->a.getPoint_code1() + "','" + a.getPoint_code2()).collect(Collectors.joining("','"));
List<Map<String,String>> needMergeCollect = basePointService.getAllPointRegin(pointCollect); List<Map<String,String>> needMergeCollect = new ArrayList<>();
//basePointService.getAllPointRegin("'"+pointCollect+"'");
//区域编号对应point_code pointRegionCollent //区域编号对应point_code pointRegionCollent
Map<String, List<Map<String,String>>> pointRegionCollent = needMergeCollect.stream().collect(Collectors.groupingBy(o -> o.get("point_code"))); 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()); Set<String> mergePointCollent = needMergeCollect.stream().map(item -> item.get("point_code")).collect(Collectors.toSet());
@@ -291,6 +292,17 @@ public class SpeEmpTask extends AbstractAcsTask {
if (tag){task.setIs_send(true);tag = false;}else {task.setIs_send(false); } if (tag){task.setIs_send(true);tag = false;}else {task.setIs_send(false); }
} }
} }
if (value.size() == 1){
for (SchBaseTask task : value) {
if (task.getAcs_task_type().equals(AcsTaskEnum.ACS_TASK_TYPE_NOBLE_DOUBLE_ENTRY_TASK.getCode())){
task.setAcs_task_type(AcsTaskEnum.ACS_TASK_TYPE_NOBLE_SINGLE_ENTRY_TASK.getCode());
}
if (task.getAcs_task_type().equals(AcsTaskEnum.ACS_TASK_TYPE_NOBLE_DOUBLE_TASK.getCode())){
task.setAcs_task_type(AcsTaskEnum.ACS_TASK_TYPE_NOBLE_SINGLE_TASK.getCode());
}
task.setIs_send(true);
}
}
} }

View File

@@ -223,7 +223,6 @@ public class SpeFullTask extends AbstractAcsTask {
vehilematerial.setQuantity(task.getMaterial_qty()); vehilematerial.setQuantity(task.getMaterial_qty());
cacheLineVechileService.save(vehilematerial); cacheLineVechileService.save(vehilematerial);
} }
break; break;
case STATUS_FINISH: case STATUS_FINISH:
taskService.update(new UpdateWrapper<SchBaseTask>() taskService.update(new UpdateWrapper<SchBaseTask>()
@@ -251,12 +250,17 @@ public class SpeFullTask extends AbstractAcsTask {
.set("update_name", "acs") .set("update_name", "acs")
.set("update_time", DateUtil.now()).eq("task_id", task.getTask_id()); .set("update_time", DateUtil.now()).eq("task_id", task.getTask_id());
log.info("生坑到料完成:"+param.toString()); log.info("生坑到料完成:"+param.toString());
taskService.update(wrapper);
if (extParam.get("fall_finish") != null){ if (extParam.get("fall_finish") != null){
//TODO:添加任务唯一性校验防止重复更新
PdmBiDevice one = deviceService.getOne(new QueryWrapper<PdmBiDevice>().eq("device_code", task.getPoint_code2())); PdmBiDevice one = deviceService.getOne(new QueryWrapper<PdmBiDevice>().eq("device_code", task.getPoint_code2()));
deviceService.update(new UpdateWrapper<PdmBiDevice>() if (!one.getRemark().equals("fall_finish"+task.getTask_id())){
.set("material_id", task.getMaterial_id()) deviceService.update(new UpdateWrapper<PdmBiDevice>()
.set("deviceinstor_qty",one.getDeviceinstor_qty().add(task.getMaterial_qty())) .set("material_id", task.getMaterial_id())
.eq("device_code", task.getPoint_code2())); .set("deviceinstor_qty",one.getDeviceinstor_qty().add(task.getMaterial_qty()))
.set("remark","fall_finish"+task.getTask_id())
.eq("device_code", task.getPoint_code2()));
}
} }
break; break;
case STATUS_FINISH: case STATUS_FINISH:

View File

@@ -31,7 +31,7 @@
sch_base_point.point_type = '4' and pdm_bi_device.is_used = true sch_base_point.point_type = '4' and pdm_bi_device.is_used = true
and workprocedure_id = #{workprocedure_id} and workprocedure_id = #{workprocedure_id}
<if test="material_id != null and material_id != ''"> <if test="material_id != null and material_id != ''">
and (pdm_bi_device.material_id = #{material_id} or pdm_bi_device.material_id is null ) and (pdm_bi_device.material_id = #{material_id} or pdm_bi_device.material_id is null or pdm_bi_device.material_id = '')
</if> </if>
<if test="spec != null and spec != ''"> <if test="spec != null and spec != ''">
and (pdm_bi_device.spec = #{spec} or pdm_bi_device.spec is null) and (pdm_bi_device.spec = #{spec} or pdm_bi_device.spec is null)

View File

@@ -10,7 +10,8 @@
sch_cacheline_vehilematerial v sch_cacheline_vehilematerial v
LEFT JOIN sch_cacheline_position p ON p.vehicle_code = v.vehicle_code LEFT JOIN sch_cacheline_position p ON p.vehicle_code = v.vehicle_code
WHERE p.vehicle_code <![CDATA[<>]]> '' and WHERE p.vehicle_code <![CDATA[<>]]> '' and
v.vehicle_status = #{vehicle_status} v.vehicle_status = #{vehicle_status} and
p.cacheLine_code = #{cacheLine}
<if test="material_id != null and material_id != ''"> <if test="material_id != null and material_id != ''">
and v.material_id = #{material_id} and v.material_id = #{material_id}
</if> </if>

View File

@@ -114,10 +114,10 @@
FROM FROM
sch_base_region sch_base_region
LEFT JOIN sch_base_point ON sch_base_region.region_code = sch_base_point.region_code 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} ) LEFT JOIN sch_base_point b ON sch_base_region.region_code = b.region_code AND b.point_code IN ( ${points} )
WHERE WHERE
sch_base_region.is_merge = '1' sch_base_region.is_merge = '1'
AND sch_base_point.point_code IN ( #{points} ) AND sch_base_point.point_code IN ( ${points} )
GROUP BY sch_base_point.point_code GROUP BY sch_base_point.point_code
</select> </select>
</mapper> </mapper>

View File

@@ -25,7 +25,7 @@ public enum IOSEnum {
//单据状态 //单据状态
WORK_STATUS(MapOf.of("未生成", "00", "生成", "10", "执行中", "20", "完成", "99")), WORK_STATUS(MapOf.of("未生成", "00", "生成", "10", "执行中", "20", "完成", "99")),
//锁定类型 //锁定类型
LOCK_TYPE(MapOf.of("未锁定", "0", "入库锁", "1", "出库锁", "2","盘点锁", "3")), LOCK_TYPE(MapOf.of("未锁定", "0", "入库锁", "1", "出库锁", "2","盘点锁", "3","损溢锁", "4")),
; ;
private Map<String, String> code; private Map<String, String> code;

View File

@@ -455,7 +455,8 @@ public class StIvtIostorinvCpOutServiceImpl extends ServiceImpl<StIvtIostorinvCp
// 4) 更新载具扩展属性 // 4) 更新载具扩展属性
iMdPbStoragevehicleextService.update( iMdPbStoragevehicleextService.update(
new MdPbStoragevehicleext() new MdPbStoragevehicleext()
.setMaterial_id(""), .setMaterial_id("")
.setStorage_qty(BigDecimal.valueOf(0)),
new QueryWrapper<MdPbStoragevehicleext>().lambda() new QueryWrapper<MdPbStoragevehicleext>().lambda()
.eq(MdPbStoragevehicleext::getStoragevehicle_code,dao.getStoragevehicle_code()) .eq(MdPbStoragevehicleext::getStoragevehicle_code,dao.getStoragevehicle_code())
); );
@@ -477,7 +478,7 @@ public class StIvtIostorinvCpOutServiceImpl extends ServiceImpl<StIvtIostorinvCp
@Override @Override
public List getStructIvt(JSONObject whereJson) { public List getStructIvt(JSONObject whereJson) {
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("materia_id", whereJson.getString("materia_id")); param.put("material_id", whereJson.getString("material_id"));
param.put("stor_id", whereJson.getString("stor_id")); param.put("stor_id", whereJson.getString("stor_id"));
if (ObjectUtil.isNotEmpty(whereJson.getString("source_billdtl_id"))) param.put("sale_id", whereJson.getString("source_billdtl_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("search"))) param.put("remark", whereJson.getString("search"));

View File

@@ -271,6 +271,7 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl<StIvtIostorinvCpMap
// 6.更新载具扩展属性表 // 6.更新载具扩展属性表
MdPbStoragevehicleext vehicleDao = new MdPbStoragevehicleext(); MdPbStoragevehicleext vehicleDao = new MdPbStoragevehicleext();
vehicleDao.setMaterial_id(disDtlDao.getMaterial_id()); vehicleDao.setMaterial_id(disDtlDao.getMaterial_id());
vehicleDao.setStorage_qty(qty);
vehicleDao.setUpdate_id(SecurityUtils.getCurrentUserId()); vehicleDao.setUpdate_id(SecurityUtils.getCurrentUserId());
vehicleDao.setUpdate_name(SecurityUtils.getCurrentNickName()); vehicleDao.setUpdate_name(SecurityUtils.getCurrentNickName());
vehicleDao.setUpdate_time(new Date()); vehicleDao.setUpdate_time(new Date());

View File

@@ -1,6 +1,7 @@
package org.nl.wms.storage_manage.productmanage.service.iostorInv.impl; package org.nl.wms.storage_manage.productmanage.service.iostorInv.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -117,6 +118,7 @@ public class StIvtIostorinvdisCpServiceImpl extends ServiceImpl<StIvtIostorinvdi
// 更新载具扩展属性表 // 更新载具扩展属性表
MdPbStoragevehicleext vehicleExtDao = new MdPbStoragevehicleext(); MdPbStoragevehicleext vehicleExtDao = new MdPbStoragevehicleext();
vehicleExtDao.setMaterial_id(item.getString("material_id")); vehicleExtDao.setMaterial_id(item.getString("material_id"));
vehicleExtDao.setStorage_qty(NumberUtil.add(vehicleExtDao.getStorage_qty(),item.getBigDecimal("qty")));
vehicleExtDao.setUpdate_id(SecurityUtils.getCurrentUserId()); vehicleExtDao.setUpdate_id(SecurityUtils.getCurrentUserId());
vehicleExtDao.setUpdate_name(SecurityUtils.getCurrentNickName()); vehicleExtDao.setUpdate_name(SecurityUtils.getCurrentNickName());
vehicleExtDao.setUpdate_time(new Date()); vehicleExtDao.setUpdate_time(new Date());

View File

@@ -54,5 +54,7 @@
</if> </if>
</where> </where>
order by mst.mol_code DESC
</select> </select>
</mapper> </mapper>

View File

@@ -107,7 +107,7 @@ public class StIvtMoreorlessdtlCpServiceImpl extends ServiceImpl<StIvtMoreorless
//锁定货位 //锁定货位
structattrService.update( structattrService.update(
new UpdateWrapper<StIvtStructattr>() new UpdateWrapper<StIvtStructattr>()
.set("lock_type", IOSEnum.LOCK_TYPE.code("盘点")) .set("lock_type", IOSEnum.LOCK_TYPE.code("损溢"))
.set("inv_code",mst.getMol_code()) .set("inv_code",mst.getMol_code())
.eq("struct_id", row.getStruct_id())); .eq("struct_id", row.getStruct_id()));
} }

View File

@@ -19,11 +19,17 @@ import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils; import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil; import org.nl.modules.system.util.CodeUtil;
import org.nl.wms.masterdata_manage.MasterEnum;
import org.nl.wms.masterdata_manage.service.vehicle.IMdPbBucketrecordService;
import org.nl.wms.masterdata_manage.service.vehicle.IMdPbStoragevehicleextService;
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbBucketrecord;
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbStoragevehicleext;
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtBsrealstorattrService; 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.IStIvtStructattrService;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtBsrealstorattr; 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.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
import org.nl.wms.storage_manage.CHECKEnum; import org.nl.wms.storage_manage.CHECKEnum;
import org.nl.wms.storage_manage.IOSEnum;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.IStIvtMoreorlessdtlCpService; 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.IStIvtMoreorlessmstCpService;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessdtlCp; import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessdtlCp;
@@ -38,6 +44,7 @@ import org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.StIvtStructivtY
import org.nl.wms.storage_manage.semimanage.MLEnum; import org.nl.wms.storage_manage.semimanage.MLEnum;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@@ -66,6 +73,12 @@ public class StIvtMoreorlessmstCpServiceImpl extends ServiceImpl<StIvtMoreorless
@Autowired @Autowired
private IStIvtStructattrService structattrService; // 仓位属性服务 private IStIvtStructattrService structattrService; // 仓位属性服务
@Autowired
protected IMdPbBucketrecordService iMdPbBucketrecordService; // 包装箱记录表服务
@Autowired
protected IMdPbStoragevehicleextService iMdPbStoragevehicleextService; // 载具扩展属性信息表服务
@Override @Override
public Object pageQuery(MoreOrlessQuery query, PageQuery pageQuery) { public Object pageQuery(MoreOrlessQuery query, PageQuery pageQuery) {
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize()); Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
@@ -117,10 +130,28 @@ public class StIvtMoreorlessmstCpServiceImpl extends ServiceImpl<StIvtMoreorless
StIvtMoreorlessmstCp dao = this.getOne(new QueryWrapper<StIvtMoreorlessmstCp>().eq("mol_id", id)); StIvtMoreorlessmstCp dao = this.getOne(new QueryWrapper<StIvtMoreorlessmstCp>().eq("mol_id", id));
dao.setIs_delete(true); dao.setIs_delete(true);
this.updateById(dao); this.updateById(dao);
// 解锁货位
StIvtMoreorlessdtlCp dtlDao = iStIvtMoreorlessdtlCpService.getOne(
new QueryWrapper<StIvtMoreorlessdtlCp>().lambda()
.eq(StIvtMoreorlessdtlCp::getMol_id, id),
false
);
structattrService.update(
new StIvtStructattr()
.setInv_code("")
.setInv_type("")
.setInv_id("")
.setLock_type(IOSEnum.LOCK_TYPE.code("未锁定")),
new QueryWrapper<StIvtStructattr>().lambda()
.eq(StIvtStructattr::getStruct_id, dtlDao.getStruct_id())
);
} }
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void confirm(JSONObject whereJson) { public void confirm(JSONObject whereJson) {
String mol_id = (String) whereJson.get("mol_id"); String mol_id = (String) whereJson.get("mol_id");
@@ -146,9 +177,64 @@ public class StIvtMoreorlessmstCpServiceImpl extends ServiceImpl<StIvtMoreorless
BigDecimal mol_qty = dtl.getMol_qty(); BigDecimal mol_qty = dtl.getMol_qty();
ivt.setCanuse_qty(NumberUtil.sub(canuse_qty, mol_qty)); ivt.setCanuse_qty(NumberUtil.sub(canuse_qty, mol_qty));
ivt.setIvt_qty(NumberUtil.sub(ivt_qty, mol_qty)); ivt.setIvt_qty(NumberUtil.sub(ivt_qty, mol_qty));
// 更新载具扩展属性重量
MdPbStoragevehicleext vehicleDao = iMdPbStoragevehicleextService.getOne(
new QueryWrapper<MdPbStoragevehicleext>().lambda()
.eq(MdPbStoragevehicleext::getStoragevehicle_code, dtl.getStoragevehicle_code())
);
if (ObjectUtil.isNotEmpty(vehicleDao)) {
vehicleDao.setStorage_qty(NumberUtil.sub(vehicleDao.getStorage_qty(),mol_qty));
iMdPbStoragevehicleextService.updateById(vehicleDao);
}
// 判断是否有箱
MdPbBucketrecord buckDao = iMdPbBucketrecordService.getOne(
new QueryWrapper<MdPbBucketrecord>().lambda()
.eq(MdPbBucketrecord::getBucketunique, dtl.getBucketunique())
.eq(MdPbBucketrecord::getMaterial_id, dtl.getMaterial_id())
);
if (ObjectUtil.isNotEmpty(buckDao)) {
// 更新箱重量
buckDao.setStorage_qty(NumberUtil.sub(buckDao.getStorage_qty(), mol_qty));
iMdPbBucketrecordService.updateById(buckDao);
}
//如果库存变为0则删除记录 //如果库存变为0则删除记录
if (canuse_qty.compareTo(mol_qty) == 0 && canuse_qty.compareTo(ivt_qty) == 0) { if (canuse_qty.compareTo(mol_qty) == 0 && canuse_qty.compareTo(ivt_qty) == 0) {
iStIvtStructivtCpService.removeById(ivt.getStockrecord_id()); iStIvtStructivtCpService.removeById(ivt.getStockrecord_id());
// 更新箱记录表状态为出库
iMdPbBucketrecordService.update(
MdPbBucketrecord.builder()
.status(MasterEnum.BOX_STATUS.code("出库"))
.build(),
new QueryWrapper<MdPbBucketrecord>().lambda()
.eq(MdPbBucketrecord::getBucketunique, dtl.getBucketunique())
.eq(MdPbBucketrecord::getMaterial_id, dtl.getMaterial_id())
);
// 更新载具扩展属性 - 释放载具对应物料关系 清空数量
iMdPbStoragevehicleextService.update(
new MdPbStoragevehicleext()
.setMaterial_id("")
.setStorage_qty(BigDecimal.valueOf(0)),
new QueryWrapper<MdPbStoragevehicleext>().lambda()
.eq(MdPbStoragevehicleext::getStoragevehicle_code,dtl.getStoragevehicle_code())
);
// 更新货位 -- 清除载具号
structattrService.update(
new StIvtStructattr()
.setStoragevehicle_code("")
.setInv_id("")
.setInv_type("")
.setInv_code(""),
new QueryWrapper<StIvtStructattr>().lambda()
.eq(StIvtStructattr::getStruct_id, ivt.getStruct_id())
);
} else { } else {
iStIvtStructivtCpService.updateById(ivt); iStIvtStructivtCpService.updateById(ivt);
} }
@@ -177,12 +263,99 @@ public class StIvtMoreorlessmstCpServiceImpl extends ServiceImpl<StIvtMoreorless
.setInstorage_time(DateUtil.now()) .setInstorage_time(DateUtil.now())
.setStor_id(mst.getStor_id()) .setStor_id(mst.getStor_id())
); );
// 更新仓位 - 载具编码
struct_jo.setStoragevehicle_code(dtl.getStoragevehicle_code());
structattrService.updateById(struct_jo);
// 更新载具对应物料关系、数量
MdPbStoragevehicleext vehicleDao = iMdPbStoragevehicleextService.getOne(
new QueryWrapper<MdPbStoragevehicleext>().lambda()
.eq(MdPbStoragevehicleext::getStoragevehicle_code, dtl.getStoragevehicle_code())
);
if (ObjectUtil.isNotEmpty(vehicleDao)) {
vehicleDao.setStorage_qty(mol_qty);
vehicleDao.setMaterial_id(dtl.getMaterial_id());
iMdPbStoragevehicleextService.updateById(vehicleDao);
}
// 判断是否有箱
if (ObjectUtil.isNotEmpty(dtl.getBucketunique())) {
MdPbBucketrecord buckDao = iMdPbBucketrecordService.getOne(
new QueryWrapper<MdPbBucketrecord>().lambda()
.eq(MdPbBucketrecord::getBucketunique, dtl.getBucketunique())
.eq(MdPbBucketrecord::getMaterial_id, dtl.getMaterial_id())
);
if (ObjectUtil.isEmpty(buckDao)) {
// 新增一条箱记录
MdPbBucketrecord param = MdPbBucketrecord.builder()
.bucketunique(dtl.getBucketunique())
.material_id(dtl.getMaterial_id())
.pcsn(dtl.getPcsn())
.qty_unit_id(Long.valueOf(dtl.getQty_unit_id()))
.qty_unit_name(dtl.getQty_unit_name())
.storage_qty(dtl.getMol_qty())
.status(MasterEnum.BOX_STATUS.code("入库"))
.storagevehicle_code(dtl.getStoragevehicle_code())
.build();
iMdPbBucketrecordService.createBucke(param);
} else {
buckDao.setStorage_qty(dtl.getMol_qty());
buckDao.setStatus(MasterEnum.BOX_STATUS.code("入库"));
iMdPbBucketrecordService.updateById(buckDao);
}
}
} else { } else {
BigDecimal canuse_qty = ivt.getCanuse_qty(); BigDecimal canuse_qty = ivt.getCanuse_qty();
BigDecimal ivt_qty = ivt.getIvt_qty(); BigDecimal ivt_qty = ivt.getIvt_qty();
// 更新库存
ivt.setCanuse_qty(NumberUtil.add(canuse_qty, mol_qty)); ivt.setCanuse_qty(NumberUtil.add(canuse_qty, mol_qty));
ivt.setIvt_qty(NumberUtil.add(ivt_qty, mol_qty)); ivt.setIvt_qty(NumberUtil.add(ivt_qty, mol_qty));
iStIvtStructivtCpService.updateById(ivt); iStIvtStructivtCpService.updateById(ivt);
// 判断是否有箱
if (ObjectUtil.isNotEmpty(dtl.getBucketunique())) {
MdPbBucketrecord buckDao = iMdPbBucketrecordService.getOne(
new QueryWrapper<MdPbBucketrecord>().lambda()
.eq(MdPbBucketrecord::getBucketunique, dtl.getBucketunique())
.eq(MdPbBucketrecord::getMaterial_id, dtl.getMaterial_id())
);
if (ObjectUtil.isEmpty(buckDao)) {
// 新增一条箱记录
MdPbBucketrecord param = MdPbBucketrecord.builder()
.bucketunique(dtl.getBucketunique())
.material_id(dtl.getMaterial_id())
.pcsn(dtl.getPcsn())
.qty_unit_id(Long.valueOf(dtl.getQty_unit_id()))
.qty_unit_name(dtl.getQty_unit_name())
.storage_qty(dtl.getMol_qty())
.status(MasterEnum.BOX_STATUS.code("入库"))
.storagevehicle_code(dtl.getStoragevehicle_code())
.build();
iMdPbBucketrecordService.createBucke(param);
} else {
buckDao.setStorage_qty(NumberUtil.add(buckDao.getStorage_qty(), dtl.getMol_qty()));
buckDao.setStatus(MasterEnum.BOX_STATUS.code("入库"));
iMdPbBucketrecordService.updateById(buckDao);
}
}
// 更新载具扩展属性 - 数量
MdPbStoragevehicleext vehicleDao = iMdPbStoragevehicleextService.getOne(
new QueryWrapper<MdPbStoragevehicleext>().lambda()
.eq(MdPbStoragevehicleext::getStoragevehicle_code, dtl.getStoragevehicle_code())
);
if (ObjectUtil.isNotEmpty(vehicleDao)) {
vehicleDao.setStorage_qty(NumberUtil.add(vehicleDao.getStorage_qty(), dtl.getMol_qty()));
iMdPbStoragevehicleextService.updateById(vehicleDao);
}
} }
//更新明细状态 //更新明细状态

View File

@@ -25,4 +25,6 @@ public interface StIvtStructivtCpMapper extends BaseMapper<StIvtStructivtCp> {
List<Map> getStructIvtMore(@Param("query") StructIvtYLQuery query); List<Map> getStructIvtMore(@Param("query") StructIvtYLQuery query);
List<Map> getStructIvtMoreBox(JSONObject json);
} }

View File

@@ -74,6 +74,7 @@
sa.struct_id, sa.struct_id,
sa.struct_code, sa.struct_code,
sa.struct_name, sa.struct_name,
sa.storagevehicle_code,
class.class_name class.class_name
FROM FROM
ST_IVT_StructIvt_CP ivt ST_IVT_StructIvt_CP ivt
@@ -97,4 +98,44 @@
</where> </where>
</select> </select>
<select id="getStructIvtMoreBox" resultType="java.util.Map">
SELECT
buck.storage_qty AS ivt_qty,
buck.qty_unit_id,
buck.qty_unit_name,
buck.quality_scode,
buck.ivt_level,
buck.pcsn,
buck.material_id,
buck.bucketunique,
mb.material_code,
mb.material_name,
sa.sect_id,
sa.sect_code,
sa.sect_name,
sa.struct_id,
sa.struct_code,
sa.struct_name,
sa.storagevehicle_code,
class.class_name
FROM
md_pb_bucketrecord buck
LEFT JOIN md_me_materialbase mb ON mb.material_id = buck.material_id
LEFT JOIN st_ivt_structattr sa ON sa.storagevehicle_code = buck.storagevehicle_code
LEFT JOIN md_pb_classstandard class ON class.class_id = mb.material_type_id
<where>
buck.storage_qty > 0
AND
sa.lock_type = '0'
AND
buck.status = '3'
<if test="storagevehicle_code!= null and storagevehicle_code != ''">
and sa.storagevehicle_code = #{storagevehicle_code}
</if>
<if test="struct_code!= null and struct_code != ''">
and sa.struct_code = #{struct_code}
</if>
</where>
</select>
</mapper> </mapper>

View File

@@ -10,6 +10,8 @@ import org.nl.common.utils.IdUtil;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.masterdata_manage.service.material.IMdMeMaterialbaseService; import org.nl.wms.masterdata_manage.service.material.IMdMeMaterialbaseService;
import org.nl.wms.masterdata_manage.service.material.dao.MdMeMaterialbase; import org.nl.wms.masterdata_manage.service.material.dao.MdMeMaterialbase;
import org.nl.wms.masterdata_manage.service.vehicle.IMdPbBucketrecordService;
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbBucketrecord;
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService; import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr; import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
import org.nl.wms.storage_manage.productmanage.service.structIvt.IStIvtStructivtCpService; import org.nl.wms.storage_manage.productmanage.service.structIvt.IStIvtStructivtCpService;
@@ -43,6 +45,9 @@ public class StIvtStructivtCpServiceImpl extends ServiceImpl<StIvtStructivtCpMap
@Autowired @Autowired
protected IMdMeMaterialbaseService iMdMeMaterialbaseService; // 物料服务 protected IMdMeMaterialbaseService iMdMeMaterialbaseService; // 物料服务
@Autowired
protected IMdPbBucketrecordService iMdPbBucketrecordService; // 包装箱记录表服务
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void UpdateIvt(JSONObject json) { public void UpdateIvt(JSONObject json) {
@@ -95,7 +100,24 @@ public class StIvtStructivtCpServiceImpl extends ServiceImpl<StIvtStructivtCpMap
@Override @Override
public List<Map> getStructIvtMore(StructIvtYLQuery whereJson) { public List<Map> getStructIvtMore(StructIvtYLQuery whereJson) {
return this.baseMapper.getStructIvtMore(whereJson); // 判断货位是否有箱
List<Map> structIvtList = this.baseMapper.getStructIvtMore(whereJson);
if (ObjectUtil.isNotEmpty(structIvtList)) {
MdPbBucketrecord buckDao = iMdPbBucketrecordService.getOne(
new QueryWrapper<MdPbBucketrecord>().lambda()
.eq(MdPbBucketrecord::getStoragevehicle_code, structIvtList.get(0).get("storagevehicle_code")),
false
);
if (ObjectUtil.isNotEmpty(buckDao)) {
JSONObject param = new JSONObject();
param.put("storagevehicle_code",structIvtList.get(0).get("storagevehicle_code"));
param.put("struct_code",structIvtList.get(0).get("struct_code"));
structIvtList = this.baseMapper.getStructIvtMoreBox(param);
}
}
return structIvtList;
} }
/* /*

View File

@@ -8,11 +8,9 @@
<item spec="22" value="A1_HCX_02"></item> <item spec="22" value="A1_HCX_02"></item>
</param> </param>
</flow> </flow>
<flow id="A1_TWYTJ" name="推弯一体工序" sourceRef="A1_JGXL" targetRef="A1_TK"> <flow id="A1_TWYTJ" name="推弯一体工序" sourceRef="A1_JGXL" targetRef="A1_SKQX">
</flow> </flow>
<flow id="A1_TK" name="镗孔" sourceRef="A1_TWYTJ" targetRef="A1_SKQX"></flow>
<flow id="A1_SKQX" name="深坑清洗" sourceRef="A1_TWYTJ" targetRef="end"></flow> <flow id="A1_SKQX" name="深坑清洗" sourceRef="A1_TWYTJ" targetRef="end"></flow>
<end id="end" name="Junior Reject End" sourceRef="A1_SKQX"></end> <end id="end" name="Junior Reject End" sourceRef="A1_SKQX"></end>
</process> </process>

View File

@@ -132,11 +132,12 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<rrOperation /> <rrOperation />
</el-form> </el-form>
</div> </div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'--> <!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<el-button type="primary" @click="taskScheduler()" >任务调度</el-button>
<crudOperation :permission="permission" /> <crudOperation :permission="permission" />
<!--表格渲染--> <!--表格渲染-->
<el-table <el-table
@@ -148,9 +149,9 @@
@selection-change="crud.selectionChangeHandler" @selection-change="crud.selectionChangeHandler"
> >
<el-table-column type="selection" width="50" /> <el-table-column type="selection" width="50" />
<el-table-column prop="task_code" label="任务编码" min-width="100" show-overflow-tooltip />
<el-table-column v-if="true" prop="task_id" label="任务标识" min-width="150" show-overflow-tooltip /> <el-table-column v-if="true" prop="task_id" label="任务标识" min-width="150" show-overflow-tooltip />
<el-table-column v-if="true" prop="material_id" label="物料标识" min-width="150" show-overflow-tooltip /> <el-table-column v-if="true" prop="material_id" label="物料标识" min-width="150" show-overflow-tooltip />
<el-table-column prop="task_code" label="任务编码" min-width="100" show-overflow-tooltip />
<el-table-column prop="acs_task_type" label="acs任务类型" min-width="120" show-overflow-tooltip> <el-table-column prop="acs_task_type" label="acs任务类型" min-width="120" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
{{ acsTaskTypeList[scope.row.acs_task_type - 1] }} {{ acsTaskTypeList[scope.row.acs_task_type - 1] }}
@@ -160,21 +161,20 @@
<el-table-column v-if="false" prop="task_status" label="任务状态" /> <el-table-column v-if="false" prop="task_status" label="任务状态" />
<el-table-column prop="product_area" label="生产车间" /> <el-table-column prop="product_area" label="生产车间" />
<el-table-column prop="task_status_name" label="任务状态" width="120px" :formatter="formatTaskStatusName" /> <el-table-column prop="task_status_name" label="任务状态" width="120px" :formatter="formatTaskStatusName" />
<el-table-column prop="vehicle_type" label="载具类型" min-width="100" show-overflow-tooltip>
<template slot-scope="scope">
{{ dict.label.vehicle_type[scope.row.vehicle_type] }}
</template>
</el-table-column>
<el-table-column prop="point_code1" label="起点" width="100" /> <el-table-column prop="point_code1" label="起点" width="100" />
<el-table-column prop="point1_region_name" label="起点区域" width="120" /> <el-table-column prop="point1_region_name" label="起点区域" width="120" />
<el-table-column prop="point_code2" label="终点" min-width="100" show-overflow-tooltip /> <el-table-column prop="point_code2" label="终点" min-width="100" show-overflow-tooltip />
<el-table-column prop="point2_region_name" label="终点区域" min-width="120" show-overflow-tooltip /> <el-table-column prop="point2_region_name" label="终点区域" min-width="120" show-overflow-tooltip />
<el-table-column prop="point_code3" label="返回点" min-width="100" show-overflow-tooltip /> <el-table-column prop="point_code3" label="返回点" min-width="100" show-overflow-tooltip />
<el-table-column prop="point3_region_name" label="返回点区域" min-width="120" show-overflow-tooltip /> <el-table-column prop="point3_region_name" label="返回点区域" min-width="120" show-overflow-tooltip />
<!-- <el-table-column prop="point_code4" label="点位4" min-width="100" show-overflow-tooltip />-->
<!-- <el-table-column prop="point4_region_name" label="点位4区域" min-width="120" show-overflow-tooltip />-->
<el-table-column prop="vehicle_code" label="载具编码1" min-width="100" show-overflow-tooltip /> <el-table-column prop="vehicle_code" label="载具编码1" min-width="100" show-overflow-tooltip />
<el-table-column prop="vehicle_code2" label="载具编码2" min-width="100" show-overflow-tooltip /> <el-table-column prop="vehicle_code2" label="载具编码2" min-width="100" show-overflow-tooltip />
<el-table-column prop="vehicle_type" label="载具类型" min-width="100" show-overflow-tooltip>
<template slot-scope="scope">
{{ dict.label.vehicle_type[scope.row.vehicle_type] }}
</template>
</el-table-column>
<el-table-column prop="remark" label="提示" width="120" show-overflow-tooltip /> <el-table-column prop="remark" label="提示" width="120" show-overflow-tooltip />
<el-table-column prop="finished_type" label="任务完成类型" min-width="100" show-overflow-tooltip> <el-table-column prop="finished_type" label="任务完成类型" min-width="100" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
@@ -242,6 +242,7 @@ import pagination from '@crud/Pagination'
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect' import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import crudClassstandard from '@/api/wms/basedata/master/classstandard' import crudClassstandard from '@/api/wms/basedata/master/classstandard'
import {scheduler} from "./task";
export default { export default {
name: 'Task', name: 'Task',
@@ -255,7 +256,7 @@ export default {
title: '任务', title: '任务',
url: 'api/task', url: 'api/task',
idField: 'task_id', idField: 'task_id',
sort: 'task_id,desc', sort: 'task_code,desc',
crudMethod: { ...crudTask }, crudMethod: { ...crudTask },
query: { query: {
task_code: '', task_code: '',
@@ -323,6 +324,11 @@ export default {
this.classes1 = data this.classes1 = data
}) })
}, },
taskScheduler() {
crudTask.scheduler().then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
},
buildTree(classes) { buildTree(classes) {
classes.forEach(data => { classes.forEach(data => {
if (data.children) { if (data.children) {

View File

@@ -58,6 +58,12 @@ export function operation(data) {
data data
}) })
} }
export function scheduler() {
return request({
url: '/api/acsToWms/task/taskPublish',
method: 'get'
})
}
export default { export default {
add, add,
@@ -67,5 +73,6 @@ export default {
getTaskStatus, getTaskStatus,
getTaskType, getTaskType,
getAcsTaskType, getAcsTaskType,
getFinishType getFinishType,
scheduler
} }

View File

@@ -391,9 +391,11 @@ export default {
this.form.sect_name = row.sect_name this.form.sect_name = row.sect_name
this.form.struct_name = row.struct_name this.form.struct_name = row.struct_name
crudMoreOrless.getStructIvt({'struct_id': row.struct_id}).then(res => { crudMoreOrless.getStructIvt({'struct_id': row.struct_id}).then(res => {
debugger
this.form.tableData = res this.form.tableData = res
for (let i = 0; i < this.form.tableData.length; i++) { for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i] const row = this.form.tableData[i]
row.material_id = row.material_id.toString()
this.$set(row, 'edit', false) this.$set(row, 'edit', false)
this.form.tableData.splice(i, 1, row) this.form.tableData.splice(i, 1, row)
} }
@@ -407,7 +409,7 @@ export default {
this.nowrow = row this.nowrow = row
}, },
async queryStruct() { async queryStruct() {
if (!this.form.mol_type) { if (!this.form.mol_type) {structShow
this.crud.notify('请先选择损溢类型!', CRUD.NOTIFICATION_TYPE.INFO) this.crud.notify('请先选择损溢类型!', CRUD.NOTIFICATION_TYPE.INFO)
return return
} }
@@ -450,6 +452,7 @@ export default {
this.form.struct_name = '' this.form.struct_name = ''
}, },
handleEdit(index, row) { handleEdit(index, row) {
row.material_id = row.material_id.toString()
if (!row.edit) { if (!row.edit) {
if (typeof (row.mol_qty) === 'undefined' | (parseFloat(row.mol_qty) <= 0)) { if (typeof (row.mol_qty) === 'undefined' | (parseFloat(row.mol_qty) <= 0)) {
this.crud.notify('不允许损溢数量为0', CRUD.NOTIFICATION_TYPE.INFO) this.crud.notify('不允许损溢数量为0', CRUD.NOTIFICATION_TYPE.INFO)
@@ -459,6 +462,10 @@ export default {
this.crud.notify('物料不可为空!', CRUD.NOTIFICATION_TYPE.INFO) this.crud.notify('物料不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false return false
} }
if (!row.storagevehicle_code) {
this.crud.notify('载具号不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (this.form.mol_type === '0' && (parseFloat(row.ivt_qty) < parseFloat(row.mol_qty))) { if (this.form.mol_type === '0' && (parseFloat(row.ivt_qty) < parseFloat(row.mol_qty))) {
this.crud.notify('不允许损数量大于库存数量!', CRUD.NOTIFICATION_TYPE.INFO) this.crud.notify('不允许损数量大于库存数量!', CRUD.NOTIFICATION_TYPE.INFO)
return false return false

View File

@@ -157,7 +157,7 @@
<!--分页组件--> <!--分页组件-->
<pagination /> <pagination />
</div> </div>
<AddDialog @AddChanged="querytable" /> <!-- <AddDialog @AddChanged="querytable" />-->
</div> </div>
</template> </template>
@@ -168,13 +168,13 @@ import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation' import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination' import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker/index' import DateRangePicker from '@/components/DateRangePicker/index'
import AddDialog from '@/views/wms/storage_manage/semiproduct/semiproductMoreOrless/AddDialog' // import AddDialog from '@/views/wms/storage_manage/semiproduct/semiproductMoreOrless/AddDialog'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import crudStorattr from '@/api/wms/basedata/st/storattr' import crudStorattr from '@/api/wms/basedata/st/storattr'
export default { export default {
name: 'MoreOrLess', name: 'MoreOrLess',
components: { AddDialog, crudOperation, rrOperation, udOperation, pagination, DateRangePicker }, components: { crudOperation, rrOperation, udOperation, pagination, DateRangePicker },
cruds() { cruds() {
return CRUD({ return CRUD({
title: '', title: '',

View File

@@ -15,9 +15,11 @@ import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl; import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService; import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl; import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.DataInputStream; import java.io.DataInputStream;
@@ -33,23 +35,22 @@ import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
@Slf4j @Slf4j
@Component @Component
public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
@Autowired
private ParamService paramService;
@Autowired
private InstructionService instructionService;
@Autowired
private TaskService taskService;
@Autowired
private NDCAgvService ndcAgvService;
@Autowired
private DeviceAppService deviceAppService;
Socket s; private Socket socket;
String ip = "192.168.46.225"; private static DataOutputStream dos;
int port = 1234; private static DataInputStream dis;
static DataOutputStream dos;
static DataInputStream dis;
private int recordTimeOut = 10000;
private Date recordTime;
String[] ERROR = new String[]{
"货叉尖部传感器触发", "S300传感器触发", "载货状态改变", "急停按钮触发", "触边开关出发", "需要复位",
"停在充电位", "取货失败", "放货失败", "轮子打滑", "没有动作码不能进入站点", "取货时有货", "丢失定位",
"抬叉停止"};
boolean bConnected = true;
public NDCSocketConnectionAutoRun() { public NDCSocketConnectionAutoRun() {
this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut);
} }
@Override @Override
@@ -65,37 +66,30 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
@Override @Override
public void autoRun() throws IOException { public void autoRun() throws IOException {
try { try {
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class); String ip = paramService.findByCode(AcsConfig.AGVURL).getValue();
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class); int port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue());
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class); socket = new Socket(ip, port);
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class); byte[] bytes = new byte[1024];
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); dos = new DataOutputStream(socket.getOutputStream());
ip = paramService.findByCode(AcsConfig.AGVURL).getValue(); dis = new DataInputStream(socket.getInputStream());
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue()); int len;
byte[] b = new byte[1028]; int[] arr;
s = new Socket(ip, port); StringBuffer sb;
dos = new DataOutputStream(s.getOutputStream()); while ((len = dis.read(bytes)) != -1) {
dis = new DataInputStream(s.getInputStream()); arr = new int[len];
sb = new StringBuffer();
while (bConnected) { for (int i = 0; i < len; i++) {
int count = dis.read(b); int temp = bytes[i];
if (count == -1) {
break;
}
int[] arr = new int[count];
StringBuffer bs = new StringBuffer();
for (int i = 0; i < count; i++) {
int temp = b[i];
if (temp < 0) if (temp < 0)
temp += 256; temp += 256;
arr[i] = temp; arr[i] = temp;
StringBuffer bs1 = new StringBuffer("0"); StringBuffer bs1 = new StringBuffer("0");
bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp)); sb.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp));
} }
if (arr[8] * 256 + arr[9] == 0x73) { if (arr[8] * 256 + arr[9] == 0x73) {
byte[] data = null; byte[] data = null;
System.out.println("接收agv上报信息" + bs); System.out.println("接收agv上报信息" + sb);
//执行阶段 //执行阶段
int phase = arr[16] * 256 + arr[17]; int phase = arr[16] * 256 + arr[17];
// agv任务号 // agv任务号
@@ -114,7 +108,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
insts = instructionService.findByLinkNum(String.valueOf(ikey)); insts = instructionService.findByLinkNum(String.valueOf(ikey));
} }
log.info("接收agv上报信息" + bs); log.info("接收agv上报信息" + sb);
log.info("接收agv上报信息" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno); log.info("接收agv上报信息" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno);
Device device = null; Device device = null;
// //
@@ -147,12 +141,6 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} }
log.info("修改指令执行信息成功,指令号:{}", inst.getInstruction_code()); log.info("修改指令执行信息成功,指令号:{}", inst.getInstruction_code());
} }
// for (Instruction inst : insts) {
// inst.setInstruction_status("1");
// inst.setAgv_jobno(String.valueOf(index));
// instructionService.update(inst);
// log.info("修改指令执行信息成功,指令号:{}", inst.getInstruction_code());
// }
} }
} }
if (flag) { if (flag) {
@@ -161,10 +149,6 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} }
} }
} else if (phase == 0x1A) { } else if (phase == 0x1A) {
//任务完毕无车id及状态
// for (Instruction inst : insts) {
// instructionService.finish(inst.getInstruction_id());
// }
instructionService.finishByLinkNum(String.valueOf(ikey)); instructionService.finishByLinkNum(String.valueOf(ikey));
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else if (phase == 0x30) { } else if (phase == 0x30) {
@@ -196,21 +180,15 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
System.out.println("agv上报不是0073类型动作不处理"); System.out.println("agv上报不是0073类型动作不处理");
} }
} }
} catch (Exception e) { } catch (Exception e) {
System.out.println("双工Agv链接异常");
log.info("双工AGV链接异常");
log.error("agv连接出现异常:{}", JSON.toJSONString(e)); log.error("agv连接出现异常:{}", JSON.toJSONString(e));
if (ObjectUtil.isNotEmpty(s)) { if (ObjectUtil.isNotEmpty(socket)) {
s.close(); socket.close();
} }
System.out.println(e.getMessage());
e.printStackTrace();
} finally { } finally {
} }
} }
@@ -218,7 +196,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
public void stop() { public void stop() {
super.after(); super.after();
try { try {
s.close(); socket.close();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -232,9 +210,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
dos.write(b); dos.write(b);
dos.flush(); dos.flush();
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block throw new BadRequestException(e.getMessage());
e.printStackTrace();
} }
} }
} }

View File

@@ -1,6 +1,7 @@
package org.nl.acs.auto.run; package org.nl.acs.auto.run;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig; import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.agv.server.NDCAgvService;
@@ -11,9 +12,12 @@ import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.instruction.service.impl.InstructionServiceImpl; import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
import org.nl.acs.opc.Device; import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService; import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl; import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.DataInputStream; import java.io.DataInputStream;
@@ -29,23 +33,21 @@ import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
@Slf4j @Slf4j
@Component @Component
public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
@Autowired
private ParamService paramService;
@Autowired
private InstructionService instructionService;
@Autowired
private NDCAgvService ndcAgvService;
@Autowired
private DeviceAppService deviceAppService;
Socket s; private Socket socket;
String ip = "192.168.46.225"; private static DataOutputStream dos;
int port = 1234; private static DataInputStream dis;
static DataOutputStream dos;
static DataInputStream dis;
private int recordTimeOut = 10000;
private Date recordTime;
String[] ERROR = new String[]{
"货叉尖部传感器触发", "S300传感器触发", "载货状态改变", "急停按钮触发", "触边开关出发", "需要复位",
"停在充电位", "取货失败", "放货失败", "轮子打滑", "没有动作码不能进入站点", "取货时有货", "丢失定位",
"抬叉停止"};
boolean bConnected = true;
public OneNDCSocketConnectionAutoRun() { public OneNDCSocketConnectionAutoRun() {
this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut);
} }
@Override @Override
@@ -60,40 +62,27 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
@Override @Override
public void autoRun() throws IOException { public void autoRun() throws IOException {
System.out.println("OneAgv链接开始");
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class);
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
ip = paramService.findByCode(AcsConfig.ONEAGVURL).getValue();
port = Integer.parseInt(paramService.findByCode(AcsConfig.ONEAGVPORT).getValue());
try { try {
String ip = paramService.findByCode(AcsConfig.ONEAGVURL).getValue();
byte[] b = new byte[1028]; int port = Integer.parseInt(paramService.findByCode(AcsConfig.ONEAGVPORT).getValue());
s = new Socket(ip, port); socket = new Socket(ip, port);
dos = new DataOutputStream(s.getOutputStream()); dos = new DataOutputStream(socket.getOutputStream());
dis = new DataInputStream(s.getInputStream()); dis = new DataInputStream(socket.getInputStream());
System.out.println("OneAgv链接成功"); byte[] bytes = new byte[1024];
while (bConnected) { int count;
int count = dis.read(b); int[] arr;
if (count == -1) { StringBuffer bs;
break; while ((count = dis.read(bytes)) != -1) {
} arr = new int[count];
int[] arr = new int[count]; bs = new StringBuffer();
StringBuffer bs = new StringBuffer();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
int temp = b[i]; int temp = bytes[i];
if (temp < 0) if (temp < 0)
temp += 256; temp += 256;
arr[i] = temp; arr[i] = temp;
StringBuffer bs1 = new StringBuffer("0"); StringBuffer bs1 = new StringBuffer("0");
bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp)); bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp));
} }
//System.out.println("收到请求参数:" + bs);
boolean flag = false;
if (arr[8] * 256 + arr[9] == 0x73) { if (arr[8] * 256 + arr[9] == 0x73) {
byte[] data = null; byte[] data = null;
System.out.println("接收agv上报信息" + bs); System.out.println("接收agv上报信息" + bs);
@@ -114,28 +103,20 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
log.info("接收agv上报信息" + bs); log.info("接收agv上报信息" + bs);
log.info("接收agv上报信息" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno); log.info("接收agv上报信息" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno);
Device device = null; Device device = null;
String device_code = null;
//
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; AgvNdcOneDeviceDriver agvNdcOneDeviceDriver;
//开始任务/上报订单号 //开始任务/上报订单号
if (phase == 0x01) { if (phase == 0x01) {
for (Instruction inst : insts) { if (ObjectUtil.isNotEmpty(insts)) {
inst.setInstruction_status("1"); for (Instruction inst : insts) {
inst.setAgv_jobno(String.valueOf(index)); inst.setInstruction_status("1");
inst.setSend_status("1"); inst.setAgv_jobno(String.valueOf(index));
instructionService.update(inst); inst.setSend_status("1");
instructionService.update(inst);
}
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
} }
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
} else if (phase == 0x0A) { } else if (phase == 0x0A) {
// for (Instruction inst : insts) {
// instructionService.finish(inst.getInstruction_id());
// }
instructionService.finishByLinkNum(String.valueOf(ikey)); instructionService.finishByLinkNum(String.valueOf(ikey));
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0); data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
@@ -143,10 +124,6 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
data = ndcAgvService.sendAgvOneModeInst(143, index, 0); data = ndcAgvService.sendAgvOneModeInst(143, index, 0);
} else if (phase == 0xFF) { } else if (phase == 0xFF) {
// for (Instruction inst : insts) {
// instructionService.cancelNoSendAgv(inst.getInstruction_id());
// }
instructionService.cancelByLinkNum(String.valueOf(ikey)); instructionService.cancelByLinkNum(String.valueOf(ikey));
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0); data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
} else if (phase == 0x50) { } else if (phase == 0x50) {
@@ -176,18 +153,13 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} }
} catch (Exception e) { } catch (Exception e) {
System.out.println("OneAgv链接异常"); log.error("agv连接出现异常:{}", JSON.toJSONString(e));
if (ObjectUtil.isNotEmpty(s)) { if (ObjectUtil.isNotEmpty(socket)) {
s.close(); socket.close();
} }
System.out.println(e.getMessage());
e.printStackTrace();
} finally { } finally {
} }
} }
@@ -195,7 +167,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
public void stop() { public void stop() {
super.after(); super.after();
try { try {
s.close(); socket.close();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -209,8 +181,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
dos.write(b); dos.write(b);
dos.flush(); dos.flush();
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block throw new BadRequestException(e.getMessage());
e.printStackTrace();
} }
} }

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.basedriver.hailiang_one; package org.nl.acs.device_driver.basedriver.hailiang_one;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**
@@ -8,7 +9,7 @@ import java.util.concurrent.ConcurrentHashMap;
*/ */
public class MonitoringLargeScreenData { public class MonitoringLargeScreenData {
//存储倒料位剩余物料个数并返库MES //存储倒料位剩余物料个数并返库MES
public static ConcurrentHashMap<String, Integer> deviceNumData = new ConcurrentHashMap<>(); public static ConcurrentHashMap<String, Map<String, Integer>> deviceNumData = new ConcurrentHashMap<>();
//存储工单数量并反馈MES //存储工单数量并反馈MES
public static ConcurrentHashMap<String, Integer> orderData = new ConcurrentHashMap<>(); public static ConcurrentHashMap<String, Integer> orderData = new ConcurrentHashMap<>();
} }

View File

@@ -140,7 +140,10 @@ public class HailiangCleaningMachineStorageStationDeviceDriver extends AbstractO
logServer.deviceExecuteLog(this.device_code, "", "", "信号is_open" + last_is_open + "->" + is_open); logServer.deviceExecuteLog(this.device_code, "", "", "信号is_open" + last_is_open + "->" + is_open);
} }
if (silo_weight != last_silo_weight) { if (silo_weight != last_silo_weight) {
MonitoringLargeScreenData.deviceNumData.put(this.device_code, this.getSilo_weight()); Map<String, Integer> feedNumMap = new HashMap<>();
feedNumMap.put("qty", this.getFull_number());
feedNumMap.put("weight", this.getSilo_weight());
MonitoringLargeScreenData.deviceNumData.put(this.device_code, feedNumMap);
logServer.deviceExecuteLog(this.device_code, "", "", "信号silo_weight" + last_silo_weight + "->" + silo_weight); logServer.deviceExecuteLog(this.device_code, "", "", "信号silo_weight" + last_silo_weight + "->" + silo_weight);
} }
if (full_number != last_full_number) { if (full_number != last_full_number) {

View File

@@ -296,6 +296,7 @@ public class EalingMachineDeviceDriver extends AbstractOpcDeviceDriver implement
public void issuedOrderFinish(String autoFinish) { public void issuedOrderFinish(String autoFinish) {
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) { if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
this.writing("to_order_compel_finished", "1"); this.writing("to_order_compel_finished", "1");
this.writing("to_confirm_finished", "1");
} else { } else {
this.writing("to_confirm_finished", "1"); this.writing("to_confirm_finished", "1");
} }

View File

@@ -671,6 +671,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) { if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_order_compel_finished", "1"); map.put("to_order_compel_finished", "1");
map.put("to_confirm_finished", "1");
} else { } else {
map.put("to_confirm_finished", "1"); map.put("to_confirm_finished", "1");
} }

View File

@@ -246,7 +246,7 @@ public class HailiangOldSpecialDeviceDriver extends AbstractOpcDeviceDriver impl
message = "未联机"; message = "未联机";
//有报警 //有报警
} else { } else {
// this.setIsonline(true); // this.setIsonline(true);
this.setIserror(false); this.setIserror(false);
message = ""; message = "";
} }
@@ -325,6 +325,7 @@ public class HailiangOldSpecialDeviceDriver extends AbstractOpcDeviceDriver impl
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) { if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_order_compel_finished", "1"); map.put("to_order_compel_finished", "1");
map.put("to_confirm_finished", "1");
} else { } else {
map.put("to_confirm_finished", "1"); map.put("to_confirm_finished", "1");
} }

View File

@@ -180,7 +180,7 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
message = ""; message = "";
//满料位满足联机有货有工单时向MES申请任务 //满料位满足联机有货有工单时向MES申请任务
if (mode == 1 && move == 1 && order > 0 && !requireSucess) { if (mode == 1 && move == 1 && order > 0 && full_number > 0 && !requireSucess) {
boolean flag = apply_task(); boolean flag = apply_task();
this.noApplyTaskMessage = null; this.noApplyTaskMessage = null;
if (flag) { if (flag) {
@@ -204,7 +204,7 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
//agv到达取货位 //agv到达取货位
if (agvphase == 0x03 || agvphase == 0x07) { if (agvphase == 0x03 || agvphase == 0x07) {
if (mode == 1 && move == 1 && full_number > 0 && ObjectUtil.isNotEmpty(inst)) { if (mode == 1 && move == 1 && ObjectUtil.isNotEmpty(inst)) {
//下发取货位agv取货就绪 //下发取货位agv取货就绪
this.writing("to_agv_ready", "1"); this.writing("to_agv_ready", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode()); inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode());
@@ -223,9 +223,6 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
if (move == 0) { if (move == 0) {
notFeedAgvMessage += "光电信号无货,"; notFeedAgvMessage += "光电信号无货,";
} }
if (full_number == 0) {
notFeedAgvMessage += "满框数量为0,";
}
if (inst == null) { if (inst == null) {
notFeedAgvMessage += "AGV指令为空,"; notFeedAgvMessage += "AGV指令为空,";
} }

View File

@@ -40,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
@@ -141,7 +142,9 @@ public class HailiangOldSpecialPourStationDeviceDriver extends AbstractOpcDevice
if (storage_stock_num != last_storage_stock_num) { if (storage_stock_num != last_storage_stock_num) {
if (order > 0 && this.itemProtocol.getIsonline() && ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) { if (order > 0 && this.itemProtocol.getIsonline() && ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) {
MonitoringLargeScreenData.deviceNumData.put(this.getDevice().getExtraValue().get("link_device_code").toString(), this.getStorage_stock_num()); Map<String, Integer> feedNumMap = new HashMap<>();
feedNumMap.put("qty", this.getStorage_stock_num());
MonitoringLargeScreenData.deviceNumData.put(this.getDevice().getExtraValue().get("link_device_code").toString(), feedNumMap);
} }
if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("min_num")) && storage_stock_num == Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != -1) { if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("min_num")) && storage_stock_num == Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != -1) {
requireSucess = false; requireSucess = false;

View File

@@ -643,6 +643,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) { if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_order_compel_finished", "1"); map.put("to_order_compel_finished", "1");
map.put("to_confirm_finished", "1");
} else { } else {
map.put("to_confirm_finished", "1"); map.put("to_confirm_finished", "1");
} }

View File

@@ -299,6 +299,7 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) { if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_order_compel_finished", "1"); map.put("to_order_compel_finished", "1");
map.put("to_confirm_finished", "1");
} else { } else {
map.put("to_confirm_finished", "1"); map.put("to_confirm_finished", "1");
} }

View File

@@ -182,7 +182,7 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
message = ""; message = "";
//工作模式联机、满料位有货、工单号大于0 就申请agv任务 //工作模式联机、满料位有货、工单号大于0 就申请agv任务
if (mode == 1 && move == 1 && order > 0 && !requireSucess) { if (mode == 1 && move == 1 && full_number > 0 && order > 0 && !requireSucess) {
boolean flag = apply_task(); boolean flag = apply_task();
this.noApplyTaskMessage = null; this.noApplyTaskMessage = null;
if (flag) { if (flag) {
@@ -206,7 +206,7 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
//agv到达取货点 //agv到达取货点
if (agvphase == 0x03 || agvphase == 0x07) { if (agvphase == 0x03 || agvphase == 0x07) {
if (mode == 1 && move == 1 && full_number > 0 && ObjectUtil.isNotEmpty(inst)) { if (mode == 1 && move == 1 && ObjectUtil.isNotEmpty(inst)) {
//下发取货位agv取货就绪 //下发取货位agv取货就绪
this.writing("to_agv_ready", "1"); this.writing("to_agv_ready", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode()); inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode());
@@ -225,9 +225,6 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
if (move == 0) { if (move == 0) {
notFeedAgvMessage += "光电信号无货,"; notFeedAgvMessage += "光电信号无货,";
} }
if (full_number == 0) {
notFeedAgvMessage += "满框数量为0,";
}
if (inst == null) { if (inst == null) {
notFeedAgvMessage += "AGV指令为空,"; notFeedAgvMessage += "AGV指令为空,";
} }

View File

@@ -40,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
@@ -142,7 +143,9 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
} }
if (storage_stock_num != last_storage_stock_num) { if (storage_stock_num != last_storage_stock_num) {
if (order > 0 && this.itemProtocol.getIsonline() && ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) { if (order > 0 && this.itemProtocol.getIsonline() && ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) {
MonitoringLargeScreenData.deviceNumData.put(this.getDevice().getExtraValue().get("link_device_code").toString(), this.getStorage_stock_num()); Map<String, Integer> feedNumMap = new HashMap<>();
feedNumMap.put("qty", this.getStorage_stock_num());
MonitoringLargeScreenData.deviceNumData.put(this.getDevice().getExtraValue().get("link_device_code").toString(), feedNumMap);
} }
if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("min_num")) && storage_stock_num == Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != -1) { if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("min_num")) && storage_stock_num == Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != -1) {
requireSucess = false; requireSucess = false;

View File

@@ -418,6 +418,7 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) { if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_compel_finish", "1"); map.put("to_compel_finish", "1");
map.put("to_confirm_finished", "1");
} else { } else {
map.put("to_confirm_finished", "1"); map.put("to_confirm_finished", "1");
} }

View File

@@ -210,6 +210,7 @@ public class UnboxingMachineDeviceDriver extends AbstractOpcDeviceDriver impleme
public void issuedOrderFinish(String autoFinish) { public void issuedOrderFinish(String autoFinish) {
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) { if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
this.writing("to_order_compel_finished", "1"); this.writing("to_order_compel_finished", "1");
this.writing("to_confirm_finished", "1");
} else { } else {
this.writing("to_confirm_finished", "1"); this.writing("to_confirm_finished", "1");
} }

View File

@@ -52,7 +52,7 @@ public interface AcsToWmsService {
* @param map * @param map
* @return * @return
*/ */
HttpResponse feedDeviceNum(Map<String, Integer> map); HttpResponse feedDeviceNum(Map<String, Map<String,Integer>> map);
/** /**

View File

@@ -106,7 +106,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
result = HttpRequest.post(url) result = HttpRequest.post(url)
.body(JSON.toJSONString(param)) .body(JSON.toJSONString(param))
.execute(); .execute();
log.info("acs向mes反馈工单状态成功,请求路径:{},请求参数:{},响应参数:{}", url, JSON.toJSONString(param), JSON.toJSONString(result)); log.info("acs向mes反馈工单状态成功,请求路径:{},请求参数:{},响应参数:{}", url, JSON.toJSONString(param), JSON.toJSONString(result.body()));
} catch (Exception e) { } catch (Exception e) {
log.error("acs向mes反馈工单状态失败,请求路径:{},请求参数:{},失败原因:{}", url, JSON.toJSONString(param), e.getMessage()); log.error("acs向mes反馈工单状态失败,请求路径:{},请求参数:{},失败原因:{}", url, JSON.toJSONString(param), e.getMessage());
} }
@@ -148,10 +148,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override @Override
public HttpResponse feedOrderRealQty(JSONObject param) { public HttpResponse feedOrderRealQty(JSONObject param) {
log.info("acs开始向mes反馈当前设备工单生产数量,请求参数:{}", JSON.toJSONString(param));
try { try {
MDC.put(log_file_type, log_type); MDC.put(log_file_type, log_type);
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
log.info("acs开始向mes反馈当前设备工单生产数量,请求参数:{}", JSON.toJSONString(param));
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("feedOrderRealQty"); AddressDto addressDto = addressService.findByCode("feedOrderRealQty");
String methods_url = addressDto.getMethods_url(); String methods_url = addressDto.getMethods_url();
@@ -175,11 +175,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
@Override @Override
public HttpResponse feedDeviceNum(Map<String, Integer> map) { public HttpResponse feedDeviceNum(Map<String, Map<String, Integer>> map) {
log.info("acs开始向mes反馈设备数量,请求参数:{}", JSON.toJSONString(map));
try { try {
MDC.put(log_file_type, log_type); MDC.put(log_file_type, log_type);
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
log.info("acs开始向mes反馈设备数量,请求参数:{}", JSON.toJSONString(map));
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("feedDeviceNum"); AddressDto addressDto = addressService.findByCode("feedDeviceNum");
String methods_url = addressDto.getMethods_url(); String methods_url = addressDto.getMethods_url();

View File

@@ -520,6 +520,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (ObjectUtil.isNotEmpty(dto.getVehicle_code())) { if (ObjectUtil.isNotEmpty(dto.getVehicle_code())) {
feed_jo.put("vehicle_code", dto.getVehicle_code()); feed_jo.put("vehicle_code", dto.getVehicle_code());
} }
if (ObjectUtil.isNotEmpty(dto.getWeight())) {
feed_jo.put("weight", dto.getWeight());
}
feed_jo.put("ext_param", dto.getExt_param()); feed_jo.put("ext_param", dto.getExt_param());
JSONArray ja = new JSONArray(); JSONArray ja = new JSONArray();
ja.add(feed_jo); ja.add(feed_jo);