库存管理
This commit is contained in:
parent
b7e86fdfcf
commit
84e0ad09d5
|
|
@ -113,7 +113,7 @@ public class ImsIntoInventoryController extends BaseController
|
|||
//@PreventRepeatSubmit
|
||||
//@RequiresPermissions("ims:inventory:remove")
|
||||
@SysLog(title = "入库记录", businessType = OperaType.DELETE, logType = 1,module = "入库记录->删除入库记录")
|
||||
@DeleteMapping("/{intoIds}")
|
||||
@PostMapping("/{intoIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] intoIds)
|
||||
{
|
||||
return toAjax(imsIntoInventoryService.deleteImsIntoInventoryByIntoIds(intoIds));
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public class ImsInventoryController extends BaseController
|
|||
//@PreventRepeatSubmit
|
||||
//@RequiresPermissions("ims:inventory:remove")
|
||||
@SysLog(title = "库存", businessType = OperaType.DELETE, logType = 1,module = "库存->删除库存")
|
||||
@DeleteMapping("/{inventoryIds}")
|
||||
@PostMapping("/{inventoryIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] inventoryIds)
|
||||
{
|
||||
return toAjax(imsInventoryService.deleteImsInventoryByInventoryIds(inventoryIds));
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ public class ImsOutInventoryController extends BaseController
|
|||
//@PreventRepeatSubmit
|
||||
//@RequiresPermissions("ims:inventory:remove")
|
||||
@SysLog(title = "出库记录", businessType = OperaType.DELETE, logType = 1,module = "出库记录->删除出库记录")
|
||||
@DeleteMapping("/{outIds}")
|
||||
@PostMapping("/{outIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] outIds)
|
||||
{
|
||||
return toAjax(imsOutInventoryService.deleteImsOutInventoryByOutIds(outIds));
|
||||
|
|
|
|||
|
|
@ -2,10 +2,13 @@ package com.bonus.canteen.core.ims.domain;
|
|||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 出库记录明细对象 ims_out_inventory_detail
|
||||
|
|
@ -75,4 +78,57 @@ public class ImsOutInventoryDetail extends BaseEntity
|
|||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
@ApiModelProperty(value = "仓库名称")
|
||||
@Excel(name = "仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty(value = "材料名称")
|
||||
@Excel(name = "材料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty(value = "货品类别")
|
||||
@Excel(name = "货品类别")
|
||||
private String materialTypeName;
|
||||
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
@Excel(name = "计量单位")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value = "条码")
|
||||
@Excel(name = "条码")
|
||||
private String barCode;
|
||||
|
||||
@ApiModelProperty(value = "货品规格")
|
||||
@Excel(name = "货品规格")
|
||||
private String materialSize;
|
||||
|
||||
@ApiModelProperty(value = "区域名称")
|
||||
@Excel(name = "区域名称")
|
||||
private String areaName;
|
||||
|
||||
@ApiModelProperty(value = "区域ID")
|
||||
@Excel(name = "区域ID")
|
||||
private String areaId;
|
||||
|
||||
@ApiModelProperty(value = "货品编码")
|
||||
@Excel(name = "货品编码")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty(value = "入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String intoCode;
|
||||
|
||||
@ApiModelProperty(value = "入库时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime intoDate;
|
||||
|
||||
@ApiModelProperty(value = "当前批次剩余库存数量")
|
||||
@Excel(name = "当前批次剩余库存数量")
|
||||
private BigDecimal inventoryNum;
|
||||
|
||||
@ApiModelProperty(value = "到期时间(保质期)")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "到期时间(保质期)", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private LocalDate expireTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,13 @@ package com.bonus.canteen.core.ims.domain.vo;
|
|||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 出库记录明细对象 ims_out_inventory_detail
|
||||
|
|
@ -72,4 +75,58 @@ public class ImsOutInventoryDetailVO extends BaseEntity
|
|||
@Excel(name = "是否透支库存明细(1是2否)")
|
||||
private Long ifOverdraft;
|
||||
|
||||
@ApiModelProperty(value = "仓库名称")
|
||||
@Excel(name = "仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty(value = "材料名称")
|
||||
@Excel(name = "材料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty(value = "货品类别")
|
||||
@Excel(name = "货品类别")
|
||||
private String materialTypeName;
|
||||
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
@Excel(name = "计量单位")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value = "条码")
|
||||
@Excel(name = "条码")
|
||||
private String barCode;
|
||||
|
||||
@ApiModelProperty(value = "货品规格")
|
||||
@Excel(name = "货品规格")
|
||||
private String materialSize;
|
||||
|
||||
@ApiModelProperty(value = "区域名称")
|
||||
@Excel(name = "区域名称")
|
||||
private String areaName;
|
||||
|
||||
@ApiModelProperty(value = "区域ID")
|
||||
@Excel(name = "区域ID")
|
||||
private String areaId;
|
||||
|
||||
@ApiModelProperty(value = "货品编码")
|
||||
@Excel(name = "货品编码")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty(value = "入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String intoCode;
|
||||
|
||||
@ApiModelProperty(value = "入库时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime intoDate;
|
||||
|
||||
@ApiModelProperty(value = "当前批次剩余库存数量")
|
||||
@Excel(name = "当前批次剩余库存数量")
|
||||
private BigDecimal inventoryNum;
|
||||
|
||||
@ApiModelProperty(value = "到期时间(保质期)")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "到期时间(保质期)", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private LocalDate expireTime;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import java.math.BigDecimal;
|
|||
import java.util.List;
|
||||
import com.bonus.canteen.core.ims.domain.ImsIntoInventory;
|
||||
import com.bonus.canteen.core.ims.domain.ImsIntoInventoryDetail;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 入库记录Mapper接口
|
||||
|
|
@ -87,5 +88,5 @@ public interface ImsIntoInventoryMapper {
|
|||
|
||||
public List<ImsIntoInventoryDetail> selectImsIntoInventoryDetailListByInventoryId(Long inventoryId);
|
||||
|
||||
public int updateIntoInventoryNum(Long intoDetailId, BigDecimal inventoryNum);
|
||||
public int updateIntoInventoryNum(@Param("intoDetailId") Long intoDetailId, @Param("fetchNum") BigDecimal fetchNum);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
|
|||
imsOutInventoryDetail.setIfOverdraft(CommonFlagEnum.NO.getKey());
|
||||
}
|
||||
imsOutInventoryDetail.setDelFlag(String.valueOf(DelFlagEnum.DEL_FALSE.key()));
|
||||
list.add(imsOutInventoryDetail);
|
||||
|
||||
if(Long.valueOf(2).equals(imsOutInventory.getStatus())) {
|
||||
if(Objects.isNull(imsOutInventoryDetail.getInventoryId())
|
||||
|| imsOutInventoryDetail.getInventoryId() < 0) {
|
||||
|
|
@ -214,7 +214,6 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
|
|||
}
|
||||
ImsInventoryUpdate imsInventoryUpdate = new ImsInventoryUpdate();
|
||||
imsInventoryUpdate.setInventoryId(imsOutInventoryDetail.getInventoryId());
|
||||
imsInventoryUpdate.setFetchNum(imsOutInventoryDetail.getFetchNum());
|
||||
int rows = imsInventoryService.updateImsInventory(imsInventoryUpdate);
|
||||
if(rows < 1) {
|
||||
throw new ServiceException("库存不足");
|
||||
|
|
@ -232,17 +231,23 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
|
|||
int updateRows = imsIntoInventoryMapper.
|
||||
updateIntoInventoryNum(imsIntoInventoryDetail.getIntoDetailId(), imsIntoInventoryDetail.getInventoryNum());
|
||||
if(updateRows > 0) {
|
||||
tempFetchLeftNum = tempFetchLeftNum.subtract(imsIntoInventoryDetail.getInventoryNum());
|
||||
totalPrice += (imsIntoInventoryDetail.getInventoryNum()
|
||||
.multiply(BigDecimal.valueOf(imsIntoInventoryDetail.getUnitPrice()))).longValue();
|
||||
imsOutInventoryDetail.setIntoDetailId(imsIntoInventoryDetail.getIntoDetailId());
|
||||
imsOutInventoryDetail.setFetchNum(imsIntoInventoryDetail.getInventoryNum());
|
||||
list.add(imsOutInventoryDetail);
|
||||
tempFetchLeftNum = tempFetchLeftNum.subtract(imsIntoInventoryDetail.getInventoryNum());
|
||||
}
|
||||
}else {
|
||||
int updateRows = imsIntoInventoryMapper.
|
||||
updateIntoInventoryNum(imsIntoInventoryDetail.getIntoDetailId(), tempFetchLeftNum);
|
||||
if(updateRows > 0) {
|
||||
tempFetchLeftNum = tempFetchLeftNum.subtract(tempFetchLeftNum);
|
||||
totalPrice += (tempFetchLeftNum
|
||||
.multiply(BigDecimal.valueOf(imsIntoInventoryDetail.getUnitPrice()))).longValue();
|
||||
imsOutInventoryDetail.setIntoDetailId(imsIntoInventoryDetail.getIntoDetailId());
|
||||
imsOutInventoryDetail.setFetchNum(tempFetchLeftNum);
|
||||
list.add(imsOutInventoryDetail);
|
||||
tempFetchLeftNum = tempFetchLeftNum.subtract(tempFetchLeftNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="warehouseName" column="warehouse_name" />
|
||||
<result property="materialName" column="material_name" />
|
||||
<result property="materialTypeName" column="material_type_name" />
|
||||
<result property="unitName" column="unit_name" />
|
||||
<result property="barCode" column="bar_code" />
|
||||
<result property="materialSize" column="material_size" />
|
||||
<result property="areaName" column="area_name" />
|
||||
<result property="areaId" column="area_id" />
|
||||
<result property="materialCode" column="material_code" />
|
||||
<result property="expireTime" column="expire_time" />
|
||||
<result property="inventoryNum" column="inventory_num" />
|
||||
<result property="intoCode" column="into_code" />
|
||||
<result property="intoDate" column="into_date" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectImsOutInventoryVo">
|
||||
|
|
@ -104,11 +117,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="selectImsOutInventoryDetailList" resultMap="ImsOutInventoryDetailResult">
|
||||
select out_detail_id, out_id, out_code, inventory_id, fetch_num, total_price,
|
||||
into_detail_id, interval_id, size, img_url, if_overdraft, remark, del_flag,
|
||||
create_by, create_time, update_by, update_time
|
||||
from ims_out_inventory_detail
|
||||
where out_id = #{out_id} and del_flag = '0'
|
||||
select out_detail_id, out_id, out_code, ioid.inventory_id, fetch_num, ioid.total_price,
|
||||
ioid.into_detail_id, interval_id, ioid.size, ioid.img_url, if_overdraft, ioid.remark, ioid.del_flag,
|
||||
ioid.create_by, ioid.create_time, ioid.update_by, ioid.update_time,
|
||||
cm.material_name, cmt.material_type_name, iu.unit_name, cm.bar_code,
|
||||
cm.size AS material_size, cm.material_code, iiid.inventory_num, iiid.expire_time, iii.into_date, iii.into_code
|
||||
from ims_out_inventory_detail ioid
|
||||
left join ims_into_inventory_detail iiid on ioid.into_detail_id = iiid.into_detail_id
|
||||
left join ims_into_inventory iii on iii.into_id = iiid.into_id
|
||||
left join ims_supplier isr on iiid.supplier_id = isr.supplier_id
|
||||
left join cook_material cm on iiid.material_id = cm.material_id
|
||||
left join cook_material_type cmt on cm.material_type_id = cmt.material_type_id
|
||||
left join ims_unit iu on iiid.unit_id = iu.unit_id
|
||||
where out_id = #{out_id} and ioid.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertImsOutInventory" parameterType="com.bonus.canteen.core.ims.domain.ImsOutInventory" useGeneratedKeys="true" keyProperty="outId">
|
||||
|
|
|
|||
Loading…
Reference in New Issue