销售出库库存事务
This commit is contained in:
parent
0d4872712d
commit
9aa73865ce
@ -126,15 +126,18 @@ public class UserConstants
|
||||
public static final String TRANSACTION_TYPE_ITEM_ISSUE_OUT = "ITEM_ISSUE_OUT"; //生产领用-出库事务
|
||||
public static final String TRANSACTION_TYPE_ITEM_ISSUE_IN = "ITEM_ISSUE_IN"; //生产领用-入库事务
|
||||
|
||||
public static final String TRANSACTION_TYPE_ITEM_RT_ISSUE_OUT = "ITEM_RT_ISSUE_OUT"; //生产退库-出库事务
|
||||
public static final String TRANSACTION_TYPE_ITEM_RT_ISSUE_IN = "ITEM_RT_ISSUE_IN"; //生产退库-入库事务
|
||||
public static final String TRANSACTION_TYPE_ITEM_RT_ISSUE_OUT = "ITEM_RT_ISSUE_OUT"; //生产退料-出库事务
|
||||
public static final String TRANSACTION_TYPE_ITEM_RT_ISSUE_IN = "ITEM_RT_ISSUE_IN"; //生产退料-入库事务
|
||||
|
||||
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"; //杂项出库
|
||||
|
||||
public static final String TRANSACTION_TYPE_PRODUCT_RECPT_OUT = "PRODUCT_RECPT_OUT"; //产品入库-出库事务
|
||||
public static final String TRANSACTION_TYPE_PRODUCT_RECPT_IN = "PRODUCT_RECPT_IN"; //产品入库-入库事务
|
||||
|
||||
public static final String TRANSACTION_TYPE_PRODUCT_ISSUE = "PRODUCT_SALSE"; //销售出库
|
||||
public static final String TRANSACTION_TYPE_PRODUCT_RS = "PRODUCT_RT"; //销售退货
|
||||
|
||||
|
||||
/**
|
||||
* 轮班方式
|
||||
|
@ -1,13 +1,14 @@
|
||||
package com.ktg.mes.wm.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.mes.wm.domain.WmStorageArea;
|
||||
import com.ktg.mes.wm.domain.WmStorageLocation;
|
||||
import com.ktg.mes.wm.domain.WmWarehouse;
|
||||
import com.ktg.mes.wm.domain.*;
|
||||
import com.ktg.mes.wm.domain.tx.ProductSalseTxBean;
|
||||
import com.ktg.mes.wm.service.*;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -24,7 +25,6 @@ import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.mes.wm.domain.WmProductSalse;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
|
||||
@ -164,4 +164,30 @@ public class WmProductSalseController extends BaseController
|
||||
}
|
||||
return toAjax(wmProductSalseService.deleteWmProductSalseBySalseIds(salseIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行出库
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productsalse:edit')")
|
||||
@Log(title = "销售出库单", businessType = BusinessType.UPDATE)
|
||||
@Transactional
|
||||
@PutMapping("/{salseId}")
|
||||
public AjaxResult execute(@PathVariable Long salseId){
|
||||
WmProductSalse salse = wmProductSalseService.selectWmProductSalseBySalseId(salseId);
|
||||
|
||||
WmProductSalseLine param = new WmProductSalseLine();
|
||||
param.setSalseId(salseId);
|
||||
List<WmProductSalseLine> lines = wmProductSalseLineService.selectWmProductSalseLineList(param);
|
||||
if(CollectionUtil.isEmpty(lines)){
|
||||
return AjaxResult.error("出库物资不能为空");
|
||||
}
|
||||
|
||||
List<ProductSalseTxBean> beans = wmProductSalseService.getTxBeans(salseId);
|
||||
storageCoreService.processProductSalse(beans);
|
||||
|
||||
salse.setStatus(UserConstants.ORDER_STATUS_FINISHED);
|
||||
wmProductSalseService.updateWmProductSalse(salse);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,354 @@
|
||||
package com.ktg.mes.wm.domain.tx;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ktg.common.core.domain.BaseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class ProductSalseTxBean extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long materialStockId;
|
||||
|
||||
/** 物料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 clientId;
|
||||
|
||||
/** 供应商编号 */
|
||||
private String clientCode;
|
||||
|
||||
/** 供应商名称 */
|
||||
private String clientName;
|
||||
|
||||
/** 供应商简称 */
|
||||
private String clientNick;
|
||||
|
||||
/** 生产工单ID */
|
||||
private Long workorderId;
|
||||
|
||||
/** 生产工单编号 */
|
||||
private String workorderCode;
|
||||
|
||||
/** 单据类型 */
|
||||
private String sourceDocType;
|
||||
|
||||
/** 单据ID */
|
||||
private Long sourceDocId;
|
||||
|
||||
/** 单据编号 */
|
||||
private String sourceDocCode;
|
||||
|
||||
/** 单据行ID */
|
||||
private Long sourceDocLineId;
|
||||
|
||||
/** 事务数量 */
|
||||
private BigDecimal transactionQuantity;
|
||||
|
||||
/** 出库日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
|
||||
private Date salseDate;
|
||||
|
||||
public Long getMaterialStockId() {
|
||||
return materialStockId;
|
||||
}
|
||||
|
||||
public void setMaterialStockId(Long materialStockId) {
|
||||
this.materialStockId = materialStockId;
|
||||
}
|
||||
|
||||
public Long getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(Long itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public String getItemCode() {
|
||||
return itemCode;
|
||||
}
|
||||
|
||||
public void setItemCode(String itemCode) {
|
||||
this.itemCode = itemCode;
|
||||
}
|
||||
|
||||
public String getItemName() {
|
||||
return itemName;
|
||||
}
|
||||
|
||||
public void setItemName(String itemName) {
|
||||
this.itemName = itemName;
|
||||
}
|
||||
|
||||
public String getSpecification() {
|
||||
return specification;
|
||||
}
|
||||
|
||||
public void setSpecification(String specification) {
|
||||
this.specification = specification;
|
||||
}
|
||||
|
||||
public String getUnitOfMeasure() {
|
||||
return unitOfMeasure;
|
||||
}
|
||||
|
||||
public void setUnitOfMeasure(String unitOfMeasure) {
|
||||
this.unitOfMeasure = unitOfMeasure;
|
||||
}
|
||||
|
||||
public String getBatchCode() {
|
||||
return batchCode;
|
||||
}
|
||||
|
||||
public void setBatchCode(String batchCode) {
|
||||
this.batchCode = batchCode;
|
||||
}
|
||||
|
||||
public Long getWarehouseId() {
|
||||
return warehouseId;
|
||||
}
|
||||
|
||||
public void setWarehouseId(Long warehouseId) {
|
||||
this.warehouseId = warehouseId;
|
||||
}
|
||||
|
||||
public String getWarehouseCode() {
|
||||
return warehouseCode;
|
||||
}
|
||||
|
||||
public void setWarehouseCode(String warehouseCode) {
|
||||
this.warehouseCode = warehouseCode;
|
||||
}
|
||||
|
||||
public String getWarehouseName() {
|
||||
return warehouseName;
|
||||
}
|
||||
|
||||
public void setWarehouseName(String warehouseName) {
|
||||
this.warehouseName = warehouseName;
|
||||
}
|
||||
|
||||
public Long getLocationId() {
|
||||
return locationId;
|
||||
}
|
||||
|
||||
public void setLocationId(Long locationId) {
|
||||
this.locationId = locationId;
|
||||
}
|
||||
|
||||
public String getLocationCode() {
|
||||
return locationCode;
|
||||
}
|
||||
|
||||
public void setLocationCode(String locationCode) {
|
||||
this.locationCode = locationCode;
|
||||
}
|
||||
|
||||
public String getLocationName() {
|
||||
return locationName;
|
||||
}
|
||||
|
||||
public void setLocationName(String locationName) {
|
||||
this.locationName = locationName;
|
||||
}
|
||||
|
||||
public Long getAreaId() {
|
||||
return areaId;
|
||||
}
|
||||
|
||||
public void setAreaId(Long areaId) {
|
||||
this.areaId = areaId;
|
||||
}
|
||||
|
||||
public String getAreaCode() {
|
||||
return areaCode;
|
||||
}
|
||||
|
||||
public void setAreaCode(String areaCode) {
|
||||
this.areaCode = areaCode;
|
||||
}
|
||||
|
||||
public String getAreaName() {
|
||||
return areaName;
|
||||
}
|
||||
|
||||
public void setAreaName(String areaName) {
|
||||
this.areaName = areaName;
|
||||
}
|
||||
|
||||
public Long getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setClientId(Long clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getClientCode() {
|
||||
return clientCode;
|
||||
}
|
||||
|
||||
public void setClientCode(String clientCode) {
|
||||
this.clientCode = clientCode;
|
||||
}
|
||||
|
||||
public String getClientName() {
|
||||
return clientName;
|
||||
}
|
||||
|
||||
public void setClientName(String clientName) {
|
||||
this.clientName = clientName;
|
||||
}
|
||||
|
||||
public String getClientNick() {
|
||||
return clientNick;
|
||||
}
|
||||
|
||||
public void setClientNick(String clientNick) {
|
||||
this.clientNick = clientNick;
|
||||
}
|
||||
|
||||
public Long getWorkorderId() {
|
||||
return workorderId;
|
||||
}
|
||||
|
||||
public void setWorkorderId(Long workorderId) {
|
||||
this.workorderId = workorderId;
|
||||
}
|
||||
|
||||
public String getWorkorderCode() {
|
||||
return workorderCode;
|
||||
}
|
||||
|
||||
public void setWorkorderCode(String workorderCode) {
|
||||
this.workorderCode = workorderCode;
|
||||
}
|
||||
|
||||
public String getSourceDocType() {
|
||||
return sourceDocType;
|
||||
}
|
||||
|
||||
public void setSourceDocType(String sourceDocType) {
|
||||
this.sourceDocType = sourceDocType;
|
||||
}
|
||||
|
||||
public Long getSourceDocId() {
|
||||
return sourceDocId;
|
||||
}
|
||||
|
||||
public void setSourceDocId(Long sourceDocId) {
|
||||
this.sourceDocId = sourceDocId;
|
||||
}
|
||||
|
||||
public String getSourceDocCode() {
|
||||
return sourceDocCode;
|
||||
}
|
||||
|
||||
public void setSourceDocCode(String sourceDocCode) {
|
||||
this.sourceDocCode = sourceDocCode;
|
||||
}
|
||||
|
||||
public Long getSourceDocLineId() {
|
||||
return sourceDocLineId;
|
||||
}
|
||||
|
||||
public void setSourceDocLineId(Long sourceDocLineId) {
|
||||
this.sourceDocLineId = sourceDocLineId;
|
||||
}
|
||||
|
||||
public BigDecimal getTransactionQuantity() {
|
||||
return transactionQuantity;
|
||||
}
|
||||
|
||||
public void setTransactionQuantity(BigDecimal transactionQuantity) {
|
||||
this.transactionQuantity = transactionQuantity;
|
||||
}
|
||||
|
||||
public Date getSalseDate() {
|
||||
return salseDate;
|
||||
}
|
||||
|
||||
public void setSalseDate(Date salseDate) {
|
||||
this.salseDate = salseDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProductSalseTxBean{" +
|
||||
"materialStockId=" + materialStockId +
|
||||
", itemId=" + itemId +
|
||||
", itemCode='" + itemCode + '\'' +
|
||||
", itemName='" + itemName + '\'' +
|
||||
", specification='" + specification + '\'' +
|
||||
", unitOfMeasure='" + unitOfMeasure + '\'' +
|
||||
", batchCode='" + batchCode + '\'' +
|
||||
", warehouseId=" + warehouseId +
|
||||
", warehouseCode='" + warehouseCode + '\'' +
|
||||
", warehouseName='" + warehouseName + '\'' +
|
||||
", locationId=" + locationId +
|
||||
", locationCode='" + locationCode + '\'' +
|
||||
", locationName='" + locationName + '\'' +
|
||||
", areaId=" + areaId +
|
||||
", areaCode='" + areaCode + '\'' +
|
||||
", areaName='" + areaName + '\'' +
|
||||
", clientId=" + clientId +
|
||||
", clientCode='" + clientCode + '\'' +
|
||||
", clientName='" + clientName + '\'' +
|
||||
", clientNick='" + clientNick + '\'' +
|
||||
", workorderId=" + workorderId +
|
||||
", workorderCode='" + workorderCode + '\'' +
|
||||
", sourceDocType='" + sourceDocType + '\'' +
|
||||
", sourceDocId=" + sourceDocId +
|
||||
", sourceDocCode='" + sourceDocCode + '\'' +
|
||||
", sourceDocLineId=" + sourceDocLineId +
|
||||
", transactionQuantity=" + transactionQuantity +
|
||||
", salseDate=" + salseDate +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package com.ktg.mes.wm.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ktg.mes.wm.domain.WmProductSalse;
|
||||
import com.ktg.mes.wm.domain.tx.ProductSalseTxBean;
|
||||
|
||||
/**
|
||||
* 销售出库单Mapper接口
|
||||
@ -65,4 +66,11 @@ public interface WmProductSalseMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWmProductSalseBySalseIds(Long[] salseIds);
|
||||
|
||||
/**
|
||||
* 获取产品销售出库事务Bean
|
||||
* @param salseId
|
||||
* @return
|
||||
*/
|
||||
public List<ProductSalseTxBean> getTxBeans(Long salseId);
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
package com.ktg.mes.wm.service;
|
||||
|
||||
import com.ktg.mes.wm.domain.WmItemRecptLine;
|
||||
import com.ktg.mes.wm.domain.tx.IssueTxBean;
|
||||
import com.ktg.mes.wm.domain.tx.ItemRecptTxBean;
|
||||
import com.ktg.mes.wm.domain.tx.RtIssueTxBean;
|
||||
import com.ktg.mes.wm.domain.tx.RtVendorTxBean;
|
||||
import com.ktg.mes.wm.domain.tx.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@ -36,4 +33,16 @@ public interface IStorageCoreService {
|
||||
*/
|
||||
public void processRtIssue(List<RtIssueTxBean> lines);
|
||||
|
||||
/**
|
||||
* 处理产品入库
|
||||
* @param lines
|
||||
*/
|
||||
public void processProductRecpt(List<ProductRecptTxBean> lines);
|
||||
|
||||
/**
|
||||
* 处理产品销售出库
|
||||
* @param lines
|
||||
*/
|
||||
public void processProductSalse(List<ProductSalseTxBean> lines);
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.ktg.mes.wm.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ktg.mes.wm.domain.WmProductSalse;
|
||||
import com.ktg.mes.wm.domain.tx.ProductSalseTxBean;
|
||||
|
||||
/**
|
||||
* 销售出库单Service接口
|
||||
@ -27,6 +28,14 @@ public interface IWmProductSalseService
|
||||
*/
|
||||
public List<WmProductSalse> selectWmProductSalseList(WmProductSalse wmProductSalse);
|
||||
|
||||
|
||||
/**
|
||||
* 获取产品销售出库事务Bean
|
||||
* @param salseId
|
||||
* @return
|
||||
*/
|
||||
public List<ProductSalseTxBean> getTxBeans(Long salseId);
|
||||
|
||||
/**
|
||||
* 检查编号唯一性
|
||||
* @param wmProductSalse
|
||||
|
@ -4,13 +4,11 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.exception.BussinessException;
|
||||
import com.ktg.common.utils.bean.BeanUtils;
|
||||
import com.ktg.mes.wm.domain.WmStorageArea;
|
||||
import com.ktg.mes.wm.domain.WmStorageLocation;
|
||||
import com.ktg.mes.wm.domain.WmTransaction;
|
||||
import com.ktg.mes.wm.domain.WmWarehouse;
|
||||
import com.ktg.mes.wm.domain.tx.IssueTxBean;
|
||||
import com.ktg.mes.wm.domain.tx.ItemRecptTxBean;
|
||||
import com.ktg.mes.wm.domain.tx.RtIssueTxBean;
|
||||
import com.ktg.mes.wm.domain.tx.RtVendorTxBean;
|
||||
import com.ktg.mes.wm.domain.tx.*;
|
||||
import com.ktg.mes.wm.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -57,6 +55,10 @@ public class StorageCoreServiceImpl implements IStorageCoreService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 供应商退货
|
||||
* @param lines
|
||||
*/
|
||||
@Override
|
||||
public void processRtVendor(List<RtVendorTxBean> lines) {
|
||||
String transactionType = UserConstants.TRANSACTION_TYPE_ITEM_RTV;
|
||||
@ -76,6 +78,10 @@ public class StorageCoreServiceImpl implements IStorageCoreService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 生产领料
|
||||
* @param lines
|
||||
*/
|
||||
@Override
|
||||
public void processIssue(List<IssueTxBean> lines) {
|
||||
if(CollUtil.isEmpty(lines)){
|
||||
@ -112,12 +118,21 @@ public class StorageCoreServiceImpl implements IStorageCoreService {
|
||||
transaction_in.setLocationId(location.getLocationId());
|
||||
transaction_in.setLocationCode(location.getLocationCode());
|
||||
transaction_in.setLocationName(location.getLocationName());
|
||||
WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaCode(UserConstants.VIRTUAL_WA);
|
||||
transaction_in.setAreaId(area.getAreaId());
|
||||
transaction_in.setAreaCode(area.getAreaCode());
|
||||
transaction_in.setAreaName(area.getAreaName());
|
||||
//设置入库相关联的出库事务ID
|
||||
transaction_in.setRelatedTransactionId(transaction_out.getTransactionId());
|
||||
wmTransactionService.processTransaction(transaction_in);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生产退料
|
||||
* @param lines
|
||||
*/
|
||||
@Override
|
||||
public void processRtIssue(List<RtIssueTxBean> lines) {
|
||||
if(CollUtil.isEmpty(lines)){
|
||||
@ -133,6 +148,21 @@ public class StorageCoreServiceImpl implements IStorageCoreService {
|
||||
WmTransaction transaction_out = new WmTransaction();
|
||||
transaction_out.setTransactionType(transactionType_out);
|
||||
BeanUtils.copyBeanProp(transaction_out,line);
|
||||
|
||||
//这里的出库事务默认从线边库出库到实际仓库
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseCode(UserConstants.VIRTUAL_WH);
|
||||
transaction_out.setWarehouseId(warehouse.getWarehouseId());
|
||||
transaction_out.setWarehouseCode(warehouse.getWarehouseCode());
|
||||
transaction_out.setWarehouseName(warehouse.getWarehouseName());
|
||||
WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationCode(UserConstants.VIRTUAL_WS);
|
||||
transaction_out.setLocationId(location.getLocationId());
|
||||
transaction_out.setLocationCode(location.getLocationCode());
|
||||
transaction_out.setLocationName(location.getLocationName());
|
||||
WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaCode(UserConstants.VIRTUAL_WA);
|
||||
transaction_out.setAreaId(area.getAreaId());
|
||||
transaction_out.setAreaCode(area.getAreaCode());
|
||||
transaction_out.setAreaName(area.getAreaName());
|
||||
|
||||
transaction_out.setTransactionFlag(-1);//库存减少
|
||||
wmTransactionService.processTransaction(transaction_out);
|
||||
|
||||
@ -150,4 +180,82 @@ public class StorageCoreServiceImpl implements IStorageCoreService {
|
||||
wmTransactionService.processTransaction(transaction_in);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品入库
|
||||
* @param lines
|
||||
*/
|
||||
@Override
|
||||
public void processProductRecpt(List<ProductRecptTxBean> lines) {
|
||||
if(CollUtil.isEmpty(lines)){
|
||||
throw new BussinessException("没有需要处理的产品入库单行");
|
||||
}
|
||||
String transactionType_out = UserConstants.TRANSACTION_TYPE_PRODUCT_RECPT_OUT;
|
||||
String transactionType_in = UserConstants.TRANSACTION_TYPE_PRODUCT_RECPT_IN;
|
||||
|
||||
for(int i=0;i<lines.size();i++){
|
||||
ProductRecptTxBean line = lines.get(i);
|
||||
|
||||
//构造一条目的库存减少的事务
|
||||
WmTransaction transaction_out = new WmTransaction();
|
||||
transaction_out.setTransactionType(transactionType_out);
|
||||
BeanUtils.copyBeanProp(transaction_out,line);
|
||||
|
||||
//这里的产品入库是从线边库入到实际的仓库,出库事务对应的仓库是线边库
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseCode(UserConstants.VIRTUAL_WH);
|
||||
transaction_out.setWarehouseId(warehouse.getWarehouseId());
|
||||
transaction_out.setWarehouseCode(warehouse.getWarehouseCode());
|
||||
transaction_out.setWarehouseName(warehouse.getWarehouseName());
|
||||
WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationCode(UserConstants.VIRTUAL_WS);
|
||||
transaction_out.setLocationId(location.getLocationId());
|
||||
transaction_out.setLocationCode(location.getLocationCode());
|
||||
transaction_out.setLocationName(location.getLocationName());
|
||||
WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaCode(UserConstants.VIRTUAL_WA);
|
||||
transaction_out.setAreaId(area.getAreaId());
|
||||
transaction_out.setAreaCode(area.getAreaCode());
|
||||
transaction_out.setAreaName(area.getAreaName());
|
||||
|
||||
transaction_out.setTransactionFlag(-1);//库存减少
|
||||
wmTransactionService.processTransaction(transaction_out);
|
||||
|
||||
//构造一条目的库存增加的事务
|
||||
WmTransaction transaction_in = new WmTransaction();
|
||||
transaction_in.setTransactionType(transactionType_in);
|
||||
BeanUtils.copyBeanProp(transaction_in,line);
|
||||
transaction_in.setTransactionFlag(1);//库存增加
|
||||
transaction_in.setTransactionDate(new Date());
|
||||
//由于是新增的库存记录所以需要将查询出来的库存记录ID置为空
|
||||
transaction_in.setMaterialStockId(null);
|
||||
//设置入库相关联的出库事务ID
|
||||
transaction_in.setRelatedTransactionId(transaction_out.getTransactionId());
|
||||
|
||||
wmTransactionService.processTransaction(transaction_in);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 销售出库
|
||||
* @param lines
|
||||
*/
|
||||
@Override
|
||||
public void processProductSalse(List<ProductSalseTxBean> lines) {
|
||||
if(CollUtil.isEmpty(lines)){
|
||||
throw new BussinessException("没有需要处理的产品销售出库单行");
|
||||
}
|
||||
|
||||
String transactionType = UserConstants.TRANSACTION_TYPE_PRODUCT_ISSUE;
|
||||
for(int i=0;i<lines.size();i++){
|
||||
ProductSalseTxBean bean = lines.get(i);
|
||||
WmTransaction transaction = new WmTransaction();
|
||||
transaction.setTransactionType(transactionType);
|
||||
BeanUtils.copyBeanProp(transaction,bean);
|
||||
transaction.setTransactionFlag(-1); //库存减少
|
||||
transaction.setTransactionDate(new Date());
|
||||
wmTransactionService.processTransaction(transaction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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.ProductSalseTxBean;
|
||||
import org.apache.catalina.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -48,6 +49,11 @@ public class WmProductSalseServiceImpl implements IWmProductSalseService
|
||||
return wmProductSalseMapper.selectWmProductSalseList(wmProductSalse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductSalseTxBean> getTxBeans(Long salseId) {
|
||||
return wmProductSalseMapper.getTxBeans(salseId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String checkUnique(WmProductSalse wmProductSalse) {
|
||||
WmProductSalse salse = wmProductSalseMapper.checkUnique(wmProductSalse);
|
||||
|
@ -37,6 +37,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<resultMap id="ProductSalseTxBeanResult" type="ProductSalseTxBean">
|
||||
<result property="materialStockId" column="material_stock_id"></result>
|
||||
<result property="itemId" column="item_id"></result>
|
||||
<result property="itemCode" column="item_code"></result>
|
||||
<result property="itemName" column="item_name"></result>
|
||||
<result property="specification" column="specification"></result>
|
||||
<result property="unitOfMeasure" column="unit_of_measure"></result>
|
||||
<result property="batchCode" column="batch_code"></result>
|
||||
<result property="warehouseId" column="warehouse_id"></result>
|
||||
<result property="warehouseCode" column="warehouse_code"></result>
|
||||
<result property="warehouseName" column="warehouse_name"></result>
|
||||
<result property="locationId" column="location_id"></result>
|
||||
<result property="locationCode" column="location_code"></result>
|
||||
<result property="locationName" column="location_name"></result>
|
||||
<result property="areaId" column="area_id"></result>
|
||||
<result property="areaCode" column="area_code"></result>
|
||||
<result property="areaName" column="area_name"></result>
|
||||
<result property="clientId" column="client_id"></result>
|
||||
<result property="clientCode" column="client_code"></result>
|
||||
<result property="clientName" column="client_name"></result>
|
||||
<result property="clientNick" column="client_nick"></result>
|
||||
<result property="sourceDocType" column="source_doc_type"></result>
|
||||
<result property="sourceDocId" column="source_doc_id"></result>
|
||||
<result property="sourceDocCode" column="source_doc_code"></result>
|
||||
<result property="sourceDocLineId" column="source_doc_line_id"></result>
|
||||
<result property="transactionQuantity" column="transaction_quantity"></result>
|
||||
<result property="workorderId" column="workorder_id"></result>
|
||||
<result property="workorderCode" column="workorder_code"></result>
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWmProductSalseVo">
|
||||
select salse_id, salse_code, salse_name, oqc_id, oqc_code, so_code, client_id, client_code, client_name, client_nick, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, salse_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_product_salse
|
||||
</sql>
|
||||
@ -77,6 +112,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where salse_code = #{salseCode}
|
||||
</select>
|
||||
|
||||
<select id="getTxBeans" parameterType="Long" resultMap="ProductSalseTxBeanResult">
|
||||
SELECT irl.material_stock_id, irl.`item_id`,irl.`item_code`,irl.`item_name`,irl.`specification`,irl.`unit_of_measure`,irl.`batch_code`,
|
||||
irl.`warehouse_id`,irl.`warehouse_code`,irl.`warehouse_name`,irl.`location_id`,irl.`location_code`,irl.`location_name`,
|
||||
irl.`area_id`,irl.`area_code`,irl.`area_name`,
|
||||
'PSALSE' AS source_doc_type,ir.`salse_id` AS source_doc_id,ir.`salse_code` AS source_doc_code,irl.`line_id` AS source_doc_line_id,
|
||||
irl.`quantity_salse` AS transaction_quantity,
|
||||
ir.`create_by`,ir.`create_time`,ir.`update_by`,ir.`update_time`
|
||||
FROM wm_product_salse ir
|
||||
LEFT JOIN wm_product_salse_line irl
|
||||
ON ir.salse_id = irl.`salse_id`
|
||||
WHERE ir.`salse_id` = #{salseId}
|
||||
</select>
|
||||
|
||||
<insert id="insertWmProductSalse" parameterType="WmProductSalse" useGeneratedKeys="true" keyProperty="salseId">
|
||||
insert into wm_product_salse
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
Loading…
Reference in New Issue
Block a user