'20240311'

This commit is contained in:
xd 2024-03-11 13:22:49 +08:00
parent 80ebfe6bf0
commit b167b18527
11 changed files with 78 additions and 30 deletions

View File

@ -83,7 +83,7 @@ public class CYlMaterialController extends BaseController
{
if (!cYlMaterialService.checkMaterialNoUnique(cYlMaterial))
{
return error("新增材料'" + cYlMaterial.getMaterialNo() + "'失败,编码已存在");
return error("添加材料失败,编码:'" + cYlMaterial.getMaterialNo() + "' 已存在");
}
return toAjax(cYlMaterialService.insertCYlMaterial(cYlMaterial));
}

View File

@ -104,7 +104,7 @@ public class CFactoryController extends BaseController
{
if (!cFactoryService.checkFactoryNoUnique(cFactory))
{
return error("新增车间'" + cFactory.getFactoryNo() + "'失败,编码已存在");
return error("添加车间失败,编码:'" + cFactory.getFactoryNo() + "' 已存在");
}
return toAjax(cFactoryService.insertCFactory(cFactory));
}

View File

@ -81,6 +81,11 @@ public class CMaterialTypeController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody CMaterialType cMaterialType)
{
if (!cMaterialTypeService.checkTypeNoUnique(cMaterialType))
{
return error("添加物料类型失败,编码:'" + cMaterialType.getTypeNo() + "' 已存在");
}
return toAjax(cMaterialTypeService.insertCMaterialType(cMaterialType));
}

View File

@ -5,15 +5,15 @@ import com.ruoyi.materialType.domain.CMaterialType;
/**
* 物料类别Mapper接口
*
*
* @author ruoyi
* @date 2024-03-01
*/
public interface CMaterialTypeMapper
public interface CMaterialTypeMapper
{
/**
* 查询物料类别
*
*
* @param typeId 物料类别主键
* @return 物料类别
*/
@ -21,7 +21,7 @@ public interface CMaterialTypeMapper
/**
* 查询物料类别列表
*
*
* @param cMaterialType 物料类别
* @return 物料类别集合
*/
@ -29,7 +29,7 @@ public interface CMaterialTypeMapper
/**
* 新增物料类别
*
*
* @param cMaterialType 物料类别
* @return 结果
*/
@ -37,7 +37,7 @@ public interface CMaterialTypeMapper
/**
* 修改物料类别
*
*
* @param cMaterialType 物料类别
* @return 结果
*/
@ -45,7 +45,7 @@ public interface CMaterialTypeMapper
/**
* 删除物料类别
*
*
* @param typeId 物料类别主键
* @return 结果
*/
@ -53,9 +53,16 @@ public interface CMaterialTypeMapper
/**
* 批量删除物料类别
*
*
* @param typeIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteCMaterialTypeByTypeIds(Long[] typeIds);
/**
* 检查物料编码是否存在
* @param typeNo
* @return
*/
CMaterialType checkTypeNoUnique(String typeNo);
}

View File

@ -5,15 +5,15 @@ import com.ruoyi.materialType.domain.CMaterialType;
/**
* 物料类别Service接口
*
*
* @author ruoyi
* @date 2024-03-01
*/
public interface ICMaterialTypeService
public interface ICMaterialTypeService
{
/**
* 查询物料类别
*
*
* @param typeId 物料类别主键
* @return 物料类别
*/
@ -21,7 +21,7 @@ public interface ICMaterialTypeService
/**
* 查询物料类别列表
*
*
* @param cMaterialType 物料类别
* @return 物料类别集合
*/
@ -29,7 +29,7 @@ public interface ICMaterialTypeService
/**
* 新增物料类别
*
*
* @param cMaterialType 物料类别
* @return 结果
*/
@ -37,7 +37,7 @@ public interface ICMaterialTypeService
/**
* 修改物料类别
*
*
* @param cMaterialType 物料类别
* @return 结果
*/
@ -45,7 +45,7 @@ public interface ICMaterialTypeService
/**
* 批量删除物料类别
*
*
* @param typeIds 需要删除的物料类别主键集合
* @return 结果
*/
@ -53,9 +53,16 @@ public interface ICMaterialTypeService
/**
* 删除物料类别信息
*
*
* @param typeId 物料类别主键
* @return 结果
*/
public int deleteCMaterialTypeByTypeId(Long typeId);
/**
* 检查物料编码是否存在
* @param cMaterialType
* @return
*/
boolean checkTypeNoUnique(CMaterialType cMaterialType);
}

