WMS:完成PDA接口盘库功能(包括获取盘点任务列表、获取仓库列表、申请盘库、盘库确认和盘库完成)。
master
xins 8 months ago
parent 3b7adc0bb6
commit 68b53fbbf6

@ -224,4 +224,14 @@ public class WmsConstants {
public static final String WMS_MOVE_EXECUTE_STATUS_OUTSTOCK_FINISH = "3";//出库完成 public static final String WMS_MOVE_EXECUTE_STATUS_OUTSTOCK_FINISH = "3";//出库完成
/*盘点记录状态*/
public static final String WMS_INVENTORY_CHECK_STATUS_INVENTORYING = "1";//盘点中
public static final String WMS_INVENTORY_CHECK_STATUS_FINISH = "2";//盘点完成
/*盘点记录明细状态*/
// public static final String WMS_INVENTORY_CHECK_DETAIL_STATUS_TO_INVENTORY = "0";//待盘点
public static final String WMS_INVENTORY_CHECK_DETAIL_STATUS_INVENTORYING = "1";//盘点中
public static final String WMS_INVENTORY_CHECK_DETAIL_STATUS_FINISH = "2";//盘点完成
} }

@ -223,6 +223,16 @@ public class Seq {
// 原材料入库记录标识 // 原材料入库记录标识
public static final String rawInstockSeqCode = "RI"; public static final String rawInstockSeqCode = "RI";
// 仓储盘点记录序列类型
public static final String wmsInventoryCheckSeqType = "inventorycheck";
// 仓储盘点记录接口序列数
private static AtomicInteger wmsInventoryCheckSeq = new AtomicInteger(1);
// 仓储盘点记录标识
public static final String wmsInventoryCheckSeqCode = "IC";
/** /**
* *
* *
@ -325,6 +335,8 @@ public class Seq {
atomicInt = wmsMergeSeq; atomicInt = wmsMergeSeq;
}else if(rawInstockSeqType.equals(type)) { }else if(rawInstockSeqType.equals(type)) {
atomicInt = rawInstockSeq; atomicInt = rawInstockSeq;
}else if(wmsInventoryCheckSeqType.equals(type)) {
atomicInt = wmsInventoryCheckSeq;
} }
return getId(atomicInt, 3, code); return getId(atomicInt, 3, code);
} }

@ -73,13 +73,13 @@ public class WmsInventoryCheckController extends BaseController
/** /**
* *
*/ */
@RequiresPermissions("wms:wmscheck:add") // @RequiresPermissions("wms:wmscheck:add")
@Log(title = "盘点记录", businessType = BusinessType.INSERT) // @Log(title = "盘点记录", businessType = BusinessType.INSERT)
@PostMapping // @PostMapping
public AjaxResult add(@RequestBody WmsInventoryCheck wmsInventoryCheck) // public AjaxResult add(@RequestBody WmsInventoryCheck wmsInventoryCheck)
{ // {
return toAjax(wmsInventoryCheckService.insertWmsInventoryCheck(wmsInventoryCheck)); // return toAjax(wmsInventoryCheckService.insertWmsInventoryCheck(wmsInventoryCheck));
} // }
/** /**
* *

@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Controller * Controller
@ -64,7 +65,7 @@ public class WmsMobileController extends BaseController {
private IWmsProductStockService wmsProductStockService; private IWmsProductStockService wmsProductStockService;
@Autowired @Autowired
private IWmsProductStockSaleorderService wmsProductStockSaleorderService; private IWmsInventoryCheckService wmsInventoryCheckService;
@Resource @Resource
private RemoteMesService remoteMesService; private RemoteMesService remoteMesService;
@ -418,27 +419,7 @@ public class WmsMobileController extends BaseController {
/**
*
*/
// @RequiresPermissions("wms:rawoutstock:query")
@GetMapping(value = "/getWarehouses")
public AjaxResult getWarehouses() {
WmsBaseWarehouse queryWarehouse = new WmsBaseWarehouse();
queryWarehouse.setWarehouseType(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL);
List<WmsBaseWarehouse> warehouses = wmsBaseWarehouseService.selectWmsBaseWarehouseList(queryWarehouse);
return success(warehouses);
}
/**
*
*/
// @RequiresPermissions("wms:rawoutstock:query")
@GetMapping(value = "/getLocations")
public AjaxResult getLocations(WmsBaseLocation baseLocation) {
List<WmsBaseLocation> baseLocations = wmsBaseLocationService.selectWmsBaseLocationList(baseLocation);
return success(baseLocations);
}
/** /**
* *
@ -495,4 +476,82 @@ public class WmsMobileController extends BaseController {
} }
/**
*
*/
// @RequiresPermissions("wms:rawoutstock:query")
@GetMapping(value = "/getInventoryChecks")
public TableDataInfo getInventoryChecks(WmsInventoryCheck queryInventoryCheck) {
startPage();
List<WmsInventoryCheck> inventoryChecks = wmsInventoryCheckService.selectWmsInventoryCheckJoinList(queryInventoryCheck);
return getDataTable(inventoryChecks);
}
/**
* 使
*/
// @RequiresPermissions("wms:rawoutstock:query")
@GetMapping(value = "/getWarehouses")
public AjaxResult getWarehouses() {
WmsBaseWarehouse queryWarehouse = new WmsBaseWarehouse();
queryWarehouse.setWarehouseType(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL);
List<WmsBaseWarehouse> warehouses = wmsBaseWarehouseService.selectWmsBaseWarehouseList(queryWarehouse);
return success(warehouses);
}
/**
* 使
*/
// @RequiresPermissions("wms:rawoutstock:query")
@GetMapping(value = "/getLocations")
public TableDataInfo getLocations(WmsBaseLocation baseLocation) {
startPage();
//todo 需要根据正在盘点的生成库位的盘点记录明细过滤
List<WmsBaseLocation> baseLocations = wmsBaseLocationService.selectWmsBaseLocationList(baseLocation);
return getDataTable(baseLocations);
}
/**
*
*/
@Log(title = "物料盘点", businessType = BusinessType.INSERT)
@PostMapping(("/inventoryCheck"))
public AjaxResult inventoryCheck(@Validated @RequestBody WmsInventoryCheckVo wmsInventoryCheckVo) {
return success(wmsInventoryCheckService.insertWmsInventoryCheck(wmsInventoryCheckVo));
}
/**
*
*/
// @RequiresPermissions("wms:rawoutstock:query")
@GetMapping(value = "/getInventoryCheckDetails")
public AjaxResult getInventoryCheckDetails(WmsInventoryCheckDetail wmsInventoryCheckDetail) {
List<WmsInventoryCheckDetail> checkDetails = wmsInventoryCheckService.getIncompletedInventoryCheckDetails(wmsInventoryCheckDetail);
return success(checkDetails);
}
//TODO 盘点中的不能进行移库合库?
/**
*
*/
@Log(title = "物料盘点", businessType = BusinessType.CONFIRM)
@PostMapping(("/confirmInventoryCheckDetail"))
public AjaxResult confirmInventoryCheckDetail(@RequestBody WmsInventoryCheckDetailVo wmsInventoryCheckDetailVo) {
return success(wmsInventoryCheckService.confirmInventoryCheckDetail(wmsInventoryCheckDetailVo));
}
/**
*
*/
@Log(title = "物料盘点", businessType = BusinessType.INSERT)
@PostMapping(("/completeInventoryCheck"))
public AjaxResult completeInventoryCheck(@RequestBody WmsInventoryCheck wmsInventoryCheck) {
return success(wmsInventoryCheckService.completeInventoryCheck(wmsInventoryCheck));
}
} }

