库存核心部分代码
This commit is contained in:
parent
ec9c9855ca
commit
bc42b91358
@ -113,4 +113,18 @@ public class UserConstants
|
||||
public static final String REPORT_WORD_TYPE ="word";
|
||||
|
||||
|
||||
/**
|
||||
* 库存事务类型
|
||||
*/
|
||||
public static final String TRANSACTION_TYPE_ITEM_RECPT = "ITEM_RECPT"; //原材料接收入库
|
||||
public static final String TRANSACTION_TYPE_ITEM_RV = "ITEM_RV"; //原材料退回供应商
|
||||
public static final String TRANSACTION_TYPE_ITEM_ISSUE = "ITEM_ISSUE"; //原材料领用出库
|
||||
public static final String TRANSACTION_TYPE_ITEM_RS = "ITEM_RS"; //原材料退库
|
||||
public static final String TRANSACTION_TYPE_WAREHOUSE_TRANS_OUT = "TRANS_OUT"; //移库,移出
|
||||
public static final String TRANSACTION_TYPE_WAREHOUSE_TRANS_IN = "TRANS_IN"; //移库,移入
|
||||
public static final String TRANSACTION_TYPE_PRODUCT_ISSUE = "PRODUCT_ISSUE"; //产品出库
|
||||
public static final String TRANSACTION_TYPE_PRODUCT_RS = "PRODUCT_RS"; //产品退货
|
||||
public static final String TRANSACTION_TYPE_MISC_RECPT = "MISC_RECPT"; //杂项入库
|
||||
public static final String TRANSACTION_TYPE_MISC_ISSUE = "MISC_ISSUE"; //杂项出库
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.ktg.common.exception;
|
||||
|
||||
public class BussinessException extends RuntimeException {
|
||||
private static final long serialVersionUID = -1L;
|
||||
|
||||
public BussinessException(){
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
public BussinessException(String msg){
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public BussinessException(String msg,Throwable cause){
|
||||
super(msg,cause);
|
||||
}
|
||||
|
||||
public BussinessException(Throwable cause){
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
@ -151,17 +151,20 @@ public class WmItemRecptController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:itemrecpt:edit')")
|
||||
@Log(title = "物料入库单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{recptIds}")
|
||||
public AjaxResult execute(@PathVariable Long[] recptIds){
|
||||
if(recptIds !=null && recptIds.length>0){
|
||||
for (Long id:recptIds
|
||||
) {
|
||||
WmItemRecpt wmItemRecpt =wmItemRecptService.selectWmItemRecptByRecptId(id);
|
||||
@PutMapping("/{recptId}")
|
||||
public AjaxResult execute(@PathVariable Long recptId){
|
||||
|
||||
//构造Transaction事务,并执行库存更新逻辑
|
||||
|
||||
|
||||
//调用ERP接口
|
||||
|
||||
//更新单据状态
|
||||
WmItemRecpt wmItemRecpt =wmItemRecptService.selectWmItemRecptByRecptId(recptId);
|
||||
wmItemRecpt.setStatus(UserConstants.ORDER_STATUS_FINISHED);
|
||||
wmItemRecptService.updateWmItemRecpt(wmItemRecpt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,89 @@
|
||||
package com.ktg.mes.wm.domain.tx;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ktg.common.annotation.Excel;
|
||||
import com.ktg.common.core.domain.BaseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class ItemRecptTxBean extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 产品物料ID */
|
||||
private Long itemId;
|
||||
|
||||
/** 产品物料编码 */
|
||||
private String itemCode;
|
||||
|
||||
/** 产品物料名称 */
|
||||
private String itemName;
|
||||
|
||||
/** 规格型号 */
|
||||
private String specification;
|
||||
|
||||
/** 单位 */
|
||||
private String unitOfMeasure;
|
||||
|
||||
/** 入库批次号 */
|
||||
private String batchCode;
|
||||
|
||||
/** 仓库ID */
|
||||
private Long warehouseId;
|
||||
|
||||
/** 仓库编码 */
|
||||
private String warehouseCode;
|
||||
|
||||
/** 仓库名称 */
|
||||
private String warehouseName;
|
||||
|
||||
/** 库区ID */
|
||||
private Long locationId;
|
||||
|
||||
/** 库区编码 */
|
||||
private String locationCode;
|
||||
|
||||
/** 库区名称 */
|
||||
private String locationName;
|
||||
|
||||
/** 库位ID */
|
||||
private Long areaId;
|
||||
|
||||
/** 库位编码 */
|
||||
private String areaCode;
|
||||
|
||||
/** 库位名称 */
|
||||
private String areaName;
|
||||
|
||||
/** 供应商ID */
|
||||
private Long vendorId;
|
||||
|
||||
/** 供应商编号 */
|
||||
private String vendorCode;
|
||||
|
||||
/** 供应商名称 */
|
||||
private String vendorName;
|
||||
|
||||
/** 供应商简称 */
|
||||
private String vendorNick;
|
||||
|
||||
/** 单据类型 */
|
||||
private String sourceDocType;
|
||||
|
||||
/** 单据ID */
|
||||
private Long sourceDocId;
|
||||
|
||||
/** 单据编号 */
|
||||
private String sourceDocCode;
|
||||
|
||||
/** 单据行ID */
|
||||
private Long sourceDocLineId;
|
||||
|
||||
/** 事务数量 */
|
||||
private BigDecimal transactionQuantity;
|
||||
|
||||
/** 库存有效期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date expireDate;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.ktg.mes.wm.service;
|
||||
|
||||
import com.ktg.mes.wm.domain.WmItemRecptLine;
|
||||
import com.ktg.mes.wm.domain.tx.ItemRecptTxBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public interface IStorageCoreService {
|
||||
|
||||
/**
|
||||
* 处理物料入库单
|
||||
* @param lines
|
||||
*/
|
||||
public void processItemRecpt(List<ItemRecptTxBean> lines);
|
||||
|
||||
|
||||
}
|
@ -2,6 +2,7 @@ package com.ktg.mes.wm.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ktg.mes.wm.domain.WmItemRecpt;
|
||||
import com.ktg.mes.wm.domain.tx.ItemRecptTxBean;
|
||||
|
||||
/**
|
||||
* 物料入库单Service接口
|
||||
@ -65,4 +66,14 @@ public interface IWmItemRecptService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWmItemRecptByRecptId(Long recptId);
|
||||
|
||||
|
||||
/**
|
||||
* 组装当前入库单对应的库存事务传入bean
|
||||
* @param receptId
|
||||
* @return
|
||||
*/
|
||||
public List<ItemRecptTxBean> getTxBeans(Long receptId);
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.ktg.mes.wm.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.exception.BussinessException;
|
||||
import com.ktg.mes.wm.domain.WmItemRecptLine;
|
||||
import com.ktg.mes.wm.domain.WmTransaction;
|
||||
import com.ktg.mes.wm.domain.tx.ItemRecptTxBean;
|
||||
import com.ktg.mes.wm.service.IStorageCoreService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class StorageCoreServiceImpl implements IStorageCoreService {
|
||||
|
||||
|
||||
@Override
|
||||
public void processItemRecpt(List<ItemRecptTxBean> lines) {
|
||||
String transactionType = UserConstants.TRANSACTION_TYPE_ITEM_RECPT;
|
||||
if(CollUtil.isEmpty(lines)){
|
||||
throw new BussinessException("没有需要处理的入库单行");
|
||||
}
|
||||
|
||||
for (int i =0;i<lines.size();i++){
|
||||
ItemRecptTxBean line = lines.get(i);
|
||||
WmTransaction transaction = new WmTransaction();
|
||||
transaction.setTransactionType(transactionType);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.utils.DateUtils;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.mes.wm.domain.tx.ItemRecptTxBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ktg.mes.wm.mapper.WmItemRecptMapper;
|
||||
@ -106,4 +107,9 @@ public class WmItemRecptServiceImpl implements IWmItemRecptService
|
||||
{
|
||||
return wmItemRecptMapper.deleteWmItemRecptByRecptId(recptId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemRecptTxBean> getTxBeans(Long receptId) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
package com.ktg.mes.wm.utils;
|
||||
|
||||
public class WmStockUtil {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user