优化入库,将自动报工拆分至入库完成处理
This commit is contained in:
@@ -125,6 +125,7 @@
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>mssql-jdbc</artifactId>
|
||||
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
import com.ruoyi.job.mydojob.domain.MydoJob;
|
||||
import com.ruoyi.log.domain.RequestLog;
|
||||
import com.ruoyi.log.service.IRequestLogService;
|
||||
import com.ruoyi.out.outStockout.domain.OutStockout;
|
||||
@@ -127,6 +128,13 @@ public class ToWmsApiController {
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
@PostMapping("/requestInSpace")
|
||||
public AjaxResult requestInSpace(@RequestBody ReMaterialParam reMaterialParam) {
|
||||
AjaxResult ajaxResult = toWmsService.requestInSpace(reMaterialParam);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(reMaterialParam), "requestInSpace", ajaxResult);
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库单据保存
|
||||
|
||||
@@ -62,4 +62,6 @@ public interface IToWmsService {
|
||||
* 作废物料
|
||||
*/
|
||||
AjaxResult InvalidProduct(BasProduct basProduct);
|
||||
|
||||
AjaxResult requestInSpace(ReMaterialParam reMaterialParam);
|
||||
}
|
||||
|
||||
@@ -224,7 +224,6 @@ public class ToWmsServiceImpl implements IToWmsService {
|
||||
mydoJob.setTrayCode(serial);
|
||||
mydoJob.setLineId(erpBill);
|
||||
mydoJob.setDepartmentId(String.valueOf(size));
|
||||
mydoJob.setCargoSpaceId(basCargoSpace.getCargoSpaceId());
|
||||
mydoJob.setEntranceId(requestEnter.getEntranceId());
|
||||
mydoJob.setClassId(requestEnter.getFloor());
|
||||
mydoJobService.insertMydoJob(mydoJob);
|
||||
@@ -253,15 +252,13 @@ public class ToWmsServiceImpl implements IToWmsService {
|
||||
mydoJobDetail.setStockinId(inStockId);
|
||||
mydoJobDetailService.insertMydoJobDetail(mydoJobDetail);
|
||||
|
||||
//修改货位状态
|
||||
basCargoSpace.setStatus("3");
|
||||
basCargoSpaceService.updateBasCargoSpace(basCargoSpace);
|
||||
|
||||
//2026-01-30 优化,将入库分货位拆到巷道口处理
|
||||
// basCargoSpace.setStatus("3");
|
||||
// basCargoSpaceService.updateBasCargoSpace(basCargoSpace);
|
||||
|
||||
//修改作业状态为正执行
|
||||
result.put("jobId", mydoJob.getJobId());
|
||||
result.put("taskNo", mydoJob.getTaskNo());
|
||||
result.put("cargoSpaceId", mydoJob.getCargoSpaceId());
|
||||
result.put("trayCode", mydoJob.getTrayCode());
|
||||
result.put("flag",requestEnter.getFlag());
|
||||
result.put("roadwayId", mydoJob.getRoadwayId());
|
||||
@@ -417,16 +414,8 @@ public class ToWmsServiceImpl implements IToWmsService {
|
||||
|
||||
@Override
|
||||
public AjaxResult reMaterial(ReMaterialParam reMaterialParam) {
|
||||
//重新分配物料
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(reMaterialParam.getJobId());
|
||||
MydoJobDetail mydoJobDetailParam = new MydoJobDetail();
|
||||
mydoJobDetailParam.setJobId(mydoJob.getJobId());
|
||||
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(mydoJobDetailParam);
|
||||
String stockOutId = mydoJobDetails.get(0).getInOrOutId();
|
||||
// 作废作业
|
||||
mydoJobService.OuthandInvalidation(new String[]{mydoJob.getJobId()});
|
||||
//调用自动分配
|
||||
return outStockoutService.autoAllot(stockOutId);
|
||||
return mydoJobService.reMaterial(mydoJob);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -581,6 +570,40 @@ public class ToWmsServiceImpl implements IToWmsService {
|
||||
return AjaxResult.error(basProduct.getProductGuid()+"物料不存在");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult requestInSpace(ReMaterialParam reMaterialParam) {
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(reMaterialParam.getJobId());
|
||||
if (ObjUtil.isNotNull(mydoJob)) {
|
||||
if(mydoJob.getCargoSpaceId() != null && !"".equals(mydoJob.getCargoSpaceId())){
|
||||
BasCargoSpace space = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
if (ObjUtil.isNotNull(space)) {
|
||||
return AjaxResult.success(space);
|
||||
}
|
||||
}
|
||||
BasCargoSpace basCargoSpaceParam = new BasCargoSpace();
|
||||
basCargoSpaceParam.setWarehouseId(mydoJob.getWarehouseId());
|
||||
basCargoSpaceParam.setRoadwayId(mydoJob.getRoadwayId());
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectEmptyCargoSpaceByWarehouseId(basCargoSpaceParam);
|
||||
if (ObjUtil.isNull(basCargoSpace)) {
|
||||
return AjaxResult.error("WCS请求入库分配货位,没有可用货位!");
|
||||
}else{
|
||||
try{
|
||||
basCargoSpace.setStatus("3");
|
||||
basCargoSpaceService.updateBasCargoSpace(basCargoSpace);
|
||||
mydoJob.setCargoSpaceId(basCargoSpace.getCargoSpaceId());
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
return AjaxResult.success(basCargoSpace);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("WCS请求入库分配货位,货位分配失败!");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
return AjaxResult.error("WCS请求入库分配货位,入库任务不存在!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static final Map<String, Pattern> PATTERNS = createPatterns();
|
||||
private static Map<String, Pattern> createPatterns() {
|
||||
|
||||
@@ -111,4 +111,6 @@ public interface IMydoJobService
|
||||
MydoJob selectMydoJobByEntranceId(MydoJob mydoJob);
|
||||
|
||||
List<MydoJob> getInJobBySerial(String serial);
|
||||
|
||||
AjaxResult reMaterial(MydoJob mydoJob);
|
||||
}
|
||||
|
||||
@@ -565,4 +565,29 @@ public class MydoJobServiceImpl implements IMydoJobService {
|
||||
public List<MydoJob> getInJobBySerial(String trayCode) {
|
||||
return mydoJobMapper.getInJobBySerial(trayCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult reMaterial(MydoJob mydoJob) {
|
||||
try {
|
||||
//修改货位状态
|
||||
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
if (cargoSpace != null) {
|
||||
cargoSpace.setStatus("6");
|
||||
basCargoSpaceService.updateBasCargoSpace(cargoSpace);
|
||||
|
||||
basStockMapper.deleteBySpaceAndTray(mydoJob.getCargoSpaceId(),mydoJob.getTrayCode());
|
||||
}
|
||||
mydoJob.setStatus("5");
|
||||
mydoJob.setFinishTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
updateMydoJob(mydoJob);
|
||||
insertHistory(mydoJob.getJobId());
|
||||
}catch (Exception e) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
log.error("任务处理异常", e);
|
||||
return AjaxResult.error();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.stock.stock.mapper;
|
||||
|
||||
import com.ruoyi.stock.stock.domain.BasStock;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -70,4 +71,6 @@ public interface BasStockMapper
|
||||
void resetPdRecord();
|
||||
|
||||
List<BasStock> getStockBySerial(String trayCode);
|
||||
|
||||
void deleteBySpaceAndTray(@Param("cargoSpaceId") String cargoSpaceId, @Param("trayCode") String trayCode);
|
||||
}
|
||||
|
||||
@@ -248,4 +248,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="getStockBySerial" parameterType="String" resultMap="BasStockResult">
|
||||
select * from bas_stock where tray_code = #{trayCode}
|
||||
</select>
|
||||
|
||||
<delete id="deleteBySpaceAndTray" parameterType="String">
|
||||
delete from bas_stock where tray_code = #{trayCode} and cargo_space_id=#{cargoSpaceId}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user