@ -11,8 +11,8 @@ import com.hw.common.core.web.domain.BaseEntity;
/** /**
* wms_inventory_check * wms_inventory_check
* *
* @author xs * @author xins
* @date 2023-12-20 * @date 2024-03-29
*/ */
public class WmsInventoryCheck extends BaseEntity public class WmsInventoryCheck extends BaseEntity
{ {
@ -29,10 +29,32 @@ public class WmsInventoryCheck extends BaseEntity
@Excel(name = "仓库ID") @Excel(name = "仓库ID")
private Long warehouseId; private Long warehouseId;
/** 盘点状态(0待盘点,1盘点中,2盘点完成,3全部盘点完成);在仓库下所有库位都盘点完成时是全部盘点完成,而某一次盘点的库位范围盘点完成则是盘点完成 */ /** 盘点状态(0待盘点(暂无此状态),1盘点中,2盘点完成);在仓库下所有库位都盘点完成时是盘点完成,否则为盘点中 */
@Excel(name = "盘点状态(0待盘点,1盘点中,2盘点完成,3全部盘点完成);在仓库下所有库位都盘点完成时是全部盘点完成,而某一次盘点的库位范围盘点完成则是盘点完成") @Excel(name = "盘点状态(0待盘点", readConverterExp = "暂=无此状态")
private String checkStatus; private String checkStatus;
/** 盘点开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "盘点开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date beginTime;
/** 盘点结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "盘点结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/** 库位总数量 */
@Excel(name = "库位总数量")
private Long locationAmount;
/** 正在盘点库位数量 */
@Excel(name = "正在盘点库位数量")
private Long inventoryingAmount;
/** 已盘点库位数量 */
@Excel(name = "已盘点库位数量")
private Long inventoriedAmount;
/** 创建时间 */ /** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
@ -43,7 +65,7 @@ public class WmsInventoryCheck extends BaseEntity
@Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updateDate; private Date updateDate;
/** 盘点记录明细信息 */ /** 盘点记录明细;盘点记录对应的明细信息信息 */
private List<WmsInventoryCheckDetail> wmsInventoryCheckDetailList; private List<WmsInventoryCheckDetail> wmsInventoryCheckDetailList;
public void setInventoryCheckId(Long inventoryCheckId) public void setInventoryCheckId(Long inventoryCheckId)
@ -82,6 +104,49 @@ public class WmsInventoryCheck extends BaseEntity
{ {
return checkStatus; return checkStatus;
} }
public void setBeginTime(Date beginTime)
{
this.beginTime = beginTime;
}
public Date getBeginTime()
{
return beginTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public Long getLocationAmount() {
return locationAmount;
}
public void setLocationAmount(Long locationAmount) {
this.locationAmount = locationAmount;
}
public Long getInventoryingAmount() {
return inventoryingAmount;
}
public void setInventoryingAmount(Long inventoryingAmount) {
this.inventoryingAmount = inventoryingAmount;
}
public Long getInventoriedAmount() {
return inventoriedAmount;
}
public void setInventoriedAmount(Long inventoriedAmount) {
this.inventoriedAmount = inventoriedAmount;
}
public void setCreateDate(Date createDate) public void setCreateDate(Date createDate)
{ {
this.createDate = createDate; this.createDate = createDate;
@ -118,6 +183,8 @@ public class WmsInventoryCheck extends BaseEntity
.append("inventoryCheckCode", getInventoryCheckCode()) .append("inventoryCheckCode", getInventoryCheckCode())
.append("warehouseId", getWarehouseId()) .append("warehouseId", getWarehouseId())
.append("checkStatus", getCheckStatus()) .append("checkStatus", getCheckStatus())
.append("beginTime", getBeginTime())
.append("endTime", getEndTime())
.append("remark", getRemark()) .append("remark", getRemark())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createDate", getCreateDate()) .append("createDate", getCreateDate())

@ -9,10 +9,10 @@ import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity; import com.hw.common.core.web.domain.BaseEntity;
/** /**
* wms_inventory_check_detail * ; wms_inventory_check_detail
* *
* @author xs * @author xins
* @date 2023-12-20 * @date 2024-03-29
*/ */
public class WmsInventoryCheckDetail extends BaseEntity public class WmsInventoryCheckDetail extends BaseEntity
{ {
@ -33,6 +33,18 @@ public class WmsInventoryCheckDetail extends BaseEntity
@Excel(name = "库位编码") @Excel(name = "库位编码")
private String locationCode; private String locationCode;
/** 物料批次号 */
@Excel(name = "物料批次号")
private String materialBatch;
/** 库存类型(1原材料2半成品3成品) */
@Excel(name = "库存类型(1原材料2半成品3成品)")
private String stockType;
/** 库存ID根据库存类型1是wmsRawStockId,2和3是wmsProductStockId */
@Excel(name = "库存ID", readConverterExp = "根=据库存类型1是wmsRawStockId,2和3是wmsProductStockId")
private Long stockId;
/** 库存数量 */ /** 库存数量 */
@Excel(name = "库存数量") @Excel(name = "库存数量")
private BigDecimal stockAmount; private BigDecimal stockAmount;
@ -41,14 +53,22 @@ public class WmsInventoryCheckDetail extends BaseEntity
@Excel(name = "实际数量") @Excel(name = "实际数量")
private BigDecimal realAmount; private BigDecimal realAmount;
/** 盘点状态(0待盘点,1盘点中,2盘点完成);在生成盘点任务记录明细时,选择需要盘点的状态是盘点中,没有选择的则是待盘点,而下次盘点同一个仓库需要判断是否有未最终完成的盘点记录 */ /** 盘点状态(0待盘点,1盘点中,2盘点完成);在生成盘点任务记录明细时,选择需要盘点的状态是待盘点,没有选择的则不生成记录,在确认盘点后改为盘点中,在此次任务盘点完成后置为盘点完成,如果全部库位库存盘点完成,则需要修改盘点记录的状态为盘点完成 */
@Excel(name = "盘点状态(0待盘点,1盘点中,2盘点完成);在生成盘点任务记录明细时,选择需要盘点的状态是盘点中,没有选择的则是待盘点,而下次盘点同一个仓库需要判断是否有未最终完成的盘点记录") @Excel(name = "盘点状态(0待盘点,1盘点中,2盘点完成);在生成盘点任务记录明细时,选择需要盘点的状态是待盘点,没有选择的则不生成记录,在确认盘点后改为盘点中,在此次任务盘点完成后置为盘点完成,如果全部库位库存盘点完成,则需要修改盘点记录的状态为盘点完成")
private String checkStatus; private String checkStatus;
/** 盘点次数;重复盘点的话记录盘点的次数 */
@Excel(name = "盘点次数;重复盘点的话记录盘点的次数")
private Long inventoryTime;
/** 同步ERP状态盘点实际数量与库存数量不同时需要同步(0:失败,1成功) */ /** 同步ERP状态盘点实际数量与库存数量不同时需要同步(0:失败,1成功) */
@Excel(name = "同步ERP状态盘点实际数量与库存数量不同时需要同步(0:失败,1成功)") @Excel(name = "同步ERP状态盘点实际数量与库存数量不同时需要同步(0:失败,1成功)")
private String erpStatus; private String erpStatus;
/** 同步给ERP的数量 */
@Excel(name = "同步给ERP的数量")
private BigDecimal erpAmount;
/** 创建时间 */ /** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
@ -59,6 +79,13 @@ public class WmsInventoryCheckDetail extends BaseEntity
@Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updateDate; private Date updateDate;
private String materialCode;
private String materialName;
/** 盘点状态(0待盘点,1盘点中,2盘点完成); 多个以,隔开 */
private String checkStatusStr;
public void setInventoryCheckDetailId(Long inventoryCheckDetailId) public void setInventoryCheckDetailId(Long inventoryCheckDetailId)
{ {
this.inventoryCheckDetailId = inventoryCheckDetailId; this.inventoryCheckDetailId = inventoryCheckDetailId;
@ -95,6 +122,34 @@ public class WmsInventoryCheckDetail extends BaseEntity
{ {
return locationCode; return locationCode;
} }
public void setMaterialBatch(String materialBatch)
{
this.materialBatch = materialBatch;
}
public String getMaterialBatch()
{
return materialBatch;
}
public void setStockType(String stockType)
{
this.stockType = stockType;
}
public String getStockType()
{
return stockType;
}
public void setStockId(Long stockId)
{
this.stockId = stockId;
}
public Long getStockId()
{
return stockId;
}
public void setStockAmount(BigDecimal stockAmount) public void setStockAmount(BigDecimal stockAmount)
{ {
this.stockAmount = stockAmount; this.stockAmount = stockAmount;
@ -122,6 +177,15 @@ public class WmsInventoryCheckDetail extends BaseEntity
{ {
return checkStatus; return checkStatus;
} }
public void setInventoryTime(Long inventoryTime)
{
this.inventoryTime = inventoryTime;
}
public Long getInventoryTime()
{
return inventoryTime;
}
public void setErpStatus(String erpStatus) public void setErpStatus(String erpStatus)
{ {
this.erpStatus = erpStatus; this.erpStatus = erpStatus;
@ -131,6 +195,15 @@ public class WmsInventoryCheckDetail extends BaseEntity
{ {
return erpStatus; return erpStatus;
} }
public void setErpAmount(BigDecimal erpAmount)
{
this.erpAmount = erpAmount;
}
public BigDecimal getErpAmount()
{
return erpAmount;
}
public void setCreateDate(Date createDate) public void setCreateDate(Date createDate)
{ {
this.createDate = createDate; this.createDate = createDate;
@ -150,6 +223,30 @@ public class WmsInventoryCheckDetail extends BaseEntity
return updateDate; return updateDate;
} }
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getCheckStatusStr() {
return checkStatusStr;
}
public void setCheckStatusStr(String checkStatusStr) {
this.checkStatusStr = checkStatusStr;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -157,10 +254,15 @@ public class WmsInventoryCheckDetail extends BaseEntity
.append("inventoryCheckId", getInventoryCheckId()) .append("inventoryCheckId", getInventoryCheckId())
.append("materialId", getMaterialId()) .append("materialId", getMaterialId())
.append("locationCode", getLocationCode()) .append("locationCode", getLocationCode())
.append("materialBatch", getMaterialBatch())
.append("stockType", getStockType())
.append("stockId", getStockId())
.append("stockAmount", getStockAmount()) .append("stockAmount", getStockAmount())
.append("realAmount", getRealAmount()) .append("realAmount", getRealAmount())
.append("checkStatus", getCheckStatus()) .append("checkStatus", getCheckStatus())
.append("inventoryTime", getInventoryTime())
.append("erpStatus", getErpStatus()) .append("erpStatus", getErpStatus())
.append("erpAmount", getErpAmount())
.append("remark", getRemark()) .append("remark", getRemark())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createDate", getCreateDate()) .append("createDate", getCreateDate())

@ -0,0 +1,27 @@
package com.hw.wms.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
/**
* @Description: VO
* @ClassName: WmsInventoryCheckDetailVo
* @Author : xins
* @Date :2024-04-01 9:51
* @Version :1.0
*/
@Data
public class WmsInventoryCheckDetailVo {
//盘点记录明细ID
@NotNull(message="inventoryCheckDetailId")
private Long inventoryCheckDetailId;
//实际盘点数量
@NotNull(message = "实际盘点数量必须输入")
private BigDecimal realAmount;
}

@ -0,0 +1,28 @@
package com.hw.wms.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @Description: VO
* @ClassName: WmsInventoryCheckVo
* @Author : xins
* @Date :2024-03-29 11:27
* @Version :1.0
*/
@Data
public class WmsInventoryCheckVo {
//仓库ID
@NotNull(message="warehouseId必须输入")
private Long warehouseId;
@NotEmpty(message="库位编码必须输入")
private List<String> locationCodes;
private Long inventoryCheckId;
}

@ -16,9 +16,9 @@ import java.math.BigDecimal;
@Data @Data
public class WmsMoveApplyVo { public class WmsMoveApplyVo {
//仓库ID // //仓库ID
@NotNull(message="warehouseId必须输入") // @NotNull(message="warehouseId必须输入")
private Long warehouseId; // private Long warehouseId;
@NotBlank(message="原库位编码必须输入") @NotBlank(message="原库位编码必须输入")
private String oriLocationCode; private String oriLocationCode;

@ -85,5 +85,11 @@ public interface WmsBaseLocationMapper
public List<WmsBaseLocation> selectWmsBaseLocationJoinList(WmsBaseLocation wmsBaseLocation); public List<WmsBaseLocation> selectWmsBaseLocationJoinList(WmsBaseLocation wmsBaseLocation);
/**
*
* @param wmsBaseLocation
* @return
*/
public int selectCountOfWmsBaseLocation(WmsBaseLocation wmsBaseLocation);
} }

@ -0,0 +1,79 @@
package com.hw.wms.mapper;
import java.util.List;
import com.hw.wms.domain.WmsInventoryCheckDetail;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
*
* @author xins
* @date 2024-03-29
*/
public interface WmsInventoryCheckDetailMapper
{
/**
*
*
* @param inventoryCheckDetailId
* @return
*/
public WmsInventoryCheckDetail selectWmsInventoryCheckDetailByInventoryCheckDetailId(Long inventoryCheckDetailId);
/**
*
*
* @param wmsInventoryCheckDetail
* @return
*/
public List<WmsInventoryCheckDetail> selectWmsInventoryCheckDetailList(WmsInventoryCheckDetail wmsInventoryCheckDetail);
/**
*
*
* @param wmsInventoryCheckDetail
* @return
*/
public int insertWmsInventoryCheckDetail(WmsInventoryCheckDetail wmsInventoryCheckDetail);
/**
*
*
* @param wmsInventoryCheckDetail
* @return
*/
public int updateWmsInventoryCheckDetail(WmsInventoryCheckDetail wmsInventoryCheckDetail);
/**
*
*
* @param inventoryCheckDetailId
* @return
*/
public int deleteWmsInventoryCheckDetailByInventoryCheckDetailId(Long inventoryCheckDetailId);
/**
*
*
* @param inventoryCheckDetailIds
* @return
*/
public int deleteWmsInventoryCheckDetailByInventoryCheckDetailIds(Long[] inventoryCheckDetailIds);
/**
* ID
* @param inventoryCheckId
* @param locationCode
* @return
*/
public int selectCountOfCheckDetailByCheckIdAndLocation(@Param("inventoryCheckId") Long inventoryCheckId,
@Param("locationCode") String locationCode);
/**
* ,Join material
*
* @param wmsInventoryCheckDetail
* @return
*/
public List<WmsInventoryCheckDetail> selectWmsInventoryCheckDetailJoinList(WmsInventoryCheckDetail wmsInventoryCheckDetail);
}

@ -13,7 +13,7 @@ import com.hw.wms.domain.WmsInventoryCheckDetail;
public interface WmsInventoryCheckMapper public interface WmsInventoryCheckMapper
{ {
/** /**
* * ,Join inventoryCheckDetail
* *
* @param inventoryCheckId * @param inventoryCheckId
* @return * @return
@ -84,4 +84,24 @@ public interface WmsInventoryCheckMapper
* @return * @return
*/ */
public int deleteWmsInventoryCheckDetailByInventoryCheckId(Long inventoryCheckId); public int deleteWmsInventoryCheckDetailByInventoryCheckId(Long inventoryCheckId);
/**
* ,Join warehouse
*
* @param wmsInventoryCheck
* @return
*/
public List<WmsInventoryCheck> selectWmsInventoryCheckJoinList(WmsInventoryCheck wmsInventoryCheck);
/**
*
*
* @param inventoryCheckId
* @return
*/
public WmsInventoryCheck selectOnlyInventoryCheckByInventoryCheckId(Long inventoryCheckId);
} }

@ -1,7 +1,13 @@
package com.hw.wms.service; package com.hw.wms.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.hw.wms.domain.WmsInventoryCheck; import com.hw.wms.domain.WmsInventoryCheck;
import com.hw.wms.domain.WmsInventoryCheckDetail;
import com.hw.wms.domain.vo.WmsInventoryCheckDetailVo;
import com.hw.wms.domain.vo.WmsInventoryCheckVo;
import org.springframework.transaction.annotation.Transactional;
/** /**
* Service * Service
@ -30,10 +36,10 @@ public interface IWmsInventoryCheckService
/** /**
* *
* *
* @param wmsInventoryCheck * @param wmsInventoryCheckVo VO
* @return * @return
*/ */
public int insertWmsInventoryCheck(WmsInventoryCheck wmsInventoryCheck); public Long insertWmsInventoryCheck(WmsInventoryCheckVo wmsInventoryCheckVo);
/** /**
* *
@ -58,4 +64,43 @@ public interface IWmsInventoryCheckService
* @return * @return
*/ */
public int deleteWmsInventoryCheckByInventoryCheckId(Long inventoryCheckId); public int deleteWmsInventoryCheckByInventoryCheckId(Long inventoryCheckId);
/**
* ,join warehouse
*
* @param wmsInventoryCheck
* @return
*/
public List<WmsInventoryCheck> selectWmsInventoryCheckJoinList(WmsInventoryCheck wmsInventoryCheck);
// /**
// * 根据判断状态获取数据按状态返回list数据
// * @param wmsInventoryCheckDetail
// * @return
// */
// public Map<String,List<WmsInventoryCheckDetail>> getIncompletedInventoryCheckDetails(WmsInventoryCheckDetail wmsInventoryCheckDetail);
/**
* list
*
* @param wmsInventoryCheckDetail
* @return
*/
public List<WmsInventoryCheckDetail> getIncompletedInventoryCheckDetails(WmsInventoryCheckDetail wmsInventoryCheckDetail);
/**
*
* @param wmsInventoryCheckDetailVo
* @return
*/
public int confirmInventoryCheckDetail(WmsInventoryCheckDetailVo wmsInventoryCheckDetailVo);
/**
*
* @param wmsInventoryCheck
* @return
*/
@Transactional(rollbackFor = Exception.class)
public int completeInventoryCheck(WmsInventoryCheck wmsInventoryCheck);
} }

@ -1,14 +1,27 @@
package com.hw.wms.service.impl; package com.hw.wms.service.impl;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.wms.domain.WmsInventoryCheckDetail;
import com.hw.wms.domain.*;
import com.hw.wms.domain.vo.WmsInventoryCheckDetailVo;
import com.hw.wms.domain.vo.WmsInventoryCheckVo;
import com.hw.wms.mapper.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Map;
import java.util.stream.Collectors;
import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.hw.wms.domain.WmsInventoryCheckDetail;
import com.hw.wms.mapper.WmsInventoryCheckMapper;
import com.hw.wms.domain.WmsInventoryCheck;
import com.hw.wms.service.IWmsInventoryCheckService; import com.hw.wms.service.IWmsInventoryCheckService;
/** /**
@ -18,11 +31,25 @@ import com.hw.wms.service.IWmsInventoryCheckService;
* @date 2023-12-20 * @date 2023-12-20
*/ */
@Service @Service
public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService {
{
@Autowired @Autowired
private WmsInventoryCheckMapper wmsInventoryCheckMapper; private WmsInventoryCheckMapper wmsInventoryCheckMapper;
@Autowired
private WmsInventoryCheckDetailMapper wmsInventoryCheckDetailMapper;
@Autowired
private WmsBaseWarehouseMapper wmsBaseWarehouseMapper;
@Autowired
private WmsBaseLocationMapper wmsBaseLocationMapper;
@Autowired
private WmsRawStockMapper wmsRawStockMapper;
@Autowired
private WmsProductStockMapper wmsProductStockMapper;
/** /**
* *
* *
@ -30,8 +57,7 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService
* @return * @return
*/ */
@Override @Override
public WmsInventoryCheck selectWmsInventoryCheckByInventoryCheckId(Long inventoryCheckId) public WmsInventoryCheck selectWmsInventoryCheckByInventoryCheckId(Long inventoryCheckId) {
{
return wmsInventoryCheckMapper.selectWmsInventoryCheckByInventoryCheckId(inventoryCheckId); return wmsInventoryCheckMapper.selectWmsInventoryCheckByInventoryCheckId(inventoryCheckId);
} }
@ -42,24 +68,148 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService
* @return * @return
*/ */
@Override @Override
public List<WmsInventoryCheck> selectWmsInventoryCheckList(WmsInventoryCheck wmsInventoryCheck) public List<WmsInventoryCheck> selectWmsInventoryCheckList(WmsInventoryCheck wmsInventoryCheck) {
{
return wmsInventoryCheckMapper.selectWmsInventoryCheckList(wmsInventoryCheck); return wmsInventoryCheckMapper.selectWmsInventoryCheckList(wmsInventoryCheck);
} }
/** /**
* *
* *
* @param wmsInventoryCheck * @param wmsInventoryCheckVo VO
* @return * @return
*/ */
@Transactional @Transactional
@Override @Override
public int insertWmsInventoryCheck(WmsInventoryCheck wmsInventoryCheck) public Long insertWmsInventoryCheck(WmsInventoryCheckVo wmsInventoryCheckVo) {
{ Long inventoryCheckId = wmsInventoryCheckVo.getInventoryCheckId();
int rows = wmsInventoryCheckMapper.insertWmsInventoryCheck(wmsInventoryCheck); Long toSetInventoryCheckId = inventoryCheckId;
insertWmsInventoryCheckDetail(wmsInventoryCheck); Long warehouseId = wmsInventoryCheckVo.getWarehouseId();
return rows; List<String> locationCodes = wmsInventoryCheckVo.getLocationCodes();
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
if (inventoryCheckId == null || inventoryCheckId.equals(0L)) {
WmsInventoryCheck queryInventoryCheck = new WmsInventoryCheck();
queryInventoryCheck.setWarehouseId(warehouseId);
queryInventoryCheck.setCheckStatus(WmsConstants.WMS_INVENTORY_CHECK_STATUS_INVENTORYING);
List<WmsInventoryCheck> wmsInventoryChecks = wmsInventoryCheckMapper.selectWmsInventoryCheckList(queryInventoryCheck);
if (wmsInventoryChecks != null && !wmsInventoryChecks.isEmpty()) {
throw new ServiceException("此仓库有未盘点完成的任务,请先盘点完成");
}
WmsBaseLocation queryLocation = new WmsBaseLocation();
queryLocation.setWarehouseId(warehouseId);
int locationAmount = wmsBaseLocationMapper.selectCountOfWmsBaseLocation(queryLocation);
WmsInventoryCheck wmsInventoryCheck = new WmsInventoryCheck();
wmsInventoryCheck.setInventoryCheckCode(Seq.getId(Seq.wmsInventoryCheckSeqType, Seq.wmsInventoryCheckSeqCode));
wmsInventoryCheck.setWarehouseId(warehouseId);
wmsInventoryCheck.setLocationAmount((long) locationAmount);
wmsInventoryCheck.setInventoryingAmount((long) locationCodes.size());
wmsInventoryCheck.setBeginTime(currentDate);
wmsInventoryCheck.setCheckStatus(WmsConstants.WMS_INVENTORY_CHECK_STATUS_INVENTORYING);
wmsInventoryCheck.setCreateDate(currentDate);
wmsInventoryCheck.setCreateBy(userName);
wmsInventoryCheckMapper.insertWmsInventoryCheck(wmsInventoryCheck);
toSetInventoryCheckId = wmsInventoryCheck.getInventoryCheckId();
} else {
WmsInventoryCheck toUpdatedInventoryCheck = wmsInventoryCheckMapper.selectWmsInventoryCheckByInventoryCheckId(inventoryCheckId);
toUpdatedInventoryCheck.setInventoryingAmount(toUpdatedInventoryCheck.getInventoriedAmount() + (long) locationCodes.size());
toUpdatedInventoryCheck.setUpdateDate(currentDate);
toUpdatedInventoryCheck.setUpdateBy(userName);
wmsInventoryCheckMapper.updateWmsInventoryCheck(toUpdatedInventoryCheck);
}
WmsBaseWarehouse baseWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(warehouseId);
String warehouseInstockType = baseWarehouse.getWarehouseInstockType();
List<WmsInventoryCheckDetail> wmsInventoryCheckDetails = new ArrayList<>();
for (String locationCode : locationCodes) {
WmsBaseLocation location = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
if (location == null) {
throw new ServiceException("没有库位[" + locationCode + "]");
}
if (!location.getLocationStatus().equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL)) {
throw new ServiceException("库位[" + locationCode + "]状态锁定中,不能进行盘点");
}
//校验是否已经生成盘点记录明细(暂时不需要校验,有唯一索引)
// if (inventoryCheckId != null && !inventoryCheckId.equals(0L)) {
// int existedCount = wmsInventoryCheckDetailMapper.selectCountOfCheckDetailByCheckIdAndLocation(inventoryCheckId, locationCode);
// if (existedCount > 0) {
// throw new ServiceException("已经生成库位[" + locationCode + "]的盘点记录,不能重复盘点");
// }
// }
if (warehouseInstockType.equals(WmsConstants.WMS_WAREHOUSE_INSTOCK_TYPE_RAW)) {
WmsRawStock queryRawStock = new WmsRawStock();
queryRawStock.setLocationCode(locationCode);
List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectWmsRawStockInList(queryRawStock);
if (wmsRawStocks != null && !wmsRawStocks.isEmpty()) {
for (WmsRawStock wmsRawStock : wmsRawStocks) {
WmsInventoryCheckDetail wmsInventoryCheckDetail = new WmsInventoryCheckDetail();
wmsInventoryCheckDetail.setMaterialId(wmsRawStock.getMaterialId());
wmsInventoryCheckDetail.setMaterialBatch(wmsRawStock.getInstockBatch());
wmsInventoryCheckDetail.setInventoryTime(0L);
wmsInventoryCheckDetail.setStockType(WmsConstants.RWA_STOCK_STOCK_TYPE_RAW);
wmsInventoryCheckDetail.setStockId(wmsRawStock.getRawStockId());
wmsInventoryCheckDetail.setLocationCode(locationCode);
wmsInventoryCheckDetail.setCheckStatus(WmsConstants.WMS_INVENTORY_CHECK_DETAIL_STATUS_INVENTORYING);
wmsInventoryCheckDetail.setCreateDate(currentDate);
wmsInventoryCheckDetail.setCreateBy(userName);
wmsInventoryCheckDetail.setInventoryCheckId(toSetInventoryCheckId);
wmsInventoryCheckDetails.add(wmsInventoryCheckDetail);
}
} else {//如果库位没有库存也要增加数据
WmsInventoryCheckDetail wmsInventoryCheckDetail = new WmsInventoryCheckDetail();
wmsInventoryCheckDetail.setInventoryTime(0L);
wmsInventoryCheckDetail.setLocationCode(locationCode);
wmsInventoryCheckDetail.setCheckStatus(WmsConstants.WMS_INVENTORY_CHECK_DETAIL_STATUS_INVENTORYING);
wmsInventoryCheckDetail.setCreateDate(currentDate);
wmsInventoryCheckDetail.setCreateBy(userName);
wmsInventoryCheckDetail.setInventoryCheckId(toSetInventoryCheckId);
wmsInventoryCheckDetails.add(wmsInventoryCheckDetail);
}
} else {
WmsProductStock queryProductStock = new WmsProductStock();
queryProductStock.setLocationCode(locationCode);
List<WmsProductStock> wmsProductStocks = wmsProductStockMapper.selectWmsProductStockInList(queryProductStock);
if (wmsProductStocks != null && !wmsProductStocks.isEmpty()) {
for (WmsProductStock wmsProductStock : wmsProductStocks) {
WmsInventoryCheckDetail wmsInventoryCheckDetail = new WmsInventoryCheckDetail();
wmsInventoryCheckDetail.setMaterialId(wmsProductStock.getProductId());
wmsInventoryCheckDetail.setMaterialBatch(wmsProductStock.getProductBatch());
wmsInventoryCheckDetail.setStockType(wmsProductStock.getStockType());
wmsInventoryCheckDetail.setStockId(wmsProductStock.getProductStockId());
wmsInventoryCheckDetail.setInventoryTime(0L);
wmsInventoryCheckDetail.setLocationCode(locationCode);
wmsInventoryCheckDetail.setCheckStatus(WmsConstants.WMS_INVENTORY_CHECK_DETAIL_STATUS_INVENTORYING);
wmsInventoryCheckDetail.setCreateDate(currentDate);
wmsInventoryCheckDetail.setCreateBy(userName);
wmsInventoryCheckDetail.setInventoryCheckId(toSetInventoryCheckId);
wmsInventoryCheckDetails.add(wmsInventoryCheckDetail);
}
} else {
WmsInventoryCheckDetail wmsInventoryCheckDetail = new WmsInventoryCheckDetail();
wmsInventoryCheckDetail.setInventoryTime(0L);
wmsInventoryCheckDetail.setLocationCode(locationCode);
wmsInventoryCheckDetail.setCheckStatus(WmsConstants.WMS_INVENTORY_CHECK_DETAIL_STATUS_INVENTORYING);
wmsInventoryCheckDetail.setCreateDate(currentDate);
wmsInventoryCheckDetail.setCreateBy(userName);
wmsInventoryCheckDetail.setInventoryCheckId(toSetInventoryCheckId);
wmsInventoryCheckDetails.add(wmsInventoryCheckDetail);
}
}
}
if (wmsInventoryCheckDetails.size() > 0) {
wmsInventoryCheckMapper.batchWmsInventoryCheckDetail(wmsInventoryCheckDetails);
}
return toSetInventoryCheckId;
} }
/** /**
@ -70,10 +220,8 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService
*/ */
@Transactional @Transactional
@Override @Override
public int updateWmsInventoryCheck(WmsInventoryCheck wmsInventoryCheck) public int updateWmsInventoryCheck(WmsInventoryCheck wmsInventoryCheck) {
{
wmsInventoryCheckMapper.deleteWmsInventoryCheckDetailByInventoryCheckId(wmsInventoryCheck.getInventoryCheckId()); wmsInventoryCheckMapper.deleteWmsInventoryCheckDetailByInventoryCheckId(wmsInventoryCheck.getInventoryCheckId());
insertWmsInventoryCheckDetail(wmsInventoryCheck);
return wmsInventoryCheckMapper.updateWmsInventoryCheck(wmsInventoryCheck); return wmsInventoryCheckMapper.updateWmsInventoryCheck(wmsInventoryCheck);
} }
@ -85,8 +233,7 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService
*/ */
@Transactional @Transactional
@Override @Override
public int deleteWmsInventoryCheckByInventoryCheckIds(Long[] inventoryCheckIds) public int deleteWmsInventoryCheckByInventoryCheckIds(Long[] inventoryCheckIds) {
{
wmsInventoryCheckMapper.deleteWmsInventoryCheckDetailByInventoryCheckIds(inventoryCheckIds); wmsInventoryCheckMapper.deleteWmsInventoryCheckDetailByInventoryCheckIds(inventoryCheckIds);
return wmsInventoryCheckMapper.deleteWmsInventoryCheckByInventoryCheckIds(inventoryCheckIds); return wmsInventoryCheckMapper.deleteWmsInventoryCheckByInventoryCheckIds(inventoryCheckIds);
} }
@ -99,8 +246,7 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService
*/ */
@Transactional @Transactional
@Override @Override
public int deleteWmsInventoryCheckByInventoryCheckId(Long inventoryCheckId) public int deleteWmsInventoryCheckByInventoryCheckId(Long inventoryCheckId) {
{
wmsInventoryCheckMapper.deleteWmsInventoryCheckDetailByInventoryCheckId(inventoryCheckId); wmsInventoryCheckMapper.deleteWmsInventoryCheckDetailByInventoryCheckId(inventoryCheckId);
return wmsInventoryCheckMapper.deleteWmsInventoryCheckByInventoryCheckId(inventoryCheckId); return wmsInventoryCheckMapper.deleteWmsInventoryCheckByInventoryCheckId(inventoryCheckId);
} }
@ -108,24 +254,150 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService
/** /**
* *
* *
* @param wmsInventoryCheck * @param wmsInventoryCheckDetailList
* @param inventoryCheckId ID
*/ */
public void insertWmsInventoryCheckDetail(WmsInventoryCheck wmsInventoryCheck) public void insertWmsInventoryCheckDetail(List<WmsInventoryCheckDetail> wmsInventoryCheckDetailList, Long inventoryCheckId) {
{ if (StringUtils.isNotNull(wmsInventoryCheckDetailList)) {
List<WmsInventoryCheckDetail> wmsInventoryCheckDetailList = wmsInventoryCheck.getWmsInventoryCheckDetailList();
Long inventoryCheckId = wmsInventoryCheck.getInventoryCheckId();
if (StringUtils.isNotNull(wmsInventoryCheckDetailList))
{
List<WmsInventoryCheckDetail> list = new ArrayList<WmsInventoryCheckDetail>(); List<WmsInventoryCheckDetail> list = new ArrayList<WmsInventoryCheckDetail>();
for (WmsInventoryCheckDetail wmsInventoryCheckDetail : wmsInventoryCheckDetailList) for (WmsInventoryCheckDetail wmsInventoryCheckDetail : wmsInventoryCheckDetailList) {
{
wmsInventoryCheckDetail.setInventoryCheckId(inventoryCheckId); wmsInventoryCheckDetail.setInventoryCheckId(inventoryCheckId);
list.add(wmsInventoryCheckDetail); list.add(wmsInventoryCheckDetail);
} }
if (list.size() > 0) if (list.size() > 0) {
{
wmsInventoryCheckMapper.batchWmsInventoryCheckDetail(list); wmsInventoryCheckMapper.batchWmsInventoryCheckDetail(list);
} }
} }
} }
/**
* ,join warehouse
*
* @param wmsInventoryCheck
* @return
*/
@Override
public List<WmsInventoryCheck> selectWmsInventoryCheckJoinList(WmsInventoryCheck wmsInventoryCheck) {
return wmsInventoryCheckMapper.selectWmsInventoryCheckJoinList(wmsInventoryCheck);
}
// /**
// * 根据判断状态获取数据按状态返回list数据
// *
// * @param wmsInventoryCheckDetail
// * @return
// */
// @Override
// public Map<String, List<WmsInventoryCheckDetail>> getIncompletedInventoryCheckDetailsMap(WmsInventoryCheckDetail wmsInventoryCheckDetail) {
// wmsInventoryCheckDetail.setCheckStatusStr(WmsConstants.WMS_INVENTORY_CHECK_DETAIL_STATUS_TO_INVENTORY + "," + WmsConstants.WMS_INVENTORY_CHECK_STATUS_INVENTORYING);
// List<WmsInventoryCheckDetail> wmsInventoryCheckDetailList = wmsInventoryCheckDetailMapper.selectWmsInventoryCheckDetailJoinList(wmsInventoryCheckDetail);
//
// Map<String, List<WmsInventoryCheckDetail>> checkDetailMap =
// wmsInventoryCheckDetailList.stream().filter(checkDetail -> StringUtils.isNotEmpty(checkDetail.getCheckStatus())).collect(Collectors.groupingBy(WmsInventoryCheckDetail::getCheckStatus));
//
// return checkDetailMap;
// }
/**
* list
*
* @param wmsInventoryCheckDetail
* @return
*/
@Override
public List<WmsInventoryCheckDetail> getIncompletedInventoryCheckDetails(WmsInventoryCheckDetail wmsInventoryCheckDetail) {
List<WmsInventoryCheckDetail> wmsInventoryCheckDetailList = wmsInventoryCheckDetailMapper.selectWmsInventoryCheckDetailJoinList(wmsInventoryCheckDetail);
return wmsInventoryCheckDetailList;
}
/**
*
*
* @param wmsInventoryCheckDetailVo
* @return
*/
@Override
public int confirmInventoryCheckDetail(WmsInventoryCheckDetailVo wmsInventoryCheckDetailVo) {
WmsInventoryCheckDetail existedInventoryCheckDetail = wmsInventoryCheckDetailMapper.
selectWmsInventoryCheckDetailByInventoryCheckDetailId(wmsInventoryCheckDetailVo.getInventoryCheckDetailId());
if (existedInventoryCheckDetail.getCheckStatus().equals(WmsConstants.WMS_INVENTORY_CHECK_DETAIL_STATUS_FINISH)) {
throw new ServiceException("已经盘点完成,不能再确认");
}
String stockType = existedInventoryCheckDetail.getStockType();
Long stockId = existedInventoryCheckDetail.getStockId();
BigDecimal realAmount = wmsInventoryCheckDetailVo.getRealAmount();
Long inventoryTime = existedInventoryCheckDetail.getInventoryTime() == null ? 0L : existedInventoryCheckDetail.getInventoryTime();
existedInventoryCheckDetail.setInventoryTime(inventoryTime + 1);
existedInventoryCheckDetail.setCheckStatus(WmsConstants.WMS_INVENTORY_CHECK_DETAIL_STATUS_INVENTORYING);
if (stockId != null) {
if (stockType.equals(WmsConstants.WMS_WAREHOUSE_INSTOCK_TYPE_RAW)) {
WmsRawStock rawStock = wmsRawStockMapper.selectWmsRawStockByRawStockId(stockId);
BigDecimal stockAmount = rawStock == null ? BigDecimal.ZERO : rawStock.getTotalAmount();
existedInventoryCheckDetail.setStockAmount(stockAmount);
} else {
WmsProductStock productStock = wmsProductStockMapper.selectWmsProductStockByProductStockId(stockId);
BigDecimal stockAmount = productStock == null ? BigDecimal.ZERO : productStock.getTotalAmount();
existedInventoryCheckDetail.setStockAmount(stockAmount);
}
} else {
if (realAmount.compareTo(BigDecimal.ZERO) > 0) {
throw new ServiceException("此库位无库存信息实际盘库数量需等于0");
}
}
existedInventoryCheckDetail.setRealAmount(realAmount);
existedInventoryCheckDetail.setUpdateDate(new Date());
existedInventoryCheckDetail.setUpdateBy(SecurityUtils.getUsername());
return wmsInventoryCheckDetailMapper.updateWmsInventoryCheckDetail(existedInventoryCheckDetail);
}
/**
*
*
* @param wmsInventoryCheck
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int completeInventoryCheck(WmsInventoryCheck wmsInventoryCheck) {
List<WmsInventoryCheckDetail> wmsInventoryCheckDetailList = wmsInventoryCheck.getWmsInventoryCheckDetailList();
List<WmsInventoryCheckDetail> unconfirmedCheckDetails = wmsInventoryCheckDetailList.stream()
.filter(checkDetail -> checkDetail.getInventoryTime() < 1).collect(Collectors.toList());
if (unconfirmedCheckDetails != null && !unconfirmedCheckDetails.isEmpty()) {
throw new ServiceException("请先全部确认后再点击盘点完成");
}
Map<String, List<WmsInventoryCheckDetail>> inventoryCheckDetailMap = wmsInventoryCheckDetailList.stream()
.collect(Collectors.groupingBy(WmsInventoryCheckDetail::getLocationCode));
long completeLocationAmount = inventoryCheckDetailMap.entrySet().size();
// List<Long> inventoryCheckDetailIds = wmsInventoryCheckDetailList.stream().map(WmsInventoryCheckDetail::getInventoryCheckDetailId).collect(Collectors.toList());
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
wmsInventoryCheckDetailList.forEach(wmsInventoryCheckDetail -> {
wmsInventoryCheckDetail.setCheckStatus(WmsConstants.WMS_INVENTORY_CHECK_DETAIL_STATUS_FINISH);
wmsInventoryCheckDetail.setUpdateDate(currentDate);
wmsInventoryCheckDetail.setUpdateBy(userName);
wmsInventoryCheckDetailMapper.updateWmsInventoryCheckDetail(wmsInventoryCheckDetail);
});
WmsInventoryCheck existedInventoryCheck = wmsInventoryCheckMapper.selectOnlyInventoryCheckByInventoryCheckId(wmsInventoryCheck.getInventoryCheckId());
Long inventoriedAmount = existedInventoryCheck.getInventoriedAmount();
Long locationAmount = existedInventoryCheck.getLocationAmount();
Long currentInventoriedAmount = inventoriedAmount + completeLocationAmount;
wmsInventoryCheck.setInventoriedAmount(currentInventoriedAmount);
wmsInventoryCheck.setUpdateDate(currentDate);
wmsInventoryCheck.setUpdateBy(userName);
if (currentInventoriedAmount >= locationAmount) {
wmsInventoryCheck.setCheckStatus(WmsConstants.WMS_INVENTORY_CHECK_STATUS_FINISH);
wmsInventoryCheck.setEndTime(currentDate);
}
return wmsInventoryCheckMapper.updateWmsInventoryCheck(wmsInventoryCheck);
}
} }

@ -208,7 +208,11 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
} }
WmsBaseWarehouse baseWareHouse = wmsBaseWarehouseMapper. WmsBaseWarehouse baseWareHouse = wmsBaseWarehouseMapper.
selectWmsBaseWarehouseByWarehouseId(wmsMoveApplyVo.getWarehouseId()); selectWmsBaseWarehouseByWarehouseId(oriLocation.getWarehouseId());
if (!baseWareHouse.getWarehouseType().equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL)) {
throw new ServiceException("请选择人工仓库的库位进行移库");
}
String warehouseInstockType = baseWareHouse.getWarehouseInstockType(); String warehouseInstockType = baseWareHouse.getWarehouseInstockType();
List<WmsMove> toInsertedMoves = new ArrayList<>(); List<WmsMove> toInsertedMoves = new ArrayList<>();
Date currentDate = new Date(); Date currentDate = new Date();

@ -260,6 +260,39 @@
</select> </select>
<select id="selectCountOfWmsBaseLocation" parameterType="WmsBaseLocation">
select count(1) from wms_base_location
<where>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
<if test="locationCode != null and locationCode != ''"> and location_code = #{locationCode}</if>
<if test="locRow != null "> and loc_row = #{locRow}</if>
<if test="layerNum != null "> and layer_num = #{layerNum}</if>
<if test="locColumn != null "> and loc_column = #{locColumn}</if>
<if test="activeFlag != null and activeFlag != ''"> and active_flag = #{activeFlag}</if>
<if test="manualFlag != null and manualFlag != ''"> and manual_flag = #{manualFlag}</if>
<if test="qtyLimit != null "> and qty_limit = #{qtyLimit}</if>
<if test="instockFlag != null and instockFlag != ''"> and instock_flag = #{instockFlag}</if>
<if test="outstockFlag != null and outstockFlag != ''"> and outstock_flag = #{outstockFlag}</if>
<if test="locationStatus != null and locationStatus != ''"> and location_status = #{locationStatus}</if>
<if test="batchMix != null and batchMix != ''"> and batch_mix = #{batchMix}</if>
<if test="shelfOrder != null and shelfOrder != ''"> and shelf_order = #{shelfOrder}</if>
<if test="checkOrder != null and checkOrder != ''"> and check_order = #{checkOrder}</if>
<if test="pickOrder != null and pickOrder != ''"> and pick_order = #{pickOrder}</if>
<if test="pickFlag != null and pickFlag != ''"> and pick_flag = #{pickFlag}</if>
<if test="isOpenKnFlag != null and isOpenKnFlag != ''"> and is_open_kn_flag = #{isOpenKnFlag}</if>
<if test="locationScrapType != null and locationScrapType != ''"> and location_scrap_type = #{locationScrapType}</if>
<if test="volumeLimit != null "> and volume_limit = #{volumeLimit}</if>
<if test="weightLimit != null "> and weight_limit = #{weightLimit}</if>
<if test="length != null "> and length = #{length}</if>
<if test="width != null "> and width = #{width}</if>
<if test="height != null "> and height = #{height}</if>
</where>
order by location_code
</select>
</mapper> </mapper>

@ -0,0 +1,167 @@
<?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.hw.wms.mapper.WmsInventoryCheckDetailMapper">
<resultMap type="WmsInventoryCheckDetail" id="WmsInventoryCheckDetailResult">
<result property="inventoryCheckDetailId" column="inventory_check_detail_id" />
<result property="inventoryCheckId" column="inventory_check_id" />
<result property="materialId" column="material_id" />
<result property="locationCode" column="location_code" />
<result property="materialBatch" column="material_batch" />
<result property="stockType" column="stock_type" />
<result property="stockId" column="stock_id" />
<result property="stockAmount" column="stock_amount" />
<result property="realAmount" column="real_amount" />
<result property="checkStatus" column="check_status" />
<result property="inventoryTime" column="inventory_time" />
<result property="erpStatus" column="erp_status" />
<result property="erpAmount" column="erp_amount" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createDate" column="create_date" />
<result property="updateBy" column="update_by" />
<result property="updateDate" column="update_date" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
</resultMap>
<sql id="selectWmsInventoryCheckDetailVo">
select inventory_check_detail_id, inventory_check_id, material_id, location_code, material_batch, stock_type, stock_id, stock_amount, real_amount, check_status, inventory_time, erp_status, erp_amount, remark, create_by, create_date, update_by, update_date from wms_inventory_check_detail
</sql>
<select id="selectWmsInventoryCheckDetailList" parameterType="WmsInventoryCheckDetail" resultMap="WmsInventoryCheckDetailResult">
<include refid="selectWmsInventoryCheckDetailVo"/>
<where>
<if test="inventoryCheckId != null "> and inventory_check_id = #{inventoryCheckId}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="locationCode != null and locationCode != ''"> and location_code = #{locationCode}</if>
<if test="materialBatch != null and materialBatch != ''"> and material_batch = #{materialBatch}</if>
<if test="stockType != null and stockType != ''"> and stock_type = #{stockType}</if>
<if test="stockAmount != null "> and stock_amount = #{stockAmount}</if>
<if test="realAmount != null "> and real_amount = #{realAmount}</if>
<if test="checkStatus != null and checkStatus != ''"> and check_status = #{checkStatus}</if>
<if test="inventoryTime != null "> and inventory_time = #{inventoryTime}</if>
<if test="erpStatus != null and erpStatus != ''"> and erp_status = #{erpStatus}</if>
<if test="erpAmount != null "> and erp_amount = #{erpAmount}</if>
<if test="checkStatusStr != null and checkStatusStr!= ''"> and check_status in (${checkStatusStr})</if>
</where>
</select>
<select id="selectWmsInventoryCheckDetailByInventoryCheckDetailId" parameterType="Long" resultMap="WmsInventoryCheckDetailResult">
<include refid="selectWmsInventoryCheckDetailVo"/>
where inventory_check_detail_id = #{inventoryCheckDetailId}
</select>
<insert id="insertWmsInventoryCheckDetail" parameterType="WmsInventoryCheckDetail" useGeneratedKeys="true" keyProperty="inventoryCheckDetailId">
insert into wms_inventory_check_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="inventoryCheckId != null">inventory_check_id,</if>
<if test="materialId != null">material_id,</if>
<if test="locationCode != null and locationCode != ''">location_code,</if>
<if test="materialBatch != null and materialBatch != ''">material_batch,</if>
<if test="stockType != null">stock_type,</if>
<if test="stockId != null">stock_id,</if>
<if test="stockAmount != null">stock_amount,</if>
<if test="realAmount != null">real_amount,</if>
<if test="checkStatus != null and checkStatus != ''">check_status,</if>
<if test="inventoryTime != null">inventory_time,</if>
<if test="erpStatus != null">erp_status,</if>
<if test="erpAmount != null">erp_amount,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createDate != null">create_date,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateDate != null">update_date,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="inventoryCheckId != null">#{inventoryCheckId},</if>
<if test="materialId != null">#{materialId},</if>
<if test="locationCode != null and locationCode != ''">#{locationCode},</if>
<if test="materialBatch != null and materialBatch != ''">#{materialBatch},</if>
<if test="stockType != null">#{stockType},</if>
<if test="stockId != null">#{stockId},</if>
<if test="stockAmount != null">#{stockAmount},</if>
<if test="realAmount != null">#{realAmount},</if>
<if test="checkStatus != null and checkStatus != ''">#{checkStatus},</if>
<if test="inventoryTime != null">#{inventoryTime},</if>
<if test="erpStatus != null">#{erpStatus},</if>
<if test="erpAmount != null">#{erpAmount},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createDate != null">#{createDate},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateDate != null">#{updateDate},</if>
</trim>
</insert>
<update id="updateWmsInventoryCheckDetail" parameterType="WmsInventoryCheckDetail">
update wms_inventory_check_detail
<trim prefix="SET" suffixOverrides=",">
<if test="inventoryCheckId != null">inventory_check_id = #{inventoryCheckId},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="locationCode != null and locationCode != ''">location_code = #{locationCode},</if>
<if test="materialBatch != null and materialBatch != ''">material_batch = #{materialBatch},</if>
<if test="stockType != null">stock_type = #{stockType},</if>
<if test="stockId != null">stock_id = #{stockId},</if>
<if test="stockAmount != null">stock_amount = #{stockAmount},</if>
<if test="realAmount != null">real_amount = #{realAmount},</if>
<if test="checkStatus != null and checkStatus != ''">check_status = #{checkStatus},</if>
<if test="inventoryTime != null">inventory_time = #{inventoryTime},</if>
<if test="erpStatus != null">erp_status = #{erpStatus},</if>
<if test="erpAmount != null">erp_amount = #{erpAmount},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createDate != null">create_date = #{createDate},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateDate != null">update_date = #{updateDate},</if>
</trim>
where inventory_check_detail_id = #{inventoryCheckDetailId}
</update>
<delete id="deleteWmsInventoryCheckDetailByInventoryCheckDetailId" parameterType="Long">
delete from wms_inventory_check_detail where inventory_check_detail_id = #{inventoryCheckDetailId}
</delete>
<delete id="deleteWmsInventoryCheckDetailByInventoryCheckDetailIds" parameterType="String">
delete from wms_inventory_check_detail where inventory_check_detail_id in
<foreach item="inventoryCheckDetailId" collection="array" open="(" separator="," close=")">
#{inventoryCheckDetailId}
</foreach>
</delete>
<select id="selectCountOfCheckDetailByCheckIdAndLocation">
select count(1) from wms_inventory_check_detail
where inventory_check_id = #{inventoryCheckId} and location_code = #{locationCode}
</select>
<sql id="selectWmsInventoryCheckDetailJoinVo">
select wicd.inventory_check_detail_id, wicd.inventory_check_id, wicd.material_id, wicd.material_batch,
wicd.stock_type, wicd.stock_id, wicd.stock_amount, wicd.real_amount, wicd.check_status, wicd.inventory_time,
mbmi.material_code,mbmi.material_name
from wms_inventory_check_detail wicd left join mes_base_material_info mbmi on wicd.material_id = mbmi.material_id
</sql>
<select id="selectWmsInventoryCheckDetailJoinList" parameterType="WmsInventoryCheckDetail" resultMap="WmsInventoryCheckDetailResult">
<include refid="selectWmsInventoryCheckDetailJoinVo"/>
<where>
<if test="inventoryCheckId != null "> and wicd.inventory_check_id = #{inventoryCheckId}</if>
<if test="materialId != null "> and wicd.material_id = #{materialId}</if>
<if test="locationCode != null and locationCode != ''"> and wicd.location_code = #{locationCode}</if>
<if test="materialBatch != null and materialBatch != ''"> and wicd.material_batch = #{materialBatch}</if>
<if test="stockType != null and stockType != ''"> and wicd.stock_type = #{stockType}</if>
<if test="checkStatus != null and checkStatus != ''"> and wicd.check_status = #{checkStatus}</if>
<if test="checkStatusStr != null and checkStatusStr!= ''"> and wicd.check_status in (${checkStatusStr})</if>
</where>
</select>
</mapper>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.wms.mapper.WmsInventoryCheckMapper"> <mapper namespace="com.hw.wms.mapper.WmsInventoryCheckMapper">
<resultMap type="WmsInventoryCheck" id="WmsInventoryCheckResult"> <resultMap type="WmsInventoryCheck" id="WmsInventoryCheckResult">
@ -9,6 +9,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="inventoryCheckCode" column="inventory_check_code" /> <result property="inventoryCheckCode" column="inventory_check_code" />
<result property="warehouseId" column="warehouse_id" /> <result property="warehouseId" column="warehouse_id" />
<result property="checkStatus" column="check_status" /> <result property="checkStatus" column="check_status" />
<result property="beginTime" column="begin_time" />
<result property="endTime" column="end_time" />
<result property="locationAmount" column="location_amount" />
<result property="inventoryingAmount" column="inventorying_amount" />
<result property="inventoriedAmount" column="inventoried_amount" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createDate" column="create_date" /> <result property="createDate" column="create_date" />
@ -20,15 +25,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<collection property="wmsInventoryCheckDetailList" notNullColumn="sub_inventory_check_detail_id" javaType="java.util.List" resultMap="WmsInventoryCheckDetailResult" /> <collection property="wmsInventoryCheckDetailList" notNullColumn="sub_inventory_check_detail_id" javaType="java.util.List" resultMap="WmsInventoryCheckDetailResult" />
</resultMap> </resultMap>
<resultMap type="WmsInventoryCheckDetail" id="WmsInventoryCheckDetailResult"> <resultMap type="WmsInventoryCheckDetail" id="WmsInventoryCheckDetailResult">
<result property="inventoryCheckDetailId" column="sub_inventory_check_detail_id" /> <result property="inventoryCheckDetailId" column="sub_inventory_check_detail_id" />
<result property="inventoryCheckId" column="sub_inventory_check_id" /> <result property="inventoryCheckId" column="sub_inventory_check_id" />
<result property="materialId" column="sub_material_id" /> <result property="materialId" column="sub_material_id" />
<result property="locationCode" column="sub_location_code" /> <result property="locationCode" column="sub_location_code" />
<result property="materialBatch" column="sub_material_batch" />
<result property="stockType" column="sub_stock_type" />
<result property="stockId" column="sub_stock_id" />
<result property="stockAmount" column="sub_stock_amount" /> <result property="stockAmount" column="sub_stock_amount" />
<result property="realAmount" column="sub_real_amount" /> <result property="realAmount" column="sub_real_amount" />
<result property="checkStatus" column="sub_check_status" /> <result property="checkStatus" column="sub_check_status" />
<result property="inventoryTime" column="sub_inventory_time" />
<result property="erpStatus" column="sub_erp_status" /> <result property="erpStatus" column="sub_erp_status" />
<result property="erpAmount" column="sub_erp_amount" />
<result property="remark" column="sub_remark" /> <result property="remark" column="sub_remark" />
<result property="createBy" column="sub_create_by" /> <result property="createBy" column="sub_create_by" />
<result property="createDate" column="sub_create_date" /> <result property="createDate" column="sub_create_date" />
@ -37,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectWmsInventoryCheckVo"> <sql id="selectWmsInventoryCheckVo">
select inventory_check_id, inventory_check_code, warehouse_id, check_status, remark, create_by, create_date, update_by, update_date from wms_inventory_check select inventory_check_id, inventory_check_code, warehouse_id, check_status, begin_time, end_time, location_amount, inventorying_amount, inventoried_amount, remark, create_by, create_date, update_by, update_date from wms_inventory_check
</sql> </sql>
<select id="selectWmsInventoryCheckList" parameterType="WmsInventoryCheck" resultMap="WmsInventoryCheckResult"> <select id="selectWmsInventoryCheckList" parameterType="WmsInventoryCheck" resultMap="WmsInventoryCheckResult">
@ -46,14 +57,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="inventoryCheckCode != null and inventoryCheckCode != ''"> and inventory_check_code = #{inventoryCheckCode}</if> <if test="inventoryCheckCode != null and inventoryCheckCode != ''"> and inventory_check_code = #{inventoryCheckCode}</if>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if> <if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
<if test="checkStatus != null and checkStatus != ''"> and check_status = #{checkStatus}</if> <if test="checkStatus != null and checkStatus != ''"> and check_status = #{checkStatus}</if>
<if test="beginTime != null "> and begin_time = #{beginTime}</if>
<if test="endTime != null "> and end_time = #{endTime}</if>
<if test="createDate != null "> and create_date = #{createDate}</if> <if test="createDate != null "> and create_date = #{createDate}</if>
<if test="updateDate != null "> and update_date = #{updateDate}</if> <if test="updateDate != null "> and update_date = #{updateDate}</if>
</where> </where>
</select> </select>
<select id="selectWmsInventoryCheckByInventoryCheckId" parameterType="Long" resultMap="WmsInventoryCheckWmsInventoryCheckDetailResult"> <select id="selectWmsInventoryCheckByInventoryCheckId" parameterType="Long" resultMap="WmsInventoryCheckWmsInventoryCheckDetailResult">
select a.inventory_check_id, a.inventory_check_code, a.warehouse_id, a.check_status, a.remark, a.create_by, a.create_date, a.update_by, a.update_date, select a.inventory_check_id, a.inventory_check_code, a.warehouse_id, a.check_status, a.begin_time, a.end_time, a.location_amount, a.inventorying_amount, a.inventoried_amount, a.remark, a.create_by, a.create_date, a.update_by, a.update_date,
b.inventory_check_detail_id as sub_inventory_check_detail_id, b.inventory_check_id as sub_inventory_check_id, b.material_id as sub_material_id, b.location_code as sub_location_code, b.stock_amount as sub_stock_amount, b.real_amount as sub_real_amount, b.check_status as sub_check_status, b.erp_status as sub_erp_status, b.remark as sub_remark, b.create_by as sub_create_by, b.create_date as sub_create_date, b.update_by as sub_update_by, b.update_date as sub_update_date b.inventory_check_detail_id as sub_inventory_check_detail_id, b.inventory_check_id as sub_inventory_check_id, b.material_id as sub_material_id, b.location_code as sub_location_code, b.material_batch as sub_material_batch, b.stock_type as sub_stock_type, b.stock_id as sub_stock_id, b.stock_amount as sub_stock_amount, b.real_amount as sub_real_amount, b.check_status as sub_check_status, b.inventory_time as sub_inventory_time, b.erp_status as sub_erp_status, b.erp_amount as sub_erp_amount, b.remark as sub_remark, b.create_by as sub_create_by, b.create_date as sub_create_date, b.update_by as sub_update_by, b.update_date as sub_update_date
from wms_inventory_check a from wms_inventory_check a
left join wms_inventory_check_detail b on b.inventory_check_id = a.inventory_check_id left join wms_inventory_check_detail b on b.inventory_check_id = a.inventory_check_id
where a.inventory_check_id = #{inventoryCheckId} where a.inventory_check_id = #{inventoryCheckId}
@ -62,9 +75,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertWmsInventoryCheck" parameterType="WmsInventoryCheck" useGeneratedKeys="true" keyProperty="inventoryCheckId"> <insert id="insertWmsInventoryCheck" parameterType="WmsInventoryCheck" useGeneratedKeys="true" keyProperty="inventoryCheckId">
insert into wms_inventory_check insert into wms_inventory_check
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="inventoryCheckCode != null and inventoryCheckCode != ''">inventory_check_code,</if> <if test="inventoryCheckCode != null">inventory_check_code,</if>
<if test="warehouseId != null">warehouse_id,</if> <if test="warehouseId != null">warehouse_id,</if>
<if test="checkStatus != null and checkStatus != ''">check_status,</if> <if test="checkStatus != null and checkStatus != ''">check_status,</if>
<if test="beginTime != null">begin_time,</if>
<if test="endTime != null">end_time,</if>
<if test="locationAmount != null">location_amount,</if>
<if test="inventoryingAmount != null">inventorying_amount,</if>
<if test="inventoriedAmount != null">inventoried_amount,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createDate != null">create_date,</if> <if test="createDate != null">create_date,</if>
@ -72,9 +90,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateDate != null">update_date,</if> <if test="updateDate != null">update_date,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="inventoryCheckCode != null and inventoryCheckCode != ''">#{inventoryCheckCode},</if> <if test="inventoryCheckCode != null">#{inventoryCheckCode},</if>
<if test="warehouseId != null">#{warehouseId},</if> <if test="warehouseId != null">#{warehouseId},</if>
<if test="checkStatus != null and checkStatus != ''">#{checkStatus},</if> <if test="checkStatus != null and checkStatus != ''">#{checkStatus},</if>
<if test="beginTime != null">#{beginTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="locationAmount != null">#{locationAmount},</if>
<if test="inventoryingAmount != null">#{inventoryingAmount},</if>
<if test="inventoriedAmount != null">#{inventoriedAmount},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createDate != null">#{createDate},</if> <if test="createDate != null">#{createDate},</if>
@ -86,9 +109,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateWmsInventoryCheck" parameterType="WmsInventoryCheck"> <update id="updateWmsInventoryCheck" parameterType="WmsInventoryCheck">
update wms_inventory_check update wms_inventory_check
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="inventoryCheckCode != null and inventoryCheckCode != ''">inventory_check_code = #{inventoryCheckCode},</if> <if test="inventoryCheckCode != null">inventory_check_code = #{inventoryCheckCode},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if> <if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="checkStatus != null and checkStatus != ''">check_status = #{checkStatus},</if> <if test="checkStatus != null and checkStatus != ''">check_status = #{checkStatus},</if>
<if test="beginTime != null">begin_time = #{beginTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="locationAmount != null">location_amount = #{locationAmount},</if>
<if test="inventoryingAmount != null">inventorying_amount = #{inventoryingAmount},</if>
<if test="inventoriedAmount != null">inventoried_amount = #{inventoriedAmount},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="createDate != null">create_date = #{createDate},</if> <if test="createDate != null">create_date = #{createDate},</if>
@ -121,9 +149,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<insert id="batchWmsInventoryCheckDetail"> <insert id="batchWmsInventoryCheckDetail">
insert into wms_inventory_check_detail( inventory_check_detail_id, inventory_check_id, material_id, location_code, stock_amount, real_amount, check_status, erp_status, remark, create_by, create_date, update_by, update_date) values insert into wms_inventory_check_detail( inventory_check_detail_id, inventory_check_id, material_id, location_code, material_batch, stock_type, stock_id, stock_amount, real_amount, check_status, inventory_time, erp_status, erp_amount, remark, create_by, create_date, update_by, update_date) values
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
( #{item.inventoryCheckDetailId}, #{item.inventoryCheckId}, #{item.materialId}, #{item.locationCode}, #{item.stockAmount}, #{item.realAmount}, #{item.checkStatus}, #{item.erpStatus}, #{item.remark}, #{item.createBy}, #{item.createDate}, #{item.updateBy}, #{item.updateDate}) ( #{item.inventoryCheckDetailId}, #{item.inventoryCheckId}, #{item.materialId}, #{item.locationCode}, #{item.materialBatch}, #{item.stockType}, #{item.stockId}, #{item.stockAmount}, #{item.realAmount}, #{item.checkStatus}, #{item.inventoryTime}, #{item.erpStatus}, #{item.erpAmount}, #{item.remark}, #{item.createBy}, #{item.createDate}, #{item.updateBy}, #{item.updateDate})
</foreach> </foreach>
</insert> </insert>
<select id="selectWmsInventoryCheckJoinList" parameterType="WmsInventoryCheck" resultMap="WmsInventoryCheckResult">
select wic.inventory_check_id, wic.inventory_check_code, wic.warehouse_id, wic.check_status, wic.begin_time, wic.end_time,
wbw.warehouse_name
from wms_inventory_check wic left join wms_base_warehouse wbw on wic.warehouse_id = wbw.warehouse_id
<where>
<if test="inventoryCheckCode != null and inventoryCheckCode != ''"> and wic.inventory_check_code = #{inventoryCheckCode}</if>
<if test="warehouseId != null "> and wic.warehouse_id = #{warehouseId}</if>
<if test="checkStatus != null and checkStatus != ''"> and wic.check_status = #{checkStatus}</if>
<if test="beginTime != null "> and wic.begin_time = #{beginTime}</if>
<if test="endTime != null "> and wic.end_time = #{endTime}</if>
<if test="createDate != null "> and wic.create_date = #{createDate}</if>
<if test="updateDate != null "> and wic.update_date = #{updateDate}</if>
</where>
</select>
<select id="selectOnlyInventoryCheckByInventoryCheckId" parameterType="Long" resultMap="WmsInventoryCheckResult">
<include refid="selectWmsInventoryCheckVo"/>
where inventory_check_id = #{inventoryCheckId}
</select>
</mapper> </mapper>
Loading…
Cancel
Save