基础信息设备+产品

highway
A0010407 1 year ago
parent 9692f1e09e
commit bea6dee309

@ -72,7 +72,13 @@ public class BaseProductController extends BaseController {
@Log(title = "物料信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseProduct baseProduct) {
return toAjax(baseProductService.insertBaseProduct(baseProduct));
if (baseProductService.checkCodeUnique(baseProduct)) {
return AjaxResult.error("产品物料编码已存在!");
}else if(baseProductService.checkNameUnique(baseProduct)){
return AjaxResult.error("产品物料名称已存在!");
}else{
return toAjax(baseProductService.insertBaseProduct(baseProduct));
}
}
/**

@ -65,4 +65,6 @@ public interface BaseEquipmentMapper {
//判断
String checkEquipmentCodeUnique(BaseEquipment baseEquipment);
String checkEquipmentNameUnique(BaseEquipment baseEquipment);
String getWorkCenterName(BaseEquipment baseEquipment);
}

@ -57,6 +57,8 @@ public class BaseEquipmentServiceImpl implements IBaseEquipmentService {
public int insertBaseEquipment(BaseEquipment baseEquipment) {
baseEquipment.setCreateTime(DateUtils.getNowDate());
String equipmentTypeName = baseEquipmentMapper.getEquipmentTypeName(baseEquipment);
String workCenterName = baseEquipmentMapper.getWorkCenterName(baseEquipment);
baseEquipment.setWorkshopName(workCenterName);
baseEquipment.setEquipmentTypeName(equipmentTypeName);
return baseEquipmentMapper.insertBaseEquipment(baseEquipment);
}
@ -71,7 +73,9 @@ public class BaseEquipmentServiceImpl implements IBaseEquipmentService {
@DS("#header.poolName")
public int updateBaseEquipment(BaseEquipment baseEquipment) {
baseEquipment.setUpdateTime(DateUtils.getNowDate());
String equipmentTypeName = baseEquipmentMapper.getEquipmentTypeName(baseEquipment);
String equipmentTypeName = baseEquipmentMapper.getEquipmentTypeName(baseEquipment);
String workCenterName = baseEquipmentMapper.getWorkCenterName(baseEquipment);
baseEquipment.setWorkshopName(workCenterName);
baseEquipment.setEquipmentTypeName(equipmentTypeName);
return baseEquipmentMapper.updateBaseEquipment(baseEquipment);
}

@ -182,4 +182,10 @@
where equipment_code = #{equipmentCode}
</select>
<select id="getWorkCenterName" parameterType="BaseEquipment" resultType="java.lang.String">
select factoryName
from sys_factory
where factoryCode = #{workshopCode}
</select>
</mapper>
Loading…
Cancel
Save