Compare commits
2 Commits
efb7d360c7
...
b7e86fdfcf
| Author | SHA1 | Date |
|---|---|---|
|
|
b7e86fdfcf | |
|
|
0666085986 |
|
|
@ -90,7 +90,12 @@ public class ImsInventoryController extends BaseController
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody ImsInventoryAdd imsInventoryAdd)
|
public AjaxResult add(@RequestBody ImsInventoryAdd imsInventoryAdd)
|
||||||
{
|
{
|
||||||
return toAjax(imsInventoryService.insertImsInventory(imsInventoryAdd));
|
try {
|
||||||
|
imsInventoryService.insertImsInventory(imsInventoryAdd);
|
||||||
|
}catch (Exception e) {
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,14 @@ public class ImsIntoInventory extends BaseEntity
|
||||||
@Excel(name = "仓库名称")
|
@Excel(name = "仓库名称")
|
||||||
private String warehouseName;
|
private String warehouseName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "区域名称")
|
||||||
|
@Excel(name = "区域名称")
|
||||||
|
private String areaName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "区域ID")
|
||||||
|
@Excel(name = "区域ID")
|
||||||
|
private String areaId;
|
||||||
|
|
||||||
@ApiModelProperty("开始时间")
|
@ApiModelProperty("开始时间")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime startDateTime;
|
private LocalDateTime startDateTime;
|
||||||
|
|
|
||||||
|
|
@ -128,4 +128,28 @@ public class ImsIntoInventoryDetail extends BaseEntity
|
||||||
@Excel(name = "供应商名称")
|
@Excel(name = "供应商名称")
|
||||||
private String supplierName;
|
private String supplierName;
|
||||||
|
|
||||||
|
@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 materialCode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,4 +82,32 @@ public class ImsInventory extends BaseEntity
|
||||||
/** 出库数量 */
|
/** 出库数量 */
|
||||||
@ApiModelProperty(value = "出库数量")
|
@ApiModelProperty(value = "出库数量")
|
||||||
private BigDecimal fetchNum;
|
private BigDecimal fetchNum;
|
||||||
|
|
||||||
|
@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 size;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "区域名称")
|
||||||
|
@Excel(name = "区域名称")
|
||||||
|
private String areaName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "区域ID")
|
||||||
|
@Excel(name = "区域ID")
|
||||||
|
private String areaId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "货品编码")
|
||||||
|
@Excel(name = "货品编码")
|
||||||
|
private String materialCode;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,15 @@ public class ImsOutInventory extends BaseEntity
|
||||||
|
|
||||||
@ApiModelProperty(value = "领料人")
|
@ApiModelProperty(value = "领料人")
|
||||||
@Excel(name = "领料人")
|
@Excel(name = "领料人")
|
||||||
private String fetchUserName;
|
private String fetchUser;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "区域名称")
|
||||||
|
@Excel(name = "区域名称")
|
||||||
|
private String areaName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "区域ID")
|
||||||
|
@Excel(name = "区域ID")
|
||||||
|
private String areaId;
|
||||||
|
|
||||||
@ApiModelProperty("开始时间")
|
@ApiModelProperty("开始时间")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.bonus.canteen.core.ims.domain.param;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -41,11 +43,11 @@ public class ImsOutInventoryAdd implements Serializable
|
||||||
/** 出库时间 */
|
/** 出库时间 */
|
||||||
@ApiModelProperty(value = "出库时间")
|
@ApiModelProperty(value = "出库时间")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@NotNull(message = "出库时间不能为空")
|
||||||
private LocalDateTime outDate;
|
private LocalDateTime outDate;
|
||||||
|
|
||||||
/** 领取人id */
|
/** 领取人id */
|
||||||
@ApiModelProperty(value = "领取人id")
|
@ApiModelProperty(value = "领取人id")
|
||||||
@NotNull(message = "领取人id不能为空")
|
|
||||||
private Long fetchUserId;
|
private Long fetchUserId;
|
||||||
|
|
||||||
/** 总数量 */
|
/** 总数量 */
|
||||||
|
|
@ -68,8 +70,6 @@ public class ImsOutInventoryAdd implements Serializable
|
||||||
|
|
||||||
/** 总金额 */
|
/** 总金额 */
|
||||||
@ApiModelProperty(value = "总金额")
|
@ApiModelProperty(value = "总金额")
|
||||||
@NotNull(message = "总金额不能为空")
|
|
||||||
@Min(value = 0, message = "总金额不能小于0")
|
|
||||||
private Long totalAmount;
|
private Long totalAmount;
|
||||||
|
|
||||||
/** 采购计划ID */
|
/** 采购计划ID */
|
||||||
|
|
@ -84,6 +84,9 @@ public class ImsOutInventoryAdd implements Serializable
|
||||||
@ApiModelProperty(value = "调拨单号")
|
@ApiModelProperty(value = "调拨单号")
|
||||||
private String goodsAllocationId;
|
private String goodsAllocationId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "领料人")
|
||||||
|
private String fetchUser;
|
||||||
|
|
||||||
// /** 删除标志(0代表存在 2代表删除) */
|
// /** 删除标志(0代表存在 2代表删除) */
|
||||||
// private String delFlag;
|
// private String delFlag;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ public class ImsOutInventoryDetailAdd implements Serializable
|
||||||
|
|
||||||
/** 总价 */
|
/** 总价 */
|
||||||
@ApiModelProperty(value = "总价")
|
@ApiModelProperty(value = "总价")
|
||||||
@NotNull(message = "总价不能为空")
|
|
||||||
private Long totalPrice;
|
private Long totalPrice;
|
||||||
|
|
||||||
/** 入库批次详情id */
|
/** 入库批次详情id */
|
||||||
|
|
@ -59,7 +58,6 @@ public class ImsOutInventoryDetailAdd implements Serializable
|
||||||
|
|
||||||
/** 出库原料照片 */
|
/** 出库原料照片 */
|
||||||
@ApiModelProperty(value = "出库原料照片")
|
@ApiModelProperty(value = "出库原料照片")
|
||||||
@NotNull(message = "出库原料照片不能为空")
|
|
||||||
private String imgUrl;
|
private String imgUrl;
|
||||||
|
|
||||||
/** 是否透支库存明细(1是2否) */
|
/** 是否透支库存明细(1是2否) */
|
||||||
|
|
|
||||||
|
|
@ -82,4 +82,7 @@ public class ImsOutInventoryQuery implements Serializable
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime endDateTime;
|
private LocalDateTime endDateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "领料人")
|
||||||
|
private String fetchUser;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,11 @@ public class ImsOutInventoryUpdate implements Serializable
|
||||||
/** 出库时间 */
|
/** 出库时间 */
|
||||||
@ApiModelProperty(value = "出库时间")
|
@ApiModelProperty(value = "出库时间")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@NotNull(message = "出库时间不能为空")
|
||||||
private LocalDateTime outDate;
|
private LocalDateTime outDate;
|
||||||
|
|
||||||
/** 领取人id */
|
/** 领取人id */
|
||||||
@ApiModelProperty(value = "领取人id")
|
@ApiModelProperty(value = "领取人id")
|
||||||
@NotNull(message = "领取人id不能为空")
|
|
||||||
private Long fetchUserId;
|
private Long fetchUserId;
|
||||||
|
|
||||||
/** 总数量 */
|
/** 总数量 */
|
||||||
|
|
@ -68,8 +68,6 @@ public class ImsOutInventoryUpdate implements Serializable
|
||||||
|
|
||||||
/** 总金额 */
|
/** 总金额 */
|
||||||
@ApiModelProperty(value = "总金额")
|
@ApiModelProperty(value = "总金额")
|
||||||
@NotNull(message = "总金额不能为空")
|
|
||||||
@Min(value = 0, message = "总金额不能小于0")
|
|
||||||
private Long totalAmount;
|
private Long totalAmount;
|
||||||
|
|
||||||
/** 采购计划ID */
|
/** 采购计划ID */
|
||||||
|
|
@ -84,6 +82,9 @@ public class ImsOutInventoryUpdate implements Serializable
|
||||||
@ApiModelProperty(value = "调拨单号")
|
@ApiModelProperty(value = "调拨单号")
|
||||||
private String goodsAllocationId;
|
private String goodsAllocationId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "领料人")
|
||||||
|
private String fetchUser;
|
||||||
|
|
||||||
// /** 删除标志(0代表存在 2代表删除) */
|
// /** 删除标志(0代表存在 2代表删除) */
|
||||||
// private String delFlag;
|
// private String delFlag;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,4 +121,32 @@ public class ImsIntoInventoryDetailVO extends BaseEntity
|
||||||
@Excel(name = "关联送货单明细id")
|
@Excel(name = "关联送货单明细id")
|
||||||
private Long relateDeliveryGoodsDetailId;
|
private Long relateDeliveryGoodsDetailId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "供应商名称")
|
||||||
|
@Excel(name = "供应商名称")
|
||||||
|
private String supplierName;
|
||||||
|
|
||||||
|
@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 materialCode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,14 @@ public class ImsIntoInventoryVO extends BaseEntity
|
||||||
@Excel(name = "仓库名称")
|
@Excel(name = "仓库名称")
|
||||||
private String warehouseName;
|
private String warehouseName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "区域名称")
|
||||||
|
@Excel(name = "区域名称")
|
||||||
|
private String areaName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "区域ID")
|
||||||
|
@Excel(name = "区域ID")
|
||||||
|
private String areaId;
|
||||||
|
|
||||||
/** 入库记录明细信息 */
|
/** 入库记录明细信息 */
|
||||||
private List<ImsIntoInventoryDetailVO> imsIntoInventoryDetailVOList;
|
private List<ImsIntoInventoryDetailVO> imsIntoInventoryDetailVOList;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,4 +57,48 @@ public class ImsInventoryVO extends BaseEntity
|
||||||
@Excel(name = "库存状态(1-正常,2-不足,3-超额)")
|
@Excel(name = "库存状态(1-正常,2-不足,3-超额)")
|
||||||
private Long inventoryStatus;
|
private Long inventoryStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "仓库名称")
|
||||||
|
@Excel(name = "仓库名称")
|
||||||
|
private String warehouseName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "货品类别")
|
||||||
|
@Excel(name = "货品类别")
|
||||||
|
private String materialTypeName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "货品编码")
|
||||||
|
@Excel(name = "货品编码")
|
||||||
|
private String materialCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "计量单位")
|
||||||
|
@Excel(name = "计量单位")
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "条码")
|
||||||
|
@Excel(name = "条码")
|
||||||
|
private String barCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "货品规格")
|
||||||
|
@Excel(name = "货品规格")
|
||||||
|
private String size;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "区域名称")
|
||||||
|
@Excel(name = "区域名称")
|
||||||
|
private String areaName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "区域ID")
|
||||||
|
@Excel(name = "区域ID")
|
||||||
|
private String areaId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "材料名称")
|
||||||
|
@Excel(name = "材料名称")
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "库存金额")
|
||||||
|
@Excel(name = "库存金额")
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "总库存数")
|
||||||
|
@Excel(name = "总库存数")
|
||||||
|
private BigDecimal totalNum;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,22 @@ public class ImsOutInventoryVO extends BaseEntity
|
||||||
@Excel(name = "调拨单号")
|
@Excel(name = "调拨单号")
|
||||||
private String goodsAllocationId;
|
private String goodsAllocationId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "领料人")
|
||||||
|
@Excel(name = "领料人")
|
||||||
|
private String fetchUser;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "区域名称")
|
||||||
|
@Excel(name = "区域名称")
|
||||||
|
private String areaName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "区域ID")
|
||||||
|
@Excel(name = "区域ID")
|
||||||
|
private String areaId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "仓库名称")
|
||||||
|
@Excel(name = "仓库名称")
|
||||||
|
private String warehouseName;
|
||||||
|
|
||||||
/** 出库记录明细信息 */
|
/** 出库记录明细信息 */
|
||||||
private List<ImsOutInventoryDetailVO> imsOutInventoryDetailVOList;
|
private List<ImsOutInventoryDetailVO> imsOutInventoryDetailVOList;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.canteen.core.ims.mapper;
|
package com.bonus.canteen.core.ims.mapper;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.bonus.canteen.core.ims.domain.ImsIntoInventory;
|
import com.bonus.canteen.core.ims.domain.ImsIntoInventory;
|
||||||
import com.bonus.canteen.core.ims.domain.ImsIntoInventoryDetail;
|
import com.bonus.canteen.core.ims.domain.ImsIntoInventoryDetail;
|
||||||
|
|
@ -10,8 +11,7 @@ import com.bonus.canteen.core.ims.domain.ImsIntoInventoryDetail;
|
||||||
* @author gaowdong
|
* @author gaowdong
|
||||||
* @date 2025-07-07
|
* @date 2025-07-07
|
||||||
*/
|
*/
|
||||||
public interface ImsIntoInventoryMapper
|
public interface ImsIntoInventoryMapper {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 查询入库记录
|
* 查询入库记录
|
||||||
*
|
*
|
||||||
|
|
@ -84,4 +84,8 @@ public interface ImsIntoInventoryMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteImsIntoInventoryDetailByIntoId(Long intoId);
|
public int deleteImsIntoInventoryDetailByIntoId(Long intoId);
|
||||||
|
|
||||||
|
public List<ImsIntoInventoryDetail> selectImsIntoInventoryDetailListByInventoryId(Long inventoryId);
|
||||||
|
|
||||||
|
public int updateIntoInventoryNum(Long intoDetailId, BigDecimal inventoryNum);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ public interface IImsInventoryService
|
||||||
* @param imsInventoryAdd 库存
|
* @param imsInventoryAdd 库存
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertImsInventory(ImsInventoryAdd imsInventoryAdd);
|
public Long insertImsInventory(ImsInventoryAdd imsInventoryAdd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改库存
|
* 修改库存
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,7 @@ public class ImsIntoInventoryServiceImpl implements IImsIntoInventoryService
|
||||||
imsIntoInventoryDetail.setIntoCode(imsIntoInventory.getIntoCode());
|
imsIntoInventoryDetail.setIntoCode(imsIntoInventory.getIntoCode());
|
||||||
imsIntoInventoryDetail.setCreateTime(DateUtils.getNowDate());
|
imsIntoInventoryDetail.setCreateTime(DateUtils.getNowDate());
|
||||||
imsIntoInventoryDetail.setCreateBy(SecurityUtils.getUsername());
|
imsIntoInventoryDetail.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
imsIntoInventoryDetail.setInventoryNum(imsIntoInventoryDetail.getPurNum());
|
||||||
if(Objects.isNull(imsIntoInventoryDetail.getIfFillInventory())) {
|
if(Objects.isNull(imsIntoInventoryDetail.getIfFillInventory())) {
|
||||||
imsIntoInventoryDetail.setIfFillInventory(CommonFlagEnum.NO.getKey());
|
imsIntoInventoryDetail.setIfFillInventory(CommonFlagEnum.NO.getKey());
|
||||||
}
|
}
|
||||||
|
|
@ -210,7 +211,8 @@ public class ImsIntoInventoryServiceImpl implements IImsIntoInventoryService
|
||||||
imsInventoryAdd.setWarehouseId(imsIntoInventory.getWarehouseId());
|
imsInventoryAdd.setWarehouseId(imsIntoInventory.getWarehouseId());
|
||||||
imsInventoryAdd.setMaterialNum(imsIntoInventoryDetail.getPurNum());
|
imsInventoryAdd.setMaterialNum(imsIntoInventoryDetail.getPurNum());
|
||||||
imsInventoryAdd.setUnitId(imsIntoInventoryDetail.getUnitId());
|
imsInventoryAdd.setUnitId(imsIntoInventoryDetail.getUnitId());
|
||||||
imsInventoryService.insertImsInventory(imsInventoryAdd);
|
Long inventoryId = imsInventoryService.insertImsInventory(imsInventoryAdd);
|
||||||
|
imsIntoInventoryDetail.setInventoryId(inventoryId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (list.size() > 0)
|
if (list.size() > 0)
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
package com.bonus.canteen.core.ims.service.impl;
|
package com.bonus.canteen.core.ims.service.impl;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.bonus.canteen.core.ims.domain.ImsIntoInventory;
|
||||||
import com.bonus.canteen.core.ims.domain.ImsIntoInventoryDetail;
|
import com.bonus.canteen.core.ims.domain.ImsIntoInventoryDetail;
|
||||||
import com.bonus.canteen.core.ims.domain.param.ImsInventoryAdd;
|
import com.bonus.canteen.core.ims.domain.param.ImsInventoryAdd;
|
||||||
import com.bonus.canteen.core.ims.domain.param.ImsInventoryQuery;
|
import com.bonus.canteen.core.ims.domain.param.ImsInventoryQuery;
|
||||||
|
|
@ -12,6 +16,7 @@ import com.bonus.canteen.core.ims.domain.param.ImsInventoryUpdate;
|
||||||
import com.bonus.canteen.core.ims.domain.vo.ImsIntoInventoryDetailVO;
|
import com.bonus.canteen.core.ims.domain.vo.ImsIntoInventoryDetailVO;
|
||||||
import com.bonus.canteen.core.ims.domain.vo.ImsIntoInventoryVO;
|
import com.bonus.canteen.core.ims.domain.vo.ImsIntoInventoryVO;
|
||||||
import com.bonus.canteen.core.ims.domain.vo.ImsInventoryVO;
|
import com.bonus.canteen.core.ims.domain.vo.ImsInventoryVO;
|
||||||
|
import com.bonus.canteen.core.ims.mapper.ImsIntoInventoryMapper;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.security.utils.SecurityUtils;
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
@ -32,6 +37,8 @@ public class ImsInventoryServiceImpl implements IImsInventoryService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private ImsInventoryMapper imsInventoryMapper;
|
private ImsInventoryMapper imsInventoryMapper;
|
||||||
|
@Autowired
|
||||||
|
private ImsIntoInventoryMapper imsIntoInventoryMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询库存
|
* 查询库存
|
||||||
|
|
@ -63,12 +70,25 @@ public class ImsInventoryServiceImpl implements IImsInventoryService
|
||||||
ImsInventory imsInventory = new ImsInventory();
|
ImsInventory imsInventory = new ImsInventory();
|
||||||
BeanUtils.copyProperties(imsInventoryQuery, imsInventory);
|
BeanUtils.copyProperties(imsInventoryQuery, imsInventory);
|
||||||
List<ImsInventory> imsInventoryList = imsInventoryMapper.selectImsInventoryList(imsInventory);
|
List<ImsInventory> imsInventoryList = imsInventoryMapper.selectImsInventoryList(imsInventory);
|
||||||
List<ImsInventoryVO> imsInventoryVOList = null;
|
List<ImsInventoryVO> imsInventoryVOList = new ArrayList<>();
|
||||||
if(CollUtil.isNotEmpty(imsInventoryList)) {
|
if(CollUtil.isNotEmpty(imsInventoryList)) {
|
||||||
imsInventoryVOList = new ArrayList<>();
|
Map<Long, BigDecimal> materialIdCountMap = imsInventoryList.stream()
|
||||||
|
.collect(Collectors.groupingBy(ImsInventory::getMaterialId,
|
||||||
|
Collectors.mapping(ImsInventory::getMaterialNum,
|
||||||
|
Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
|
||||||
for(ImsInventory inventory : imsInventoryList) {
|
for(ImsInventory inventory : imsInventoryList) {
|
||||||
|
List<ImsIntoInventoryDetail> imsIntoInventoryDetailList =
|
||||||
|
imsIntoInventoryMapper.selectImsIntoInventoryDetailListByInventoryId(inventory.getInventoryId());
|
||||||
|
Map<Long, BigDecimal> inventoryIdToTotalPrice = imsIntoInventoryDetailList.stream()
|
||||||
|
.collect(Collectors.groupingBy(ImsIntoInventoryDetail::getInventoryId,
|
||||||
|
Collectors.mapping(detail -> detail.getInventoryNum().multiply(BigDecimal.valueOf(detail.getUnitPrice())),
|
||||||
|
Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
|
||||||
ImsInventoryVO imsInventoryVO = new ImsInventoryVO();
|
ImsInventoryVO imsInventoryVO = new ImsInventoryVO();
|
||||||
BeanUtils.copyProperties(inventory, imsInventoryVO);
|
BeanUtils.copyProperties(inventory, imsInventoryVO);
|
||||||
|
BigDecimal count = materialIdCountMap.get(inventory.getMaterialId());
|
||||||
|
imsInventoryVO.setTotalNum(count == null ? BigDecimal.ZERO : count);
|
||||||
|
BigDecimal totalPrice = inventoryIdToTotalPrice.get(inventory.getInventoryId());
|
||||||
|
imsInventoryVO.setTotalPrice(totalPrice == null ? BigDecimal.ZERO : totalPrice);
|
||||||
imsInventoryVOList.add(imsInventoryVO);
|
imsInventoryVOList.add(imsInventoryVO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +102,7 @@ public class ImsInventoryServiceImpl implements IImsInventoryService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertImsInventory(ImsInventoryAdd imsInventoryAdd)
|
public Long insertImsInventory(ImsInventoryAdd imsInventoryAdd)
|
||||||
{
|
{
|
||||||
ImsInventory imsInventory = new ImsInventory();
|
ImsInventory imsInventory = new ImsInventory();
|
||||||
BeanUtils.copyProperties(imsInventoryAdd, imsInventory);
|
BeanUtils.copyProperties(imsInventoryAdd, imsInventory);
|
||||||
|
|
@ -90,7 +110,8 @@ public class ImsInventoryServiceImpl implements IImsInventoryService
|
||||||
imsInventory.setCreateBy(SecurityUtils.getUsername());
|
imsInventory.setCreateBy(SecurityUtils.getUsername());
|
||||||
imsInventory.setUpdateBy(SecurityUtils.getUsername());
|
imsInventory.setUpdateBy(SecurityUtils.getUsername());
|
||||||
imsInventory.setUpdateTime(DateUtils.getNowDate());
|
imsInventory.setUpdateTime(DateUtils.getNowDate());
|
||||||
return imsInventoryMapper.insertImsInventory(imsInventory);
|
imsInventoryMapper.insertImsInventory(imsInventory);
|
||||||
|
return imsInventory.getInventoryId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,12 @@ import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.bonus.canteen.core.ims.domain.ImsIntoInventoryDetail;
|
||||||
import com.bonus.canteen.core.ims.domain.param.*;
|
import com.bonus.canteen.core.ims.domain.param.*;
|
||||||
import com.bonus.canteen.core.ims.domain.vo.ImsIntoInventoryVO;
|
import com.bonus.canteen.core.ims.domain.vo.ImsIntoInventoryVO;
|
||||||
import com.bonus.canteen.core.ims.domain.vo.ImsOutInventoryDetailVO;
|
import com.bonus.canteen.core.ims.domain.vo.ImsOutInventoryDetailVO;
|
||||||
import com.bonus.canteen.core.ims.domain.vo.ImsOutInventoryVO;
|
import com.bonus.canteen.core.ims.domain.vo.ImsOutInventoryVO;
|
||||||
|
import com.bonus.canteen.core.ims.mapper.ImsIntoInventoryMapper;
|
||||||
import com.bonus.canteen.core.ims.service.IImsInventoryService;
|
import com.bonus.canteen.core.ims.service.IImsInventoryService;
|
||||||
import com.bonus.canteen.core.ims.utils.NoGenerateUtils;
|
import com.bonus.canteen.core.ims.utils.NoGenerateUtils;
|
||||||
import com.bonus.canteen.core.kitchen.domain.constants.CommonFlagEnum;
|
import com.bonus.canteen.core.kitchen.domain.constants.CommonFlagEnum;
|
||||||
|
|
@ -41,6 +43,8 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
|
||||||
private ImsOutInventoryMapper imsOutInventoryMapper;
|
private ImsOutInventoryMapper imsOutInventoryMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IImsInventoryService imsInventoryService;
|
private IImsInventoryService imsInventoryService;
|
||||||
|
@Autowired
|
||||||
|
private ImsIntoInventoryMapper imsIntoInventoryMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询出库记录
|
* 查询出库记录
|
||||||
|
|
@ -110,6 +114,7 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
|
||||||
imsOutInventory.setCreateTime(DateUtils.getNowDate());
|
imsOutInventory.setCreateTime(DateUtils.getNowDate());
|
||||||
imsOutInventory.setCreateBy(SecurityUtils.getUsername());
|
imsOutInventory.setCreateBy(SecurityUtils.getUsername());
|
||||||
imsOutInventory.setOutCode(NoGenerateUtils.generateOutCode());
|
imsOutInventory.setOutCode(NoGenerateUtils.generateOutCode());
|
||||||
|
imsOutInventory.setTotalAmount(0L);
|
||||||
int rows = imsOutInventoryMapper.insertImsOutInventory(imsOutInventory);
|
int rows = imsOutInventoryMapper.insertImsOutInventory(imsOutInventory);
|
||||||
insertImsOutInventoryDetail(imsOutInventoryAdd.getImsOutInventoryDetailAddList(), imsOutInventory);
|
insertImsOutInventoryDetail(imsOutInventoryAdd.getImsOutInventoryDetailAddList(), imsOutInventory);
|
||||||
return rows;
|
return rows;
|
||||||
|
|
@ -181,6 +186,7 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
|
||||||
if (StringUtils.isNotNull(imsOutInventoryDetailAddList))
|
if (StringUtils.isNotNull(imsOutInventoryDetailAddList))
|
||||||
{
|
{
|
||||||
List<ImsOutInventoryDetail> list = new ArrayList<ImsOutInventoryDetail>();
|
List<ImsOutInventoryDetail> list = new ArrayList<ImsOutInventoryDetail>();
|
||||||
|
long totalPriceSum = 0L;
|
||||||
for (ImsOutInventoryDetailAdd imsOutInventoryDetailAdd : imsOutInventoryDetailAddList)
|
for (ImsOutInventoryDetailAdd imsOutInventoryDetailAdd : imsOutInventoryDetailAddList)
|
||||||
{
|
{
|
||||||
ImsOutInventoryDetail imsOutInventoryDetail = new ImsOutInventoryDetail();
|
ImsOutInventoryDetail imsOutInventoryDetail = new ImsOutInventoryDetail();
|
||||||
|
|
@ -189,6 +195,7 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
|
||||||
imsOutInventoryDetail.setOutCode(imsOutInventory.getOutCode());
|
imsOutInventoryDetail.setOutCode(imsOutInventory.getOutCode());
|
||||||
imsOutInventoryDetail.setCreateBy(SecurityUtils.getUsername());
|
imsOutInventoryDetail.setCreateBy(SecurityUtils.getUsername());
|
||||||
imsOutInventoryDetail.setCreateTime(DateUtils.getNowDate());
|
imsOutInventoryDetail.setCreateTime(DateUtils.getNowDate());
|
||||||
|
imsOutInventoryDetail.setImgUrl("");
|
||||||
if(Objects.isNull(imsOutInventoryDetail.getTotalPrice())) {
|
if(Objects.isNull(imsOutInventoryDetail.getTotalPrice())) {
|
||||||
imsOutInventoryDetail.setTotalPrice(0L);
|
imsOutInventoryDetail.setTotalPrice(0L);
|
||||||
}
|
}
|
||||||
|
|
@ -202,6 +209,9 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
|
||||||
|| imsOutInventoryDetail.getInventoryId() < 0) {
|
|| imsOutInventoryDetail.getInventoryId() < 0) {
|
||||||
throw new ServiceException("库存ID不能为空");
|
throw new ServiceException("库存ID不能为空");
|
||||||
}
|
}
|
||||||
|
if(Objects.isNull(imsOutInventoryDetail.getFetchNum())) {
|
||||||
|
throw new ServiceException("出库数量不能为空");
|
||||||
|
}
|
||||||
ImsInventoryUpdate imsInventoryUpdate = new ImsInventoryUpdate();
|
ImsInventoryUpdate imsInventoryUpdate = new ImsInventoryUpdate();
|
||||||
imsInventoryUpdate.setInventoryId(imsOutInventoryDetail.getInventoryId());
|
imsInventoryUpdate.setInventoryId(imsOutInventoryDetail.getInventoryId());
|
||||||
imsInventoryUpdate.setFetchNum(imsOutInventoryDetail.getFetchNum());
|
imsInventoryUpdate.setFetchNum(imsOutInventoryDetail.getFetchNum());
|
||||||
|
|
@ -209,11 +219,48 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
|
||||||
if(rows < 1) {
|
if(rows < 1) {
|
||||||
throw new ServiceException("库存不足");
|
throw new ServiceException("库存不足");
|
||||||
}
|
}
|
||||||
|
if(Objects.isNull(imsOutInventoryDetail.getIntoDetailId())) {
|
||||||
|
List<ImsIntoInventoryDetail> imsIntoInventoryDetailList = imsIntoInventoryMapper
|
||||||
|
.selectImsIntoInventoryDetailListByInventoryId(imsOutInventoryDetail.getInventoryId());
|
||||||
|
BigDecimal tempFetchLeftNum = imsOutInventoryDetail.getFetchNum();
|
||||||
|
long totalPrice = 0L;
|
||||||
|
for(ImsIntoInventoryDetail imsIntoInventoryDetail : imsIntoInventoryDetailList) {
|
||||||
|
if(tempFetchLeftNum.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(imsIntoInventoryDetail.getInventoryNum().compareTo(tempFetchLeftNum) <= 0) {
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
int updateRows = imsIntoInventoryMapper.
|
||||||
|
updateIntoInventoryNum(imsIntoInventoryDetail.getIntoDetailId(), tempFetchLeftNum);
|
||||||
|
if(updateRows > 0) {
|
||||||
|
tempFetchLeftNum = tempFetchLeftNum.subtract(tempFetchLeftNum);
|
||||||
|
totalPrice += (tempFetchLeftNum
|
||||||
|
.multiply(BigDecimal.valueOf(imsIntoInventoryDetail.getUnitPrice()))).longValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(tempFetchLeftNum.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
throw new ServiceException("出口失败,库存不足");
|
||||||
|
}
|
||||||
|
imsOutInventoryDetail.setTotalPrice(totalPrice);
|
||||||
|
totalPriceSum += totalPrice;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (list.size() > 0)
|
if (list.size() > 0)
|
||||||
{
|
{
|
||||||
imsOutInventoryMapper.batchImsOutInventoryDetail(list);
|
imsOutInventoryMapper.batchImsOutInventoryDetail(list);
|
||||||
|
ImsOutInventory imsOutInventoryUpdate = new ImsOutInventory();
|
||||||
|
imsOutInventoryUpdate.setOutId(outId);
|
||||||
|
imsOutInventoryUpdate.setTotalAmount(totalPriceSum);
|
||||||
|
imsOutInventoryMapper.updateImsOutInventory(imsOutInventoryUpdate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="warehouseName" column="warehouse_name" />
|
<result property="warehouseName" column="warehouse_name" />
|
||||||
|
<result property="areaName" column="area_name" />
|
||||||
|
<result property="areaId" column="area_id" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="ImsIntoInventoryImsIntoInventoryDetailResult" type="com.bonus.canteen.core.ims.domain.ImsIntoInventory" extends="ImsIntoInventoryResult">
|
<resultMap id="ImsIntoInventoryImsIntoInventoryDetailResult" type="com.bonus.canteen.core.ims.domain.ImsIntoInventory" extends="ImsIntoInventoryResult">
|
||||||
|
|
@ -59,15 +61,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="supplierName" column="supplier_name" />
|
<result property="supplierName" column="supplier_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="materialCode" column="material_code" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectImsIntoInventoryVo">
|
<sql id="selectImsIntoInventoryVo">
|
||||||
select into_id, into_code, iii.warehouse_id, into_date, total_num, into_type, status,
|
select into_id, into_code, iii.warehouse_id, into_date, total_num, into_type, status,
|
||||||
refund_out_id, relate_delivery_goods_id, total_amount, relate_order_goods_id,
|
refund_out_id, relate_delivery_goods_id, total_amount, relate_order_goods_id,
|
||||||
relate_inspect_goods_id, into_relate_out_id, goods_allocation_id, remark, iii.del_flag,
|
relate_inspect_goods_id, into_relate_out_id, goods_allocation_id, remark, iii.del_flag,
|
||||||
iii.create_by, iii.create_time, iii.update_by, iii.update_time, iwi.warehouse_name
|
iii.create_by, iii.create_time, iii.update_by, iii.update_time, iwi.warehouse_name,
|
||||||
|
ba.area_name, ba.area_id
|
||||||
from ims_into_inventory iii
|
from ims_into_inventory iii
|
||||||
left join ims_warehouse_info iwi on iii.warehouse_id = iwi.warehouse_id
|
left join ims_warehouse_info iwi on iii.warehouse_id = iwi.warehouse_id
|
||||||
|
left join basic_area ba on iwi.area_id = ba.area_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectImsIntoInventoryList" parameterType="com.bonus.canteen.core.ims.domain.ImsIntoInventory" resultMap="ImsIntoInventoryResult">
|
<select id="selectImsIntoInventoryList" parameterType="com.bonus.canteen.core.ims.domain.ImsIntoInventory" resultMap="ImsIntoInventoryResult">
|
||||||
|
|
@ -100,23 +110,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select into_id, into_code, iii.warehouse_id, into_date, total_num, into_type,
|
select into_id, into_code, iii.warehouse_id, into_date, total_num, into_type,
|
||||||
status, refund_out_id, relate_delivery_goods_id, total_amount,
|
status, refund_out_id, relate_delivery_goods_id, total_amount,
|
||||||
relate_order_goods_id, relate_inspect_goods_id, into_relate_out_id,
|
relate_order_goods_id, relate_inspect_goods_id, into_relate_out_id,
|
||||||
goods_allocation_id, remark, iii.del_flag, iii.create_by, iii.create_time, iii.update_by, iii.update_time
|
goods_allocation_id, remark, iii.del_flag, iii.create_by, iii.create_time,
|
||||||
|
iii.update_by, iii.update_time, iwi.warehouse_name, ba.area_name, ba.area_id
|
||||||
from ims_into_inventory iii
|
from ims_into_inventory iii
|
||||||
left join ims_warehouse_info iwi on iii.warehouse_id = iwi.warehouse_id
|
left join ims_warehouse_info iwi on iii.warehouse_id = iwi.warehouse_id
|
||||||
|
left join basic_area ba on iwi.area_id = ba.area_id
|
||||||
where iii.into_id = #{intoId} and iii.del_flag = '0'
|
where iii.into_id = #{intoId} and iii.del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectImsIntoInventoryDetailList" resultMap="ImsIntoInventoryDetailResult">
|
<select id="selectImsIntoInventoryDetailList" resultMap="ImsIntoInventoryDetailResult">
|
||||||
select into_detail_id, into_id, into_code, inventory_id, material_id, iiid.supplier_id,
|
select into_detail_id, into_id, into_code, inventory_id, iiid.material_id, iiid.supplier_id,
|
||||||
unit_id, size, unit_price, total_price, delivery_num, pur_num, unqualified_num,
|
iiid.unit_id, iiid.size, iiid.unit_price, total_price, delivery_num, pur_num, unqualified_num,
|
||||||
inventory_num, product_date, expire_time, img_url, if_fill_inventory,
|
inventory_num, product_date, expire_time, iiid.img_url, if_fill_inventory,
|
||||||
relate_order_goods_detail_id, relate_delivery_goods_detail_id, iiid.del_flag,
|
relate_order_goods_detail_id, relate_delivery_goods_detail_id, iiid.del_flag,
|
||||||
iiid.create_by, iiid.create_time, iiid.update_by, iiid.update_time, isr.supplier_name
|
iiid.create_by, iiid.create_time, iiid.update_by, iiid.update_time, isr.supplier_name,
|
||||||
|
cm.material_name, cmt.material_type_name,
|
||||||
|
iu.unit_name, cm.bar_code, cm.size AS material_size, cm.material_code
|
||||||
from ims_into_inventory_detail iiid
|
from ims_into_inventory_detail iiid
|
||||||
left join ims_supplier isr on iiid.supplier_id = isr.supplier_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 iiid.into_id = #{into_id} and iiid.del_flag = '0'
|
where iiid.into_id = #{into_id} and iiid.del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectImsIntoInventoryDetailListByInventoryId" resultMap="ImsIntoInventoryDetailResult">
|
||||||
|
select into_detail_id,
|
||||||
|
iiid.into_id,
|
||||||
|
iiid.into_code,
|
||||||
|
inventory_id,
|
||||||
|
material_id,
|
||||||
|
iiid.supplier_id,
|
||||||
|
unit_id,
|
||||||
|
size,
|
||||||
|
unit_price,
|
||||||
|
total_price,
|
||||||
|
delivery_num,
|
||||||
|
pur_num,
|
||||||
|
unqualified_num,
|
||||||
|
inventory_num,
|
||||||
|
product_date,
|
||||||
|
expire_time,
|
||||||
|
img_url,
|
||||||
|
if_fill_inventory,
|
||||||
|
relate_order_goods_detail_id,
|
||||||
|
relate_delivery_goods_detail_id,
|
||||||
|
iiid.del_flag,
|
||||||
|
iiid.create_by,
|
||||||
|
iiid.create_time,
|
||||||
|
iiid.update_by,
|
||||||
|
iiid.update_time
|
||||||
|
from ims_into_inventory_detail iiid
|
||||||
|
left join ims_into_inventory iii on iii.into_id = iiid.into_id
|
||||||
|
where iiid.inventory_id = #{inventoryId}
|
||||||
|
and iii.status = '2'
|
||||||
|
and iiid.inventory_num > 0
|
||||||
|
and iiid.del_flag = '0'
|
||||||
|
order by iii.into_date
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertImsIntoInventory" parameterType="com.bonus.canteen.core.ims.domain.ImsIntoInventory" useGeneratedKeys="true" keyProperty="intoId">
|
<insert id="insertImsIntoInventory" parameterType="com.bonus.canteen.core.ims.domain.ImsIntoInventory" useGeneratedKeys="true" keyProperty="intoId">
|
||||||
insert into ims_into_inventory
|
insert into ims_into_inventory
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
@ -217,4 +269,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
( #{item.intoDetailId}, #{item.intoId}, #{item.intoCode}, #{item.inventoryId}, #{item.materialId}, #{item.supplierId}, #{item.unitId}, #{item.size}, #{item.unitPrice}, #{item.totalPrice}, #{item.deliveryNum}, #{item.purNum}, #{item.unqualifiedNum}, #{item.inventoryNum}, #{item.productDate}, #{item.expireTime}, #{item.imgUrl}, #{item.ifFillInventory}, #{item.relateOrderGoodsDetailId}, #{item.relateDeliveryGoodsDetailId}, #{item.delFlag}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
|
( #{item.intoDetailId}, #{item.intoId}, #{item.intoCode}, #{item.inventoryId}, #{item.materialId}, #{item.supplierId}, #{item.unitId}, #{item.size}, #{item.unitPrice}, #{item.totalPrice}, #{item.deliveryNum}, #{item.purNum}, #{item.unqualifiedNum}, #{item.inventoryNum}, #{item.productDate}, #{item.expireTime}, #{item.imgUrl}, #{item.ifFillInventory}, #{item.relateOrderGoodsDetailId}, #{item.relateDeliveryGoodsDetailId}, #{item.delFlag}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateIntoInventoryNum">
|
||||||
|
update ims_into_inventory_detail
|
||||||
|
set inventory_num = inventory_num - #{fetchNum}
|
||||||
|
where into_detail_id = #{intoDetailId}
|
||||||
|
AND inventory_num >= #{fetchNum}
|
||||||
|
AND del_flag = '0'
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -21,15 +21,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="warehouseName" column="warehouse_name" />
|
<result property="warehouseName" column="warehouse_name" />
|
||||||
<result property="materialName" column="material_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="size" column="size" />
|
||||||
|
<result property="areaName" column="area_name" />
|
||||||
|
<result property="areaId" column="area_id" />
|
||||||
|
<result property="materialCode" column="material_code" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectImsInventoryVo">
|
<sql id="selectImsInventoryVo">
|
||||||
select inventory_id, ii.warehouse_id, ii.material_id, ii.unit_id, min_num, max_num,
|
select ii.inventory_id, ii.warehouse_id, ii.material_id, ii.unit_id, min_num, max_num,
|
||||||
material_num, inventory_status, remark, ii.del_flag, ii.create_by, ii.create_time,
|
material_num, inventory_status, remark, ii.del_flag, ii.create_by, ii.create_time,
|
||||||
ii.update_by, ii.update_time, iwi.warehouse_name, cm.material_name
|
ii.update_by, ii.update_time, iwi.warehouse_name, cm.material_name, cmt.material_type_name,
|
||||||
|
iu.unit_name, cm.bar_code, cm.size, ba.area_name, ba.area_id, cm.material_code
|
||||||
from ims_inventory ii
|
from ims_inventory ii
|
||||||
left join ims_warehouse_info iwi on ii.warehouse_id = iwi.warehouse_id
|
left join ims_warehouse_info iwi on ii.warehouse_id = iwi.warehouse_id
|
||||||
left join cook_material cm on ii.material_id = cm.material_id
|
left join cook_material cm on ii.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 ii.unit_id = iu.unit_id
|
||||||
|
left join basic_area ba on iwi.area_id = ba.area_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectImsInventoryList" parameterType="com.bonus.canteen.core.ims.domain.ImsInventory" resultMap="ImsInventoryResult">
|
<select id="selectImsInventoryList" parameterType="com.bonus.canteen.core.ims.domain.ImsInventory" resultMap="ImsInventoryResult">
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="warehouseName" column="warehouse_name" />
|
<result property="warehouseName" column="warehouse_name" />
|
||||||
<result property="fetchUserName" column="fetch_user_name" />
|
<result property="fetchUser" column="fetch_user" />
|
||||||
|
<result property="areaName" column="area_name" />
|
||||||
|
<result property="areaId" column="area_id" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="ImsOutInventoryImsOutInventoryDetailResult" type="com.bonus.canteen.core.ims.domain.ImsOutInventory" extends="ImsOutInventoryResult">
|
<resultMap id="ImsOutInventoryImsOutInventoryDetailResult" type="com.bonus.canteen.core.ims.domain.ImsOutInventory" extends="ImsOutInventoryResult">
|
||||||
|
|
@ -56,9 +58,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select out_id, out_code, ioi.warehouse_id, out_date, ioi.fetch_user_id, total_num, out_type,
|
select out_id, out_code, ioi.warehouse_id, out_date, ioi.fetch_user_id, total_num, out_type,
|
||||||
ioi.status, order_id, total_amount, plan_id, fetch_material_id, goods_allocation_id,
|
ioi.status, order_id, total_amount, plan_id, fetch_material_id, goods_allocation_id,
|
||||||
ioi.remark, ioi.del_flag, ioi.create_by, ioi.create_time, ioi.update_by, ioi.update_time,
|
ioi.remark, ioi.del_flag, ioi.create_by, ioi.create_time, ioi.update_by, ioi.update_time,
|
||||||
iwi.warehouse_name, su.user_name as fetch_user_name
|
iwi.warehouse_name, ioi.fetch_user, ba.area_id, ba.area_name
|
||||||
from ims_out_inventory ioi
|
from ims_out_inventory ioi
|
||||||
left join ims_warehouse_info iwi on ioi.warehouse_id = iwi.warehouse_id
|
left join ims_warehouse_info iwi on ioi.warehouse_id = iwi.warehouse_id
|
||||||
|
left join basic_area ba on iwi.area_id = ba.area_id
|
||||||
left join sys_user su on ioi.fetch_user_id = su.user_id
|
left join sys_user su on ioi.fetch_user_id = su.user_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
@ -70,6 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="warehouseId != null "> and ioi.warehouse_id = #{warehouseId}</if>
|
<if test="warehouseId != null "> and ioi.warehouse_id = #{warehouseId}</if>
|
||||||
<if test="outDate != null "> and ioi.out_date = #{outDate}</if>
|
<if test="outDate != null "> and ioi.out_date = #{outDate}</if>
|
||||||
<if test="fetchUserId != null "> and ioi.fetch_user_id = #{fetchUserId}</if>
|
<if test="fetchUserId != null "> and ioi.fetch_user_id = #{fetchUserId}</if>
|
||||||
|
<if test="fetchUser != null and fetchUser != ''"> and ioi.fetch_user = #{fetchUser}</if>
|
||||||
<if test="totalNum != null "> and ioi.total_num = #{totalNum}</if>
|
<if test="totalNum != null "> and ioi.total_num = #{totalNum}</if>
|
||||||
<if test="outType != null "> and ioi.out_type = #{outType}</if>
|
<if test="outType != null "> and ioi.out_type = #{outType}</if>
|
||||||
<if test="status != null "> and ioi.status = #{status}</if>
|
<if test="status != null "> and ioi.status = #{status}</if>
|
||||||
|
|
@ -91,9 +95,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select out_id, out_code, ioi.warehouse_id, out_date, ioi.fetch_user_id, total_num, out_type,
|
select out_id, out_code, ioi.warehouse_id, out_date, ioi.fetch_user_id, total_num, out_type,
|
||||||
ioi.status, order_id, total_amount, plan_id, fetch_material_id, goods_allocation_id,
|
ioi.status, order_id, total_amount, plan_id, fetch_material_id, goods_allocation_id,
|
||||||
ioi.remark, ioi.del_flag, ioi.create_by, ioi.create_time, ioi.update_by, ioi.update_time,
|
ioi.remark, ioi.del_flag, ioi.create_by, ioi.create_time, ioi.update_by, ioi.update_time,
|
||||||
iwi.warehouse_name, su.user_name as fetch_user_name
|
iwi.warehouse_name, ioi.fetch_user, ba.area_id, ba.area_name
|
||||||
from ims_out_inventory ioi
|
from ims_out_inventory ioi
|
||||||
left join ims_warehouse_info iwi on ioi.warehouse_id = iwi.warehouse_id
|
left join ims_warehouse_info iwi on ioi.warehouse_id = iwi.warehouse_id
|
||||||
|
left join basic_area ba on iwi.area_id = ba.area_id
|
||||||
left join sys_user su on ioi.fetch_user_id = su.user_id
|
left join sys_user su on ioi.fetch_user_id = su.user_id
|
||||||
where ioi.out_id = #{outId} and ioi.del_flag = '0'
|
where ioi.out_id = #{outId} and ioi.del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -113,6 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="warehouseId != null">warehouse_id,</if>
|
<if test="warehouseId != null">warehouse_id,</if>
|
||||||
<if test="outDate != null">out_date,</if>
|
<if test="outDate != null">out_date,</if>
|
||||||
<if test="fetchUserId != null">fetch_user_id,</if>
|
<if test="fetchUserId != null">fetch_user_id,</if>
|
||||||
|
<if test="fetchUser != null and fetchUser != ''">fetch_user,</if>
|
||||||
<if test="totalNum != null">total_num,</if>
|
<if test="totalNum != null">total_num,</if>
|
||||||
<if test="outType != null">out_type,</if>
|
<if test="outType != null">out_type,</if>
|
||||||
<if test="status != null">status,</if>
|
<if test="status != null">status,</if>
|
||||||
|
|
@ -133,6 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="warehouseId != null">#{warehouseId},</if>
|
<if test="warehouseId != null">#{warehouseId},</if>
|
||||||
<if test="outDate != null">#{outDate},</if>
|
<if test="outDate != null">#{outDate},</if>
|
||||||
<if test="fetchUserId != null">#{fetchUserId},</if>
|
<if test="fetchUserId != null">#{fetchUserId},</if>
|
||||||
|
<if test="fetchUser != null and fetchUser != ''">#{fetchUser},</if>
|
||||||
<if test="totalNum != null">#{totalNum},</if>
|
<if test="totalNum != null">#{totalNum},</if>
|
||||||
<if test="outType != null">#{outType},</if>
|
<if test="outType != null">#{outType},</if>
|
||||||
<if test="status != null">#{status},</if>
|
<if test="status != null">#{status},</if>
|
||||||
|
|
@ -157,6 +164,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
|
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
|
||||||
<if test="outDate != null">out_date = #{outDate},</if>
|
<if test="outDate != null">out_date = #{outDate},</if>
|
||||||
<if test="fetchUserId != null">fetch_user_id = #{fetchUserId},</if>
|
<if test="fetchUserId != null">fetch_user_id = #{fetchUserId},</if>
|
||||||
|
<if test="fetchUser != null and fetchUser != ''">fetch_user = #{fetchUser},</if>
|
||||||
<if test="totalNum != null">total_num = #{totalNum},</if>
|
<if test="totalNum != null">total_num = #{totalNum},</if>
|
||||||
<if test="outType != null">out_type = #{outType},</if>
|
<if test="outType != null">out_type = #{outType},</if>
|
||||||
<if test="status != null">status = #{status},</if>
|
<if test="status != null">status = #{status},</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue