存货子表、存货自由项
This commit is contained in:
parent
43e6e247da
commit
3609b2eef9
|
@ -15,6 +15,9 @@ public class InventoryEntity extends BaseEntity {
|
|||
|
||||
//存货自由项
|
||||
private InventoryExtEntity invExtEntity;
|
||||
//存货副表
|
||||
private InventorySubEntity invSubEntity;
|
||||
|
||||
/** 无备注 */
|
||||
private String cInvCode;
|
||||
/** 无备注 */
|
||||
|
@ -2590,4 +2593,12 @@ public class InventoryEntity extends BaseEntity {
|
|||
public void setiOldpartMngRule(Integer iOldpartMngRule) {
|
||||
this.iOldpartMngRule = iOldpartMngRule;
|
||||
}
|
||||
|
||||
public InventorySubEntity getInvSubEntity() {
|
||||
return invSubEntity;
|
||||
}
|
||||
|
||||
public void setInvSubEntity(InventorySubEntity invSubEntity) {
|
||||
this.invSubEntity = invSubEntity;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzya.frame.u8.base.inventory.dao.impl.InventoryExtDaoImpl">
|
||||
<resultMap id="get-InventoryExtEntity-result" type="com.hzya.frame.base.inventory.entity.InventoryExtEntity">
|
||||
<resultMap id="get-InventoryExtEntity-result" type="com.hzya.frame.u8.base.inventory.entity.InventoryExtEntity">
|
||||
<!--无备注 -->
|
||||
<result property="cInvCode" column="cInvCode" />
|
||||
<!--无备注 -->
|
||||
|
@ -35,7 +35,7 @@
|
|||
</select>
|
||||
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-InventoryExtEntity-result" parameterType="com.hzya.frame.base.inventory.entity.InventoryExtEntity">
|
||||
<select id="entity_list_base" resultMap="get-InventoryExtEntity-result" parameterType="com.hzya.frame.u8.base.inventory.entity.InventoryExtEntity">
|
||||
select
|
||||
<include refid="InventoryExtEntity_Base_Column_List" />
|
||||
from Inventory_extradefine
|
||||
|
@ -54,7 +54,7 @@
|
|||
</select>
|
||||
|
||||
<!-- 查询符合条件的数量 -->
|
||||
<select id="entity_count" resultType="Integer" parameterType="com.hzya.frame.base.inventory.entity.InventoryExtEntity">
|
||||
<select id="entity_count" resultType="Integer" parameterType="com.hzya.frame.u8.base.inventory.entity.InventoryExtEntity">
|
||||
select count(1) from Inventory_extradefine
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="cInvCode != null and cInvCode !='' ">cInvCode = #{cInvCode} </if>
|
||||
|
@ -70,7 +70,7 @@
|
|||
</select>
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="entity_list_like" resultMap="get-InventoryExtEntity-result" parameterType="com.hzya.frame.base.inventory.entity.InventoryExtEntity">
|
||||
<select id="entity_list_like" resultMap="get-InventoryExtEntity-result" parameterType="com.hzya.frame.u8.base.inventory.entity.InventoryExtEntity">
|
||||
select
|
||||
<include refid="InventoryExtEntity_Base_Column_List" />
|
||||
from Inventory_extradefine
|
||||
|
@ -88,7 +88,7 @@
|
|||
</select>
|
||||
|
||||
<!-- 查询列表 字段采用or格式 -->
|
||||
<select id="entity_list_or" resultMap="get-InventoryExtEntity-result" parameterType="com.hzya.frame.base.inventory.entity.InventoryExtEntity">
|
||||
<select id="entity_list_or" resultMap="get-InventoryExtEntity-result" parameterType="com.hzya.frame.u8.base.inventory.entity.InventoryExtEntity">
|
||||
select
|
||||
<include refid="InventoryExtEntity_Base_Column_List" />
|
||||
from Inventory_extradefine
|
||||
|
@ -105,7 +105,7 @@
|
|||
|
||||
</select>
|
||||
<!-- 新增 -->
|
||||
<insert id="entity_insert" parameterType="com.hzya.frame.base.inventory.entity.InventoryExtEntity">
|
||||
<insert id="entity_insert" parameterType="com.hzya.frame.u8.base.inventory.entity.InventoryExtEntity">
|
||||
insert into Inventory_extradefine(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="cInvCode != null and cInvCode !='' "> cInvCode, </if>
|
||||
|
@ -133,7 +133,7 @@
|
|||
</insert>
|
||||
|
||||
<!-- 修改 -->
|
||||
<update id="entity_update" parameterType="com.hzya.frame.base.inventory.entity.InventoryExtEntity">
|
||||
<update id="entity_update" parameterType="com.hzya.frame.u8.base.inventory.entity.InventoryExtEntity">
|
||||
update Inventory_extradefine set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="cInvCode != null and cInvCode !='' "> cInvCode = #{cInvCode},</if>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -9,4 +9,13 @@ import com.hzya.frame.u8.base.inventory.entity.InventorySubEntity;
|
|||
* @Date 2025/3/13 16:40
|
||||
**/
|
||||
public interface IInventorySubService extends IBaseService<InventorySubEntity,String> {
|
||||
|
||||
/**
|
||||
* 根据存货编码查存货子表
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
InventorySubEntity getInvSub(InventorySubEntity entity)throws Exception;
|
||||
|
||||
void saveOrUpdateInvSub(InventorySubEntity entity)throws Exception;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,9 @@ public class InventoryExtServiceImpl extends BaseService<InventoryExtEntity,Str
|
|||
@Override
|
||||
public InventoryExtEntity getInvExt(InventoryExtEntity entity) throws Exception {
|
||||
if (null != entity && StrUtil.isNotEmpty(entity.getcInvCode())){
|
||||
List<InventoryExtEntity> query = inventoryextDao.query(entity);
|
||||
InventoryExtEntity extEntity = new InventoryExtEntity();
|
||||
extEntity.setCInvCode(entity.getCInvCode());
|
||||
List<InventoryExtEntity> query = inventoryextDao.query(extEntity);
|
||||
if (CollectionUtils.isNotEmpty(query)){
|
||||
if (query.size() > 1){
|
||||
throw new BaseSystemException("根据存货编码"+entity.getcInvCode()+"查询到多条扩展自定义项数据,请检查数据准确性");
|
||||
|
|
|
@ -77,23 +77,8 @@ public class InventoryService extends BaseService<InventoryEntity,String> implem
|
|||
checkInventory("save",entity);
|
||||
//保存存货信息
|
||||
inventoryDao.save(entity);
|
||||
//保存子表数据
|
||||
InventorySubEntity subEntity = new InventorySubEntity();
|
||||
subEntity.setDataSourceCode(entity.getDataSourceCode());
|
||||
subEntity.setcInvSubCode(entity.getcInvCode());
|
||||
subEntity.setAcc_name(entity.getAcc_name());
|
||||
//检查子表有没有保存过
|
||||
List<InventorySubEntity> subEntityList = subService.query(subEntity);
|
||||
subEntity.setbInvKeyPart("0");//是否关键物料 1是0否
|
||||
subEntity.setAcc_name(entity.getAcc_name());
|
||||
subEntity.setPlanCheckDay("0");//计划检验天数
|
||||
subEntity.setdInvCreateDatetime(DateUtil.now());//建档日期
|
||||
subEntity.setiDrawType("0");//领料方式 0是直接领用,1是申请领用
|
||||
if (CollectionUtils.isEmpty(subEntityList)){
|
||||
subService.save(subEntity);
|
||||
}else {
|
||||
subService.update(subEntity);
|
||||
}
|
||||
//保存存货副表
|
||||
subService.saveOrUpdateInvSub(entity.getInvSubEntity());
|
||||
//保存扩展自由项
|
||||
inventoryExtService.saveOrUpdateInv(entity.getInvExtEntity());
|
||||
//保存自定义表
|
||||
|
@ -151,6 +136,10 @@ public class InventoryService extends BaseService<InventoryEntity,String> implem
|
|||
public void updateInventory(InventoryEntity entity) throws Exception {
|
||||
checkInventory("update",entity);
|
||||
inventoryDao.update(entity);
|
||||
//更新存货自由项
|
||||
inventoryExtService.saveOrUpdateInv(entity.getInvExtEntity());
|
||||
//更新存货子表
|
||||
subService.saveOrUpdateInvSub(entity.getInvSubEntity());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -163,6 +152,8 @@ public class InventoryService extends BaseService<InventoryEntity,String> implem
|
|||
Assert.notEmpty(entity.getcInvCode(),()-> new BaseSystemException("存货编码不能为空"));
|
||||
Assert.notEmpty(entity.getDataSourceCode(),()-> new BaseSystemException("数据源编码不能为空"));
|
||||
Assert.notEmpty(entity.getAcc_name(),()-> new BaseSystemException("账套号不能为空"));
|
||||
Assert.notNull(entity.getInvExtEntity(),()-> new BaseSystemException("扩展自定义项不能为空"));
|
||||
Assert.notNull(entity.getInvSubEntity(),()-> new BaseSystemException("存货子表不能为空"));
|
||||
switch (type) {
|
||||
case "save":
|
||||
break;
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
package com.hzya.frame.u8.base.inventory.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import com.hzya.frame.u8.base.inventory.dao.IInventorySubDao;
|
||||
import com.hzya.frame.u8.base.inventory.entity.InventorySubEntity;
|
||||
import com.hzya.frame.u8.base.inventory.service.IInventorySubService;
|
||||
import com.hzya.frame.web.exception.BaseSystemException;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description
|
||||
* @Author xiangerlin
|
||||
|
@ -22,4 +28,38 @@ public class InventorySubServiceImpl extends BaseService<InventorySubEntity,Stri
|
|||
this.inventorySubDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据存货编码查存货子表
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public InventorySubEntity getInvSub(InventorySubEntity entity) throws Exception {
|
||||
if (null != entity && StrUtil.isNotEmpty(entity.getcInvSubCode())){
|
||||
InventorySubEntity subEntity = new InventorySubEntity();
|
||||
subEntity.setcInvSubCode(entity.getcInvSubCode());
|
||||
List<InventorySubEntity> query = inventorySubDao.query(subEntity);
|
||||
if (CollectionUtils.isNotEmpty(query)){
|
||||
if (query.size() > 1){
|
||||
throw new BaseSystemException("根据存货编码"+entity.getcInvSubCode()+"查询到多条副表数据,请检查数据准确性");
|
||||
}
|
||||
return query.get(0);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public void saveOrUpdateInvSub(InventorySubEntity entity) throws Exception {
|
||||
InventorySubEntity invSub = getInvSub(entity);
|
||||
if (null != invSub){
|
||||
inventorySubDao.update(entity);
|
||||
}else {
|
||||
inventorySubDao.save(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue