完善关联请购单中的数量计算逻辑
This commit is contained in:
@@ -424,6 +424,9 @@ public class ExceptionConstants {
|
|||||||
//单据录入-单据中存在部分状态,需要到新增界面关联单据
|
//单据录入-单据中存在部分状态,需要到新增界面关联单据
|
||||||
public static final int DEPOT_ITEM_EXIST_PARTIALLY_STATUS_FAILED_CODE = 8500028;
|
public static final int DEPOT_ITEM_EXIST_PARTIALLY_STATUS_FAILED_CODE = 8500028;
|
||||||
public static final String DEPOT_ITEM_EXIST_PARTIALLY_STATUS_FAILED_MSG = "抱歉,单据:%s是部分%s状态,需要到新增界面关联单据";
|
public static final String DEPOT_ITEM_EXIST_PARTIALLY_STATUS_FAILED_MSG = "抱歉,单据:%s是部分%s状态,需要到新增界面关联单据";
|
||||||
|
//单据录入-关联请购单号和关联订单号不能同时录入
|
||||||
|
public static final int DEPOT_ITEM_EXIST_REPEAT_NO_FAILED_CODE = 8500029;
|
||||||
|
public static final String DEPOT_ITEM_EXIST_REPEAT_NO_FAILED_MSG = "抱歉,关联请购单号和关联订单号不能同时录入";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单据明细信息
|
* 单据明细信息
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ public class DepotHead {
|
|||||||
|
|
||||||
private String linkNumber;
|
private String linkNumber;
|
||||||
|
|
||||||
|
private String linkApply;
|
||||||
|
|
||||||
private Long tenantId;
|
private Long tenantId;
|
||||||
|
|
||||||
private String deleteFlag;
|
private String deleteFlag;
|
||||||
@@ -298,6 +300,14 @@ public class DepotHead {
|
|||||||
this.linkNumber = linkNumber == null ? null : linkNumber.trim();
|
this.linkNumber = linkNumber == null ? null : linkNumber.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLinkApply() {
|
||||||
|
return linkApply;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLinkApply(String linkApply) {
|
||||||
|
this.linkApply = linkApply == null ? null : linkApply.trim();
|
||||||
|
}
|
||||||
|
|
||||||
public Long getTenantId() {
|
public Long getTenantId() {
|
||||||
return tenantId;
|
return tenantId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1996,6 +1996,76 @@ public class DepotHeadExample {
|
|||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andLinkApplyIsNull() {
|
||||||
|
addCriterion("link_apply is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLinkApplyIsNotNull() {
|
||||||
|
addCriterion("link_apply is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLinkApplyEqualTo(String value) {
|
||||||
|
addCriterion("link_apply =", value, "linkApply");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLinkApplyNotEqualTo(String value) {
|
||||||
|
addCriterion("link_apply <>", value, "linkApply");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLinkApplyGreaterThan(String value) {
|
||||||
|
addCriterion("link_apply >", value, "linkApply");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLinkApplyGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("link_apply >=", value, "linkApply");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLinkApplyLessThan(String value) {
|
||||||
|
addCriterion("link_apply <", value, "linkApply");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLinkApplyLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("link_apply <=", value, "linkApply");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLinkApplyLike(String value) {
|
||||||
|
addCriterion("link_apply like", value, "linkApply");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLinkApplyNotLike(String value) {
|
||||||
|
addCriterion("link_apply not like", value, "linkApply");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLinkApplyIn(List<String> values) {
|
||||||
|
addCriterion("link_apply in", values, "linkApply");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLinkApplyNotIn(List<String> values) {
|
||||||
|
addCriterion("link_apply not in", values, "linkApply");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLinkApplyBetween(String value1, String value2) {
|
||||||
|
addCriterion("link_apply between", value1, value2, "linkApply");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLinkApplyNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("link_apply not between", value1, value2, "linkApply");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
public Criteria andTenantIdIsNull() {
|
public Criteria andTenantIdIsNull() {
|
||||||
addCriterion("tenant_id is null");
|
addCriterion("tenant_id is null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
|
|||||||
@@ -211,13 +211,15 @@ public interface DepotItemMapperEx {
|
|||||||
BigDecimal getFinishNumber(
|
BigDecimal getFinishNumber(
|
||||||
@Param("meId") Long meId,
|
@Param("meId") Long meId,
|
||||||
@Param("linkId") Long linkId,
|
@Param("linkId") Long linkId,
|
||||||
@Param("linkNumber") String linkNumber,
|
@Param("linkStr") String linkStr,
|
||||||
|
@Param("noType") String noType,
|
||||||
@Param("goToType") String goToType);
|
@Param("goToType") String goToType);
|
||||||
|
|
||||||
BigDecimal getRealFinishNumber(
|
BigDecimal getRealFinishNumber(
|
||||||
@Param("meId") Long meId,
|
@Param("meId") Long meId,
|
||||||
@Param("linkId") Long linkId,
|
@Param("linkId") Long linkId,
|
||||||
@Param("linkNumber") String linkNumber,
|
@Param("linkStr") String linkStr,
|
||||||
|
@Param("linkType") String linkType,
|
||||||
@Param("currentHeaderId") Long currentHeaderId,
|
@Param("currentHeaderId") Long currentHeaderId,
|
||||||
@Param("goToType") String goToType);
|
@Param("goToType") String goToType);
|
||||||
|
|
||||||
@@ -235,10 +237,11 @@ public interface DepotItemMapperEx {
|
|||||||
@Param("depotId") Long depotId);
|
@Param("depotId") Long depotId);
|
||||||
|
|
||||||
List<DepotItemVo4MaterialAndSum> getLinkBillDetailMaterialSum(
|
List<DepotItemVo4MaterialAndSum> getLinkBillDetailMaterialSum(
|
||||||
@Param("linkNumber") String linkNumber);
|
@Param("linkStr") String linkStr);
|
||||||
|
|
||||||
List<DepotItemVo4MaterialAndSum> getBatchBillDetailMaterialSum(
|
List<DepotItemVo4MaterialAndSum> getBatchBillDetailMaterialSum(
|
||||||
@Param("linkNumber") String linkNumber,
|
@Param("linkStr") String linkStr,
|
||||||
|
@Param("linkType") String linkType,
|
||||||
@Param("type") String type);
|
@Param("type") String type);
|
||||||
|
|
||||||
Long getCountByMaterialAndBatchNumber(
|
Long getCountByMaterialAndBatchNumber(
|
||||||
|
|||||||
@@ -514,7 +514,7 @@ public class DepotHeadService {
|
|||||||
BusinessConstants.SUB_TYPE_PURCHASE_ORDER.equals(depotHead.getSubType())) {
|
BusinessConstants.SUB_TYPE_PURCHASE_ORDER.equals(depotHead.getSubType())) {
|
||||||
DepotHead dh = new DepotHead();
|
DepotHead dh = new DepotHead();
|
||||||
//获取分批操作后单据的商品和商品数量(汇总)
|
//获取分批操作后单据的商品和商品数量(汇总)
|
||||||
List<DepotItemVo4MaterialAndSum> batchList = depotItemMapperEx.getBatchBillDetailMaterialSum(depotHead.getLinkNumber(), depotHead.getType());
|
List<DepotItemVo4MaterialAndSum> batchList = depotItemMapperEx.getBatchBillDetailMaterialSum(depotHead.getLinkNumber(), "normal", depotHead.getType());
|
||||||
if(batchList.size()>0) {
|
if(batchList.size()>0) {
|
||||||
dh.setPurchaseStatus(BusinessConstants.PURCHASE_STATUS_SKIPING);
|
dh.setPurchaseStatus(BusinessConstants.PURCHASE_STATUS_SKIPING);
|
||||||
} else {
|
} else {
|
||||||
@@ -1004,6 +1004,11 @@ public class DepotHeadService {
|
|||||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BILL_NUMBER_EXIST_CODE,
|
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BILL_NUMBER_EXIST_CODE,
|
||||||
String.format(ExceptionConstants.DEPOT_HEAD_BILL_NUMBER_EXIST_MSG));
|
String.format(ExceptionConstants.DEPOT_HEAD_BILL_NUMBER_EXIST_MSG));
|
||||||
}
|
}
|
||||||
|
//校验是否同时录入关联请购单号和关联订单号
|
||||||
|
if(StringUtil.isNotEmpty(depotHead.getLinkNumber()) && StringUtil.isNotEmpty(depotHead.getLinkApply())) {
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_EXIST_REPEAT_NO_FAILED_CODE,
|
||||||
|
String.format(ExceptionConstants.DEPOT_ITEM_EXIST_REPEAT_NO_FAILED_MSG));
|
||||||
|
}
|
||||||
String subType = depotHead.getSubType();
|
String subType = depotHead.getSubType();
|
||||||
//结算账户校验
|
//结算账户校验
|
||||||
if("采购".equals(subType) || "采购退货".equals(subType) || "销售".equals(subType) || "销售退货".equals(subType)) {
|
if("采购".equals(subType) || "采购退货".equals(subType) || "销售".equals(subType) || "销售退货".equals(subType)) {
|
||||||
@@ -1100,7 +1105,12 @@ public class DepotHeadService {
|
|||||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BILL_NUMBER_EXIST_CODE,
|
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BILL_NUMBER_EXIST_CODE,
|
||||||
String.format(ExceptionConstants.DEPOT_HEAD_BILL_NUMBER_EXIST_MSG));
|
String.format(ExceptionConstants.DEPOT_HEAD_BILL_NUMBER_EXIST_MSG));
|
||||||
}
|
}
|
||||||
//校验单据状态,如何不是未审核则提示
|
//校验是否同时录入关联请购单号和关联订单号
|
||||||
|
if(StringUtil.isNotEmpty(depotHead.getLinkNumber()) && StringUtil.isNotEmpty(depotHead.getLinkApply())) {
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_EXIST_REPEAT_NO_FAILED_CODE,
|
||||||
|
String.format(ExceptionConstants.DEPOT_ITEM_EXIST_REPEAT_NO_FAILED_MSG));
|
||||||
|
}
|
||||||
|
//校验单据状态,如果不是未审核则提示
|
||||||
if(!"0".equals(getDepotHead(depotHead.getId()).getStatus())) {
|
if(!"0".equals(getDepotHead(depotHead.getId()).getStatus())) {
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BILL_CANNOT_EDIT_CODE,
|
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BILL_CANNOT_EDIT_CODE,
|
||||||
String.format(ExceptionConstants.DEPOT_HEAD_BILL_CANNOT_EDIT_MSG));
|
String.format(ExceptionConstants.DEPOT_HEAD_BILL_CANNOT_EDIT_MSG));
|
||||||
|
|||||||
@@ -691,15 +691,21 @@ public class DepotItemService {
|
|||||||
|| BusinessConstants.SUB_TYPE_OTHER.equals(depotHead.getSubType())) {
|
|| BusinessConstants.SUB_TYPE_OTHER.equals(depotHead.getSubType())) {
|
||||||
if(StringUtil.isNotEmpty(depotHead.getLinkNumber())) {
|
if(StringUtil.isNotEmpty(depotHead.getLinkNumber())) {
|
||||||
//单据状态:是否全部完成 2-全部完成 3-部分完成(针对订单的分批出入库)
|
//单据状态:是否全部完成 2-全部完成 3-部分完成(针对订单的分批出入库)
|
||||||
String billStatus = getBillStatusByParam(depotHead);
|
String billStatus = getBillStatusByParam(depotHead, depotHead.getLinkNumber(), "normal");
|
||||||
changeBillStatus(depotHead, billStatus);
|
changeBillStatus(depotHead.getLinkNumber(), billStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果关联单据号非空则更新订单的状态,此处针对销售订单转采购订单的场景
|
//当前单据类型为采购订单的逻辑
|
||||||
if(BusinessConstants.SUB_TYPE_PURCHASE_ORDER.equals(depotHead.getSubType())) {
|
if(BusinessConstants.SUB_TYPE_PURCHASE_ORDER.equals(depotHead.getSubType())) {
|
||||||
|
//如果关联单据号非空则更新订单的状态,此处针对销售订单转采购订单的场景
|
||||||
if(StringUtil.isNotEmpty(depotHead.getLinkNumber())) {
|
if(StringUtil.isNotEmpty(depotHead.getLinkNumber())) {
|
||||||
String billStatus = getBillStatusByParam(depotHead);
|
String billStatus = getBillStatusByParam(depotHead, depotHead.getLinkNumber(), "normal");
|
||||||
changeBillPurchaseStatus(depotHead, billStatus);
|
changeBillPurchaseStatus(depotHead.getLinkNumber(), billStatus);
|
||||||
|
}
|
||||||
|
//如果关联单据号非空则更新订单的状态,此处针对请购单转采购订单的场景
|
||||||
|
if(StringUtil.isNotEmpty(depotHead.getLinkApply())) {
|
||||||
|
String billStatus = getBillStatusByParam(depotHead, depotHead.getLinkApply(), "apply");
|
||||||
|
changeBillStatus(depotHead.getLinkApply(), billStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -711,15 +717,16 @@ public class DepotItemService {
|
|||||||
* 判断单据的状态
|
* 判断单据的状态
|
||||||
* 通过数组对比:原单据的商品和商品数量(汇总) 与 分批操作后单据的商品和商品数量(汇总)
|
* 通过数组对比:原单据的商品和商品数量(汇总) 与 分批操作后单据的商品和商品数量(汇总)
|
||||||
* @param depotHead
|
* @param depotHead
|
||||||
|
* @param linkStr
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public String getBillStatusByParam(DepotHead depotHead) {
|
public String getBillStatusByParam(DepotHead depotHead, String linkStr, String linkType) {
|
||||||
String res = BusinessConstants.BILLS_STATUS_SKIPED;
|
String res = BusinessConstants.BILLS_STATUS_SKIPED;
|
||||||
//获取原单据的商品和商品数量(汇总)
|
//获取原单据的商品和商品数量(汇总)
|
||||||
List<DepotItemVo4MaterialAndSum> linkList = depotItemMapperEx.getLinkBillDetailMaterialSum(depotHead.getLinkNumber());
|
List<DepotItemVo4MaterialAndSum> linkList = depotItemMapperEx.getLinkBillDetailMaterialSum(linkStr);
|
||||||
//获取分批操作后单据的商品和商品数量(汇总)
|
//获取分批操作后单据的商品和商品数量(汇总)
|
||||||
List<DepotItemVo4MaterialAndSum> batchList = depotItemMapperEx.getBatchBillDetailMaterialSum(depotHead.getLinkNumber(), depotHead.getType());
|
List<DepotItemVo4MaterialAndSum> batchList = depotItemMapperEx.getBatchBillDetailMaterialSum(linkStr, linkType, depotHead.getType());
|
||||||
//将分批操作后的单据的商品和商品数据构造成Map
|
//将分批操作后的单据的商品和商品数据构造成Map
|
||||||
Map<Long, BigDecimal> materialSumMap = new HashMap<>();
|
Map<Long, BigDecimal> materialSumMap = new HashMap<>();
|
||||||
for(DepotItemVo4MaterialAndSum materialAndSum : batchList) {
|
for(DepotItemVo4MaterialAndSum materialAndSum : batchList) {
|
||||||
@@ -743,16 +750,16 @@ public class DepotItemService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新单据状态
|
* 更新单据状态
|
||||||
* @param depotHead
|
* @param linkStr
|
||||||
* @param billStatus
|
* @param billStatus
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public void changeBillStatus(DepotHead depotHead, String billStatus) {
|
public void changeBillStatus(String linkStr, String billStatus) {
|
||||||
DepotHead depotHeadOrders = new DepotHead();
|
DepotHead depotHeadOrders = new DepotHead();
|
||||||
depotHeadOrders.setStatus(billStatus);
|
depotHeadOrders.setStatus(billStatus);
|
||||||
DepotHeadExample example = new DepotHeadExample();
|
DepotHeadExample example = new DepotHeadExample();
|
||||||
List<String> linkNumberList = StringUtil.strToStringList(depotHead.getLinkNumber());
|
List<String> linkNoList = StringUtil.strToStringList(linkStr);
|
||||||
example.createCriteria().andNumberIn(linkNumberList);
|
example.createCriteria().andNumberIn(linkNoList);
|
||||||
try{
|
try{
|
||||||
depotHeadMapper.updateByExampleSelective(depotHeadOrders, example);
|
depotHeadMapper.updateByExampleSelective(depotHeadOrders, example);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
@@ -765,16 +772,16 @@ public class DepotItemService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新单据状态,此处针对销售订单转采购订单的场景
|
* 更新单据状态,此处针对销售订单转采购订单的场景
|
||||||
* @param depotHead
|
* @param linkStr
|
||||||
* @param billStatus
|
* @param billStatus
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public void changeBillPurchaseStatus(DepotHead depotHead, String billStatus) {
|
public void changeBillPurchaseStatus(String linkStr, String billStatus) {
|
||||||
DepotHead depotHeadOrders = new DepotHead();
|
DepotHead depotHeadOrders = new DepotHead();
|
||||||
depotHeadOrders.setPurchaseStatus(billStatus);
|
depotHeadOrders.setPurchaseStatus(billStatus);
|
||||||
DepotHeadExample example = new DepotHeadExample();
|
DepotHeadExample example = new DepotHeadExample();
|
||||||
List<String> linkNumberList = StringUtil.strToStringList(depotHead.getLinkNumber());
|
List<String> linkNoList = StringUtil.strToStringList(linkStr);
|
||||||
example.createCriteria().andNumberIn(linkNumberList);
|
example.createCriteria().andNumberIn(linkNoList);
|
||||||
try{
|
try{
|
||||||
depotHeadMapper.updateByExampleSelective(depotHeadOrders, example);
|
depotHeadMapper.updateByExampleSelective(depotHeadOrders, example);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
@@ -1085,7 +1092,7 @@ public class DepotItemService {
|
|||||||
Long linkId = id;
|
Long linkId = id;
|
||||||
String goToType = "";
|
String goToType = "";
|
||||||
DepotHead depotHead =depotHeadMapper.selectByPrimaryKey(headerId);
|
DepotHead depotHead =depotHeadMapper.selectByPrimaryKey(headerId);
|
||||||
String linkNumber = depotHead.getNumber(); //订单号
|
String linkStr = depotHead.getNumber(); //订单号
|
||||||
if("purchase".equals(linkType)) {
|
if("purchase".equals(linkType)) {
|
||||||
//针对以销定购的情况
|
//针对以销定购的情况
|
||||||
if(BusinessConstants.SUB_TYPE_SALES_ORDER.equals(depotHead.getSubType())) {
|
if(BusinessConstants.SUB_TYPE_SALES_ORDER.equals(depotHead.getSubType())) {
|
||||||
@@ -1117,7 +1124,11 @@ public class DepotItemService {
|
|||||||
goToType = BusinessConstants.SUB_TYPE_SALES_RETURN;
|
goToType = BusinessConstants.SUB_TYPE_SALES_RETURN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BigDecimal count = depotItemMapperEx.getFinishNumber(meId, linkId, linkNumber, goToType);
|
String noType = "normal";
|
||||||
|
if(linkStr.contains("QGD")) {
|
||||||
|
noType = "apply";
|
||||||
|
}
|
||||||
|
BigDecimal count = depotItemMapperEx.getFinishNumber(meId, linkId, linkStr, noType, goToType);
|
||||||
//根据多单位情况进行数量的转换
|
//根据多单位情况进行数量的转换
|
||||||
if(materialUnit.equals(unitInfo.getOtherUnit()) && unitInfo.getRatio()!=null && unitInfo.getRatio().compareTo(BigDecimal.ZERO)!=0) {
|
if(materialUnit.equals(unitInfo.getOtherUnit()) && unitInfo.getRatio()!=null && unitInfo.getRatio().compareTo(BigDecimal.ZERO)!=0) {
|
||||||
count = count.divide(unitInfo.getRatio(),2,BigDecimal.ROUND_HALF_UP);
|
count = count.divide(unitInfo.getRatio(),2,BigDecimal.ROUND_HALF_UP);
|
||||||
@@ -1146,8 +1157,12 @@ public class DepotItemService {
|
|||||||
public BigDecimal getRealFinishNumber(String currentSubType, Long meId, Long linkId, Long preHeaderId, Long currentHeaderId, Unit unitInfo, String materialUnit) {
|
public BigDecimal getRealFinishNumber(String currentSubType, Long meId, Long linkId, Long preHeaderId, Long currentHeaderId, Unit unitInfo, String materialUnit) {
|
||||||
String goToType = currentSubType;
|
String goToType = currentSubType;
|
||||||
DepotHead depotHead =depotHeadMapper.selectByPrimaryKey(preHeaderId);
|
DepotHead depotHead =depotHeadMapper.selectByPrimaryKey(preHeaderId);
|
||||||
String linkNumber = depotHead.getNumber(); //订单号
|
String linkStr = depotHead.getNumber(); //订单号
|
||||||
BigDecimal count = depotItemMapperEx.getRealFinishNumber(meId, linkId, linkNumber, currentHeaderId, goToType);
|
String linkType = "normal";
|
||||||
|
if(linkStr.contains("QGD")) {
|
||||||
|
linkType = "apply";
|
||||||
|
}
|
||||||
|
BigDecimal count = depotItemMapperEx.getRealFinishNumber(meId, linkId, linkStr, linkType, currentHeaderId, goToType);
|
||||||
//根据多单位情况进行数量的转换
|
//根据多单位情况进行数量的转换
|
||||||
if(materialUnit.equals(unitInfo.getOtherUnit()) && unitInfo.getRatio()!=null && unitInfo.getRatio().compareTo(BigDecimal.ZERO)!=0) {
|
if(materialUnit.equals(unitInfo.getOtherUnit()) && unitInfo.getRatio()!=null && unitInfo.getRatio().compareTo(BigDecimal.ZERO)!=0) {
|
||||||
count = count.divide(unitInfo.getRatio(),2,BigDecimal.ROUND_HALF_UP);
|
count = count.divide(unitInfo.getRatio(),2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
<result column="purchase_status" jdbcType="VARCHAR" property="purchaseStatus" />
|
<result column="purchase_status" jdbcType="VARCHAR" property="purchaseStatus" />
|
||||||
<result column="source" jdbcType="VARCHAR" property="source" />
|
<result column="source" jdbcType="VARCHAR" property="source" />
|
||||||
<result column="link_number" jdbcType="VARCHAR" property="linkNumber" />
|
<result column="link_number" jdbcType="VARCHAR" property="linkNumber" />
|
||||||
|
<result column="link_apply" jdbcType="VARCHAR" property="linkApply" />
|
||||||
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
|
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
|
||||||
<result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
|
<result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
@@ -97,7 +98,7 @@
|
|||||||
account_id, change_amount, back_amount, total_price, pay_type, bill_type, remark,
|
account_id, change_amount, back_amount, total_price, pay_type, bill_type, remark,
|
||||||
file_name, sales_man, account_id_list, account_money_list, discount, discount_money,
|
file_name, sales_man, account_id_list, account_money_list, discount, discount_money,
|
||||||
discount_last_money, other_money, deposit, status, purchase_status, source, link_number,
|
discount_last_money, other_money, deposit, status, purchase_status, source, link_number,
|
||||||
tenant_id, delete_flag
|
link_apply, tenant_id, delete_flag
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="BaseResultMap">
|
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
@@ -139,8 +140,8 @@
|
|||||||
account_id_list, account_money_list, discount,
|
account_id_list, account_money_list, discount,
|
||||||
discount_money, discount_last_money, other_money,
|
discount_money, discount_last_money, other_money,
|
||||||
deposit, status, purchase_status,
|
deposit, status, purchase_status,
|
||||||
source, link_number, tenant_id,
|
source, link_number, link_apply,
|
||||||
delete_flag)
|
tenant_id, delete_flag)
|
||||||
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{subType,jdbcType=VARCHAR},
|
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{subType,jdbcType=VARCHAR},
|
||||||
#{defaultNumber,jdbcType=VARCHAR}, #{number,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
#{defaultNumber,jdbcType=VARCHAR}, #{number,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
||||||
#{operTime,jdbcType=TIMESTAMP}, #{organId,jdbcType=BIGINT}, #{creator,jdbcType=BIGINT},
|
#{operTime,jdbcType=TIMESTAMP}, #{organId,jdbcType=BIGINT}, #{creator,jdbcType=BIGINT},
|
||||||
@@ -150,8 +151,8 @@
|
|||||||
#{accountIdList,jdbcType=VARCHAR}, #{accountMoneyList,jdbcType=VARCHAR}, #{discount,jdbcType=DECIMAL},
|
#{accountIdList,jdbcType=VARCHAR}, #{accountMoneyList,jdbcType=VARCHAR}, #{discount,jdbcType=DECIMAL},
|
||||||
#{discountMoney,jdbcType=DECIMAL}, #{discountLastMoney,jdbcType=DECIMAL}, #{otherMoney,jdbcType=DECIMAL},
|
#{discountMoney,jdbcType=DECIMAL}, #{discountLastMoney,jdbcType=DECIMAL}, #{otherMoney,jdbcType=DECIMAL},
|
||||||
#{deposit,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR}, #{purchaseStatus,jdbcType=VARCHAR},
|
#{deposit,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR}, #{purchaseStatus,jdbcType=VARCHAR},
|
||||||
#{source,jdbcType=VARCHAR}, #{linkNumber,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT},
|
#{source,jdbcType=VARCHAR}, #{linkNumber,jdbcType=VARCHAR}, #{linkApply,jdbcType=VARCHAR},
|
||||||
#{deleteFlag,jdbcType=VARCHAR})
|
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotHead">
|
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotHead">
|
||||||
insert into jsh_depot_head
|
insert into jsh_depot_head
|
||||||
@@ -243,6 +244,9 @@
|
|||||||
<if test="linkNumber != null">
|
<if test="linkNumber != null">
|
||||||
link_number,
|
link_number,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="linkApply != null">
|
||||||
|
link_apply,
|
||||||
|
</if>
|
||||||
<if test="tenantId != null">
|
<if test="tenantId != null">
|
||||||
tenant_id,
|
tenant_id,
|
||||||
</if>
|
</if>
|
||||||
@@ -338,6 +342,9 @@
|
|||||||
<if test="linkNumber != null">
|
<if test="linkNumber != null">
|
||||||
#{linkNumber,jdbcType=VARCHAR},
|
#{linkNumber,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="linkApply != null">
|
||||||
|
#{linkApply,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="tenantId != null">
|
<if test="tenantId != null">
|
||||||
#{tenantId,jdbcType=BIGINT},
|
#{tenantId,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
@@ -442,6 +449,9 @@
|
|||||||
<if test="record.linkNumber != null">
|
<if test="record.linkNumber != null">
|
||||||
link_number = #{record.linkNumber,jdbcType=VARCHAR},
|
link_number = #{record.linkNumber,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.linkApply != null">
|
||||||
|
link_apply = #{record.linkApply,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="record.tenantId != null">
|
<if test="record.tenantId != null">
|
||||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
@@ -484,6 +494,7 @@
|
|||||||
purchase_status = #{record.purchaseStatus,jdbcType=VARCHAR},
|
purchase_status = #{record.purchaseStatus,jdbcType=VARCHAR},
|
||||||
source = #{record.source,jdbcType=VARCHAR},
|
source = #{record.source,jdbcType=VARCHAR},
|
||||||
link_number = #{record.linkNumber,jdbcType=VARCHAR},
|
link_number = #{record.linkNumber,jdbcType=VARCHAR},
|
||||||
|
link_apply = #{record.linkApply,jdbcType=VARCHAR},
|
||||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||||
delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
|
delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
@@ -577,6 +588,9 @@
|
|||||||
<if test="linkNumber != null">
|
<if test="linkNumber != null">
|
||||||
link_number = #{linkNumber,jdbcType=VARCHAR},
|
link_number = #{linkNumber,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="linkApply != null">
|
||||||
|
link_apply = #{linkApply,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="tenantId != null">
|
<if test="tenantId != null">
|
||||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
@@ -616,6 +630,7 @@
|
|||||||
purchase_status = #{purchaseStatus,jdbcType=VARCHAR},
|
purchase_status = #{purchaseStatus,jdbcType=VARCHAR},
|
||||||
source = #{source,jdbcType=VARCHAR},
|
source = #{source,jdbcType=VARCHAR},
|
||||||
link_number = #{linkNumber,jdbcType=VARCHAR},
|
link_number = #{linkNumber,jdbcType=VARCHAR},
|
||||||
|
link_apply = #{linkApply,jdbcType=VARCHAR},
|
||||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||||
delete_flag = #{deleteFlag,jdbcType=VARCHAR}
|
delete_flag = #{deleteFlag,jdbcType=VARCHAR}
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
|
|||||||
@@ -944,8 +944,13 @@
|
|||||||
in
|
in
|
||||||
(
|
(
|
||||||
select dh.id from jsh_depot_head dh
|
select dh.id from jsh_depot_head dh
|
||||||
where
|
where 1=1
|
||||||
dh.link_number=#{linkNumber}
|
<if test="noType == 'normal'">
|
||||||
|
and dh.link_number=#{linkStr}
|
||||||
|
</if>
|
||||||
|
<if test="noType == 'apply'">
|
||||||
|
and dh.link_apply=#{linkStr}
|
||||||
|
</if>
|
||||||
and ifnull(dh.delete_flag,'0') !='1'
|
and ifnull(dh.delete_flag,'0') !='1'
|
||||||
<if test="goToType != null and goToType !=''">
|
<if test="goToType != null and goToType !=''">
|
||||||
and dh.sub_type=#{goToType}
|
and dh.sub_type=#{goToType}
|
||||||
@@ -963,8 +968,13 @@
|
|||||||
(
|
(
|
||||||
select dh.id from jsh_depot_head dh
|
select dh.id from jsh_depot_head dh
|
||||||
where
|
where
|
||||||
dh.link_number=#{linkNumber}
|
dh.id!=#{currentHeaderId}
|
||||||
and dh.id!=#{currentHeaderId}
|
<if test="linkType == 'normal'">
|
||||||
|
and dh.link_number=#{linkStr}
|
||||||
|
</if>
|
||||||
|
<if test="linkType == 'apply'">
|
||||||
|
and dh.link_apply=#{linkStr}
|
||||||
|
</if>
|
||||||
and ifnull(dh.delete_flag,'0') !='1'
|
and ifnull(dh.delete_flag,'0') !='1'
|
||||||
<if test="goToType != null and goToType !=''">
|
<if test="goToType != null and goToType !=''">
|
||||||
and dh.sub_type=#{goToType}
|
and dh.sub_type=#{goToType}
|
||||||
@@ -1017,7 +1027,7 @@
|
|||||||
<select id="getLinkBillDetailMaterialSum" resultMap="materialSumMap">
|
<select id="getLinkBillDetailMaterialSum" resultMap="materialSumMap">
|
||||||
select di.material_extend_id, sum(di.oper_number) oper_number from jsh_depot_head dh
|
select di.material_extend_id, sum(di.oper_number) oper_number from jsh_depot_head dh
|
||||||
left join jsh_depot_item di on dh.id=di.header_id and ifnull(di.delete_flag,'0') !='1'
|
left join jsh_depot_item di on dh.id=di.header_id and ifnull(di.delete_flag,'0') !='1'
|
||||||
where dh.number=#{linkNumber}
|
where dh.number=#{linkStr}
|
||||||
and ifnull(dh.delete_flag,'0') !='1'
|
and ifnull(dh.delete_flag,'0') !='1'
|
||||||
group by di.material_extend_id
|
group by di.material_extend_id
|
||||||
</select>
|
</select>
|
||||||
@@ -1025,7 +1035,13 @@
|
|||||||
<select id="getBatchBillDetailMaterialSum" resultMap="materialSumMap">
|
<select id="getBatchBillDetailMaterialSum" resultMap="materialSumMap">
|
||||||
select di.material_extend_id, sum(di.oper_number) oper_number from jsh_depot_head dh
|
select di.material_extend_id, sum(di.oper_number) oper_number from jsh_depot_head dh
|
||||||
left join jsh_depot_item di on dh.id=di.header_id and ifnull(di.delete_flag,'0') !='1'
|
left join jsh_depot_item di on dh.id=di.header_id and ifnull(di.delete_flag,'0') !='1'
|
||||||
where dh.link_number=#{linkNumber} and dh.type=#{type}
|
where dh.type=#{type}
|
||||||
|
<if test="linkType == 'normal'">
|
||||||
|
and dh.link_number=#{linkStr}
|
||||||
|
</if>
|
||||||
|
<if test="linkType == 'apply'">
|
||||||
|
and dh.link_apply=#{linkStr}
|
||||||
|
</if>
|
||||||
and ifnull(dh.delete_flag,'0') !='1'
|
and ifnull(dh.delete_flag,'0') !='1'
|
||||||
group by di.material_extend_id
|
group by di.material_extend_id
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
Reference in New Issue
Block a user