View File

@ -1,6 +1,10 @@
package com.ruoyi.materialType.service.impl;
import java.util.List;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.materialType.mapper.CMaterialTypeMapper;
@ -9,19 +13,19 @@ import com.ruoyi.materialType.service.ICMaterialTypeService;
/**
* 物料类别Service业务层处理
*
*
* @author ruoyi
* @date 2024-03-01
*/
@Service
public class CMaterialTypeServiceImpl implements ICMaterialTypeService
public class CMaterialTypeServiceImpl implements ICMaterialTypeService
{
@Autowired
private CMaterialTypeMapper cMaterialTypeMapper;
/**
* 查询物料类别
*
*
* @param typeId 物料类别主键
* @return 物料类别
*/
@ -33,7 +37,7 @@ public class CMaterialTypeServiceImpl implements ICMaterialTypeService
/**
* 查询物料类别列表
*
*
* @param cMaterialType 物料类别
* @return 物料类别
*/
@ -45,7 +49,7 @@ public class CMaterialTypeServiceImpl implements ICMaterialTypeService
/**
* 新增物料类别
*
*
* @param cMaterialType 物料类别
* @return 结果
*/
@ -57,7 +61,7 @@ public class CMaterialTypeServiceImpl implements ICMaterialTypeService
/**
* 修改物料类别
*
*
* @param cMaterialType 物料类别
* @return 结果
*/
@ -69,7 +73,7 @@ public class CMaterialTypeServiceImpl implements ICMaterialTypeService
/**
* 批量删除物料类别
*
*
* @param typeIds 需要删除的物料类别主键
* @return 结果
*/
@ -81,7 +85,7 @@ public class CMaterialTypeServiceImpl implements ICMaterialTypeService
/**
* 删除物料类别信息
*
*
* @param typeId 物料类别主键
* @return 结果
*/
@ -90,4 +94,20 @@ public class CMaterialTypeServiceImpl implements ICMaterialTypeService
{
return cMaterialTypeMapper.deleteCMaterialTypeByTypeId(typeId);
}
/**
* 检查物料编码是否存在
* @param cMaterialType
* @return
*/
@Override
public boolean checkTypeNoUnique(CMaterialType cMaterialType) {
Long typeId = StringUtils.isNull(cMaterialType.getTypeId()) ? -1L : cMaterialType.getTypeId();
CMaterialType info = cMaterialTypeMapper.checkTypeNoUnique(cMaterialType.getTypeNo());
if (StringUtils.isNotNull(info) && info.getTypeId().longValue() != typeId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
}

View File

@ -69,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<select id="checkMaterialNoUnique" parameterType="String" resultMap="CYlMaterialResult">
select top(1) material_id, material_no from c_yl_material where material_no = #{materialNo}
select top(1) material_id, material_no from c_yl_material where material_no = #{materialNo} and material_state = '0'
</select>
<select id="getBjData" resultType="CYlMaterial">

View File

@ -64,4 +64,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{typeId}
</foreach>
</delete>
<select id="checkTypeNoUnique" parameterType="String" resultMap="CMaterialTypeResult">
select top(1) type_id, type_no from c_material_type where type_no = #{typeNo} and type_state = '0'
</select>
</mapper>

View File

@ -241,7 +241,7 @@ export default {
materialNo: null,
materialName: null,
materialPrice: null,
materialState: "0"
materialState: '0'
};
this.resetForm("form");
},
@ -267,6 +267,7 @@ export default {
this.open = true;
this.title = "添加材料管理";
this.isDis = false;
this.materialState = '0'
},
/** 修改按钮操作 */
handleUpdate(row) {

View File

@ -376,7 +376,7 @@ export default {
materialGuig: null,
materialDiany: null,
materialDw: null,
materialState: 0
materialState: '0'
};
this.cMaterialCostList = [];
this.resetForm("form");
@ -402,6 +402,7 @@ export default {
this.reset();
this.open = true;
this.title = "添加物料管理";
this.materialState = '0';
this.getClMaterials();
this.getMaterialType();
},

View File

@ -218,7 +218,8 @@ export default {
typeId: null,
typeNo: null,
typeName: null,
factoryId: null
factoryId: null,
typeState: '0'
};
this.resetForm("form");
},
@ -244,6 +245,7 @@ export default {
this.open = true;
this.title = "添加物料类别";
this.isDis = false;
this.form.typeState = '0';
},
/** 修改按钮操作 */
handleUpdate(row) {