This commit is contained in:
张怡蓉
2025-10-22 10:57:18 +08:00
parent 727d57b3c5
commit 1483019e1f
25 changed files with 1042 additions and 357 deletions

View File

@@ -74,7 +74,7 @@ public class BasProductServiceImpl implements IBasProductService
BasProduct basProduct1 = basProductMapper.selectBasProductByProductId(basProduct.getProductId());
if(basProduct1 != null){
return 0;
throw new RuntimeException("物料编号已存在");
}
basProduct.setProductGuid(basProduct.getProductId());
basProduct.setSpare3(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
@@ -100,8 +100,6 @@ public class BasProductServiceImpl implements IBasProductService
if (CollUtil.isNotEmpty(basProducts)){
throw new RuntimeException("物料编号已存在");
}
return basProductMapper.updateBasProduct(basProduct);
}

View File

@@ -33,21 +33,31 @@ public class BasRoadway extends BaseEntity
private String deviceId;
/** 一层入库锁 */
@Excel(name = "一层入库锁" ,dictType = "roadway_lock")
@Excel(name = "北入库锁" ,dictType = "roadway_lock")
private String inLocked;
/** 一层出库锁 */
@Excel(name = "一层出库锁",dictType = "roadway_lock")
@Excel(name = "北出库锁",dictType = "roadway_lock")
private String outLocked;
/** 二层入库锁 */
@Excel(name = "二层入库锁",dictType = "roadway_lock")
@Excel(name = "南入库锁",dictType = "roadway_lock")
private String inLocked2;
/** 二层出库锁 */
@Excel(name = "二层出库锁",dictType = "roadway_lock")
@Excel(name = "南出库锁",dictType = "roadway_lock")
private String outLocked2;
private String updateId;
public String getUpdateId() {
return updateId;
}
public void setUpdateId(String updateId) {
this.updateId = updateId;
}
public void setId(String id)
{
this.id = id;

View File

@@ -18,6 +18,7 @@ public interface BasRoadwayMapper
* @return 巷道管理
*/
public BasRoadway selectBasRoadwayById(String id);
public BasRoadway selectBasRoadwayByRoadwayId(String roadwayId);
/**
* 查询巷道管理列表

View File

@@ -1,6 +1,9 @@
package com.ruoyi.bas.roadway.service.impl;
import java.util.List;
import java.util.UUID;
import cn.hutool.core.collection.CollUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bas.roadway.mapper.BasRoadwayMapper;
@@ -52,6 +55,12 @@ public class BasRoadwayServiceImpl implements IBasRoadwayService
@Override
public int insertBasRoadway(BasRoadway basRoadway)
{
BasRoadway basRoadway1 = basRoadwayMapper.selectBasRoadwayByRoadwayId(basRoadway.getRoadwayId());
if(basRoadway1 != null){
throw new RuntimeException("巷道编号已存在");
}
basRoadway.setId(UUID.randomUUID().toString());
basRoadway.setWarehouseId("01");
return basRoadwayMapper.insertBasRoadway(basRoadway);
}
@@ -64,6 +73,13 @@ public class BasRoadwayServiceImpl implements IBasRoadwayService
@Override
public int updateBasRoadway(BasRoadway basRoadway)
{
BasRoadway basRoadway1 = new BasRoadway();
basRoadway1.setUpdateId(basRoadway.getId());
basRoadway1.setRoadwayId(basRoadway.getRoadwayId());
List<BasRoadway> basRoadways = basRoadwayMapper.selectBasRoadwayList(basRoadway1);
if(CollUtil.isNotEmpty(basRoadways)){
throw new RuntimeException("巷道编号已存在");
}
return basRoadwayMapper.updateBasRoadway(basRoadway);
}

View File

@@ -71,6 +71,7 @@ public class BasTraycodeController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody BasTraycode basTraycode)
{
return toAjax(basTraycodeService.insertBasTraycode(basTraycode));
}

View File

@@ -61,4 +61,6 @@ public interface BasTraycodeMapper
public int deleteBasTraycodeByIds(Long[] ids);
void insertBasTraycodeList(List<BasTraycode> list);
Integer selectBasTrayCodeMax();
}

View File

@@ -61,4 +61,6 @@ public interface IBasTraycodeService
public int deleteBasTraycodeById(Long id);
void insertBasTraycodeList(List<BasTraycode> traycodeList);
Integer selectBasTrayCodeMax();
}

View File

@@ -55,8 +55,29 @@ public class BasTraycodeServiceImpl implements IBasTraycodeService
@Override
public int insertBasTraycode(BasTraycode basTraycode)
{
basTraycode.setCreateTime(DateUtils.getNowDate());
return basTraycodeMapper.insertBasTraycode(basTraycode);
try {
Integer i = basTraycodeMapper.selectBasTrayCodeMax();
if (i == null) {
i = 0;
}
int i1 = Integer.parseInt(basTraycode.getSpare1());
//如果i<4位数,前面补0
String code = "";
for (int j = 0; j < i1; j++) {
code = String.format("%04d", i + 1 + j);
if("9999".equals( code)){
throw new RuntimeException("已生成最大值");
}
basTraycode.setTrayCode(code);
basTraycode.setSpare1(null);
basTraycode.setCreateTime(DateUtils.getNowDate());
basTraycode.setSpare2("Y");
basTraycodeMapper.insertBasTraycode(basTraycode);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return 1;
}
/**
@@ -103,4 +124,9 @@ public class BasTraycodeServiceImpl implements IBasTraycodeService
basTraycodeMapper.insertBasTraycodeList(list);
}
}
@Override
public Integer selectBasTrayCodeMax() {
return basTraycodeMapper.selectBasTrayCodeMax();
}
}