feat: 管芯库出入
This commit is contained in:
@@ -39,4 +39,10 @@ public interface WmsToAcsService {
|
||||
* @return /
|
||||
*/
|
||||
JSONObject canFinishPreviousTask(JSONArray param);
|
||||
/**
|
||||
* 通知ACS可以完成任务
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject toAcsGxInStorage(JSONArray param);
|
||||
}
|
||||
|
||||
@@ -52,4 +52,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
return AcsUtil.notifyAcs(api, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject toAcsGxInStorage(JSONArray param) {
|
||||
return AcsUtil.notifyAcs4("/api/wms/getTubeMsg", param);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class GxPdaController {
|
||||
@PostMapping("/confirmedInStorage")
|
||||
@Log("管芯确认入库")
|
||||
public ResponseEntity<Object> confirmedInStorage(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(gxPdaService.confirmedInStorage(param), HttpStatus.OK);
|
||||
return new ResponseEntity<>(gxPdaService.confirmedInStorageV2(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/remainingQty")
|
||||
@Log("管芯剩余数量")
|
||||
|
||||
@@ -22,6 +22,13 @@ public interface GxPdaService {
|
||||
*/
|
||||
JSONObject confirmedInStorage(JSONObject param);
|
||||
|
||||
/**
|
||||
* 管芯入库2:当前使用版本
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject confirmedInStorageV2(JSONObject param);
|
||||
|
||||
/**
|
||||
* 管芯剩余数量
|
||||
* @return
|
||||
|
||||
@@ -12,12 +12,11 @@ import org.nl.wms.basedata.master.classification.service.IMdBaseClassstandardSer
|
||||
import org.nl.wms.basedata.master.classification.service.dao.MdBaseClassstandard;
|
||||
import org.nl.wms.basedata.material.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.basedata.material.service.ImdMeMaterialbaseService;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.pda.st.service.GxPdaService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task_manage.core.constant.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.core.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.tasks.nbj.GxInStorageTask;
|
||||
import org.nl.wms.sch.task_manage.tasks.nbj.GxOutStorageTask;
|
||||
import org.nl.wms.util.URLEnum;
|
||||
import org.slf4j.MDC;
|
||||
@@ -30,8 +29,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.nl.wms.util.PointUtils.clearPointNotUpdate;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
@@ -48,8 +45,12 @@ public class GxPdaServiceImpl implements GxPdaService {
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private GxOutStorageTask gxOutStorageTask;
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
|
||||
@Override
|
||||
public JSONArray getGxSpecification() {
|
||||
// todo: 可能维护到物料表中!!!
|
||||
MdBaseClassstandard one = classstandardService.getOne(new LambdaQueryWrapper<MdBaseClassstandard>()
|
||||
.eq(MdBaseClassstandard::getClass_code, "0002"));
|
||||
List<MdBaseClassstandard> list = classstandardService.list(new LambdaQueryWrapper<MdBaseClassstandard>()
|
||||
@@ -66,6 +67,7 @@ public class GxPdaServiceImpl implements GxPdaService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject confirmedInStorage(JSONObject param) {
|
||||
MDC.put("tag_name", TagNameEnum.GX_IN.getTag());
|
||||
@@ -133,6 +135,62 @@ public class GxPdaServiceImpl implements GxPdaService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject confirmedInStorageV2(JSONObject param) {
|
||||
MDC.put("tag_name", TagNameEnum.GX_IN.getTag());
|
||||
log.info("手持确认管芯入库 - {}", param);
|
||||
// 获取管芯库入口
|
||||
List<SchBasePoint> gxRks = pointService.getPointByConditions("A1", "A1-GXK",
|
||||
"1", null, null, false);
|
||||
// 将每一根存到物料表中,并且创建任务
|
||||
int gxNumber = param.getInteger("gx_number");
|
||||
String materialCode = param.getString("material_code");
|
||||
String materialSpec = param.getString("material_spec");
|
||||
if (gxNumber > 5) {
|
||||
throw new BadRequestException("一次性最多只能入5个管芯");
|
||||
}
|
||||
// 找管芯库中的空位。
|
||||
List<SchBasePoint> allGxPoints = pointService.getPointByConditions("A1", "A1-GXK",
|
||||
"3", "1", null, true);
|
||||
if (allGxPoints.size() < gxNumber) {
|
||||
log.warn("管芯库不够存放,只够存放{}个管芯", allGxPoints.size());
|
||||
}
|
||||
gxNumber = Math.min(gxNumber, allGxPoints.size());
|
||||
// 更新点位信息
|
||||
List<SchBasePoint> updatePoint = new ArrayList<>();
|
||||
for (int i = 0; i < gxNumber; i++) {
|
||||
SchBasePoint point = allGxPoints.get(i);
|
||||
point.setPoint_status("2");
|
||||
point.setVehicle_code(materialCode);
|
||||
point.setRemark(materialSpec);
|
||||
updatePoint.add(point);
|
||||
log.info("点位 {} 存放规格 {} 管芯", point.getPoint_code(), materialSpec);
|
||||
}
|
||||
// acs参数:gx_code, device_code
|
||||
JSONArray acsArray = new JSONArray();
|
||||
JSONObject acs = new JSONObject();
|
||||
acs.put("product_area", URLEnum.ACS_URL_A1.getProduct_area());
|
||||
acs.put("device_code", gxRks.get(0).getPoint_code());
|
||||
for (int i = 0; i < gxNumber; i++) {
|
||||
// 查找点位最终一次性发给ACS
|
||||
acs.put("to_barcode" + (i + 1), materialCode);
|
||||
acs.put("to_target" + (i + 1), allGxPoints.get(i).getPoint_code());
|
||||
acsArray.add(acs);
|
||||
}
|
||||
// 调用ACS
|
||||
log.info("调用ACS管芯入库的参数 - {}", acsArray);
|
||||
JSONObject jsonObject = wmsToAcsService.toAcsGxInStorage(acsArray);
|
||||
log.info("调用ACS管芯入库的反馈 - {}", jsonObject);
|
||||
// 更新数据
|
||||
pointService.updateBatchById(updatePoint);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "管芯入库全部请求成功!");
|
||||
result.put("data", new JSONObject());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int remainingQty() {
|
||||
List<SchBasePoint> allGxPoints = pointService.getPointByConditions("A1", "A1-GXK",
|
||||
@@ -142,6 +200,7 @@ public class GxPdaServiceImpl implements GxPdaService {
|
||||
|
||||
/**
|
||||
* 管芯出库需要创建任务
|
||||
*
|
||||
* @param param /
|
||||
* @return
|
||||
*/
|
||||
@@ -160,7 +219,7 @@ public class GxPdaServiceImpl implements GxPdaService {
|
||||
}
|
||||
// 判断还有几个同规格的管芯, 没任务
|
||||
List<SchBasePoint> allPoint = pointService.getAllBusinessNotTaskPoint("A1", "A1-GXK",
|
||||
"3", "2", materialCode) ;
|
||||
"3", "2", null, materialCode);
|
||||
if (allPoint.size() == 0) {
|
||||
throw new BadRequestException("管芯不存在规格为[" + materialSpec + "]的管芯!");
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class AutoCallEmptyToWeighTemp {
|
||||
MDC.put("tag_name", TagNameEnum.AUTO_CALL_EMPTY_BY_CZZC.getTag());
|
||||
log.info("称重暂存位叫空自动任务开始执行...");
|
||||
List<SchBasePoint> allZcPoints = pointService.getAllBusinessNotTaskPoint("A1", "A1-CZZC",
|
||||
"1", "1", null);
|
||||
"1", "1", null, null);
|
||||
for (SchBasePoint point : allZcPoints) {
|
||||
try {
|
||||
JSONObject taskParam = new JSONObject();
|
||||
|
||||
@@ -106,7 +106,9 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
|
||||
* @param pointType 点位类型
|
||||
* @param pointStatus 点位状态
|
||||
* @param vehicleType 载具类型
|
||||
* @param vehicleCode 载具编码
|
||||
* @return /
|
||||
*/
|
||||
List<SchBasePoint> getAllBusinessNotTaskPoint(String area, String region, String pointType, String pointStatus, String vehicleType);
|
||||
List<SchBasePoint> getAllBusinessNotTaskPoint(String area, String region, String pointType,
|
||||
String pointStatus, String vehicleType, String vehicleCode);
|
||||
}
|
||||
|
||||
@@ -35,5 +35,6 @@ public interface SchBasePointMapper extends BaseMapper<SchBasePoint> {
|
||||
*/
|
||||
List<SchBasePoint> getHotNotTaskPoint(String area, String region, String pointType, String pointStatus);
|
||||
|
||||
List<SchBasePoint> getAllBusinessNotTaskPoint(String area, String region, String pointType, String pointStatus, String vehicleType);
|
||||
List<SchBasePoint> getAllBusinessNotTaskPoint(String area, String region, String pointType, String pointStatus,
|
||||
String vehicleType, String vehicleCode);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
<if test="vehicleType != null">
|
||||
AND p.vehicle_type = #{vehicleType}
|
||||
</if>
|
||||
<if test="vehicleCode != null">
|
||||
AND p.vehicle_code = #{vehicleCode}
|
||||
</if>
|
||||
AND 0 = (SELECT COUNT(*) FROM sch_base_task t WHERE t.task_status <![CDATA[<]]> '07'
|
||||
AND (t.point_code1 = p.point_code OR t.point_code2 = p.point_code OR t.point_code3 = p.point_code
|
||||
OR t.point_code4 = p.point_code))
|
||||
|
||||
@@ -232,8 +232,9 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchBasePoint> getAllBusinessNotTaskPoint(String area, String region, String pointType, String pointStatus, String vehicleType) {
|
||||
return pointMapper.getAllBusinessNotTaskPoint(area, region, pointType, pointStatus, vehicleType);
|
||||
public List<SchBasePoint> getAllBusinessNotTaskPoint(String area, String region, String pointType,
|
||||
String pointStatus, String vehicleType, String vehicleCode) {
|
||||
return pointMapper.getAllBusinessNotTaskPoint(area, region, pointType, pointStatus, vehicleType, vehicleCode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class CzzcCallEmptyAGVTask extends AbstractTask {
|
||||
public void createCompletion(SchBaseTask task) {
|
||||
// 查找货梯没任务有载具的点位
|
||||
List<SchBasePoint> startPoints = pointService.getAllBusinessNotTaskPoint("A1", "A1-LIFT-AREA",
|
||||
"1", "2", null);
|
||||
"1", "2", null, null);
|
||||
if (startPoints.size() == 0) {
|
||||
throw new BadRequestException("货梯没有可用点位!");
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class SubRollDownAGVTask extends AbstractTask {
|
||||
public void createCompletion(SchBaseTask task) {
|
||||
// 查找空位没任务的货梯
|
||||
List<SchBasePoint> lifts = pointService.getAllBusinessNotTaskPoint("A1", "A1-LIFT-AREA",
|
||||
"1", "1", null);
|
||||
"1", "1", null, null);
|
||||
if (lifts.size() == 0) {
|
||||
throw new BadRequestException("暂无可用的货梯!");
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class WasteFoilAGVTask extends AbstractTask {
|
||||
// 第一次
|
||||
// 查找废箔起点
|
||||
List<SchBasePoint> fbPoints = pointService.getAllBusinessNotTaskPoint("A1", "A1-FB",
|
||||
"1", null, null);
|
||||
"1", null, null, null);
|
||||
SchBasePoint fbPoint = fbPoints.get(0);
|
||||
task.setPoint_code1(fbPoint.getPoint_code());
|
||||
task.setPoint_code2(nowPointCode);
|
||||
@@ -62,7 +62,7 @@ public class WasteFoilAGVTask extends AbstractTask {
|
||||
// 最后一次
|
||||
// 查找废箔终点
|
||||
List<SchBasePoint> fbPoints = pointService.getAllBusinessNotTaskPoint("A1", "A1-FB",
|
||||
"2", null, null);
|
||||
"2", null, null, null);
|
||||
SchBasePoint fbPoint = fbPoints.get(0);
|
||||
task.setPoint_code1(row.getString(indexTask - 1));
|
||||
task.setPoint_code2(fbPoint.getPoint_code());
|
||||
|
||||
@@ -44,7 +44,7 @@ public class SlitterSendRollTrussTask extends AbstractTask {
|
||||
// 起点一样不记录,直接创建入库任务
|
||||
// 查找空位终点即可
|
||||
List<SchBasePoint> allSjgkPoints = pointService.getAllBusinessNotTaskPoint("A1",
|
||||
"A1-SJGK", "3", "1", null);
|
||||
"A1-SJGK", "3", "1", null, null);
|
||||
if (allSjgkPoints.size() == 0) {
|
||||
throw new BadRequestException("收卷辊不存在空位!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user