给单据增加订金字段和接口逻辑
This commit is contained in:
@@ -163,6 +163,7 @@ CREATE TABLE `jsh_depot_head` (
|
||||
`discount_money` decimal(24,6) DEFAULT NULL COMMENT '优惠金额',
|
||||
`discount_last_money` decimal(24,6) DEFAULT NULL COMMENT '优惠后金额',
|
||||
`other_money` decimal(24,6) DEFAULT NULL COMMENT '销售或采购费用合计',
|
||||
`deposit` decimal(24,6) DEFAULT NULL COMMENT '订金',
|
||||
`status` varchar(1) DEFAULT NULL COMMENT '状态,0未审核、1已审核、2完成采购|销售、3部分采购|销售',
|
||||
`purchase_status` varchar(1) DEFAULT NULL COMMENT '采购状态,0未采购、2完成采购、3部分采购',
|
||||
`link_number` varchar(50) DEFAULT NULL COMMENT '关联订单号',
|
||||
@@ -176,22 +177,22 @@ CREATE TABLE `jsh_depot_head` (
|
||||
-- ----------------------------
|
||||
-- Records of jsh_depot_head
|
||||
-- ----------------------------
|
||||
INSERT INTO `jsh_depot_head` VALUES ('258', '其它', '采购订单', 'CGDD00000000630', 'CGDD00000000630', '2021-06-02 00:21:54', '2021-06-02 00:21:44', '57', '63', null, null, null, '-110.000000', '现付', null, null, null, null, null, null, null, null, null, null, '2', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('259', '入库', '采购', 'CGRK00000000631', 'CGRK00000000631', '2021-06-02 00:22:23', '2021-06-02 00:22:05', '57', '63', '17', '-110.000000', null, '-110.000000', '现付', null, null, null, null, '', '', '0.000000', '0.000000', '110.000000', '0.000000', '0', '0', 'CGDD00000000630', '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('260', '出库', '采购退货', 'CGTH00000000632', 'CGTH00000000632', '2021-06-02 00:22:35', '2021-06-02 00:22:26', '57', '63', '17', '22.000000', null, '22.000000', '现付', null, null, null, null, null, null, '0.000000', '0.000000', '22.000000', '0.000000', '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('261', '其它', '销售订单', 'XSDD00000000633', 'XSDD00000000633', '2021-06-02 00:22:48', '2021-06-02 00:22:39', '58', '63', null, null, null, '44.000000', '现付', null, null, null, '', null, null, null, null, null, null, '2', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('262', '出库', '销售', 'XSCK00000000634', 'XSCK00000000634', '2021-06-02 00:23:03', '2021-06-02 00:22:54', '58', '63', '17', '44.000000', null, '44.000000', '现付', null, null, null, '', '', '', '0.000000', '0.000000', '44.000000', '0.000000', '0', '0', 'XSDD00000000633', '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('263', '入库', '销售退货', 'XSTH00000000635', 'XSTH00000000635', '2021-06-02 00:23:12', '2021-06-02 00:23:05', '71', '63', '17', '-22.000000', null, '-22.000000', '现付', null, null, null, '', '', '', '0.000000', '0.000000', '22.000000', '0.000000', '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('264', '出库', '零售', 'LSCK00000000636', 'LSCK00000000636', '2021-06-02 00:23:21', '2021-06-02 00:23:14', '60', '63', '17', '22.000000', null, '22.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('265', '入库', '零售退货', 'LSTH00000000637', 'LSTH00000000637', '2021-06-02 00:23:29', '2021-06-02 00:23:23', '60', '63', '17', '-22.000000', null, '-22.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('266', '入库', '其它', 'QTRK00000000638', 'QTRK00000000638', '2021-06-02 00:23:48', '2021-06-02 00:23:36', '57', '63', null, null, null, '-55.000000', '现付', null, null, null, null, null, null, null, null, null, null, '1', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('267', '出库', '其它', 'QTCK00000000639', 'QTCK00000000639', '2021-06-02 00:23:59', '2021-06-02 00:23:50', '58', '63', null, null, null, '30.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('268', '出库', '调拨', 'DBCK00000000640', 'DBCK00000000640', '2021-06-02 00:24:09', '2021-06-02 00:24:00', null, '63', null, null, null, '11.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('269', '其它', '组装单', 'ZZD00000000641', 'ZZD00000000641', '2021-06-02 00:24:29', '2021-06-02 00:24:11', null, '63', null, null, null, '0.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('270', '其它', '拆卸单', 'CXD00000000642', 'CXD00000000642', '2021-06-02 00:24:45', '2021-06-02 00:24:32', null, '63', null, null, null, '0.000000', '现付', null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('271', '入库', '采购', 'CGRK00000000651', 'CGRK00000000651', '2021-07-06 23:45:20', '2021-07-06 23:44:45', '57', '63', '17', '-20.000000', null, '-80.000000', '现付', null, null, null, null, '', '', '0.000000', '0.000000', '80.000000', '0.000000', '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('272', '出库', '销售', 'XSCK00000000652', 'XSCK00000000652', '2021-07-06 23:46:07', '2021-07-06 23:45:24', '58', '63', '17', '8.000000', null, '28.000000', '现付', null, null, null, '', '', '', '0.000000', '0.000000', '28.000000', '0.000000', '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('273', '入库', '采购', 'CGRK00000000658', 'CGRK00000000658', '2021-07-28 00:58:12', '2021-07-28 00:58:02', '57', '63', '17', '-60.000000', null, '-60.000000', '现付', null, null, null, null, '', '', '0.000000', '0.000000', '60.000000', '0.000000', '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('258', '其它', '采购订单', 'CGDD00000000630', 'CGDD00000000630', '2021-06-02 00:21:54', '2021-06-02 00:21:44', '57', '63', null, null, null, '-110.000000', '现付', null, null, null, null, null, null, null, null, null, null, null, '2', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('259', '入库', '采购', 'CGRK00000000631', 'CGRK00000000631', '2021-06-02 00:22:23', '2021-06-02 00:22:05', '57', '63', '17', '-110.000000', null, '-110.000000', '现付', null, null, null, null, '', '', '0.000000', '0.000000', '110.000000', '0.000000', null, '0', '0', 'CGDD00000000630', '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('260', '出库', '采购退货', 'CGTH00000000632', 'CGTH00000000632', '2021-06-02 00:22:35', '2021-06-02 00:22:26', '57', '63', '17', '22.000000', null, '22.000000', '现付', null, null, null, null, null, null, '0.000000', '0.000000', '22.000000', '0.000000', null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('261', '其它', '销售订单', 'XSDD00000000633', 'XSDD00000000633', '2021-06-02 00:22:48', '2021-06-02 00:22:39', '58', '63', null, null, null, '44.000000', '现付', null, null, null, '', null, null, null, null, null, null, null, '2', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('262', '出库', '销售', 'XSCK00000000634', 'XSCK00000000634', '2021-06-02 00:23:03', '2021-06-02 00:22:54', '58', '63', '17', '44.000000', null, '44.000000', '现付', null, null, null, '', '', '', '0.000000', '0.000000', '44.000000', '0.000000', null, '0', '0', 'XSDD00000000633', '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('263', '入库', '销售退货', 'XSTH00000000635', 'XSTH00000000635', '2021-06-02 00:23:12', '2021-06-02 00:23:05', '71', '63', '17', '-22.000000', null, '-22.000000', '现付', null, null, null, '', '', '', '0.000000', '0.000000', '22.000000', '0.000000', null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('264', '出库', '零售', 'LSCK00000000636', 'LSCK00000000636', '2021-06-02 00:23:21', '2021-06-02 00:23:14', '60', '63', '17', '22.000000', null, '22.000000', '现付', null, null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('265', '入库', '零售退货', 'LSTH00000000637', 'LSTH00000000637', '2021-06-02 00:23:29', '2021-06-02 00:23:23', '60', '63', '17', '-22.000000', null, '-22.000000', '现付', null, null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('266', '入库', '其它', 'QTRK00000000638', 'QTRK00000000638', '2021-06-02 00:23:48', '2021-06-02 00:23:36', '57', '63', null, null, null, '-55.000000', '现付', null, null, null, null, null, null, null, null, null, null, null, '1', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('267', '出库', '其它', 'QTCK00000000639', 'QTCK00000000639', '2021-06-02 00:23:59', '2021-06-02 00:23:50', '58', '63', null, null, null, '30.000000', '现付', null, null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('268', '出库', '调拨', 'DBCK00000000640', 'DBCK00000000640', '2021-06-02 00:24:09', '2021-06-02 00:24:00', null, '63', null, null, null, '11.000000', '现付', null, null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('269', '其它', '组装单', 'ZZD00000000641', 'ZZD00000000641', '2021-06-02 00:24:29', '2021-06-02 00:24:11', null, '63', null, null, null, '0.000000', '现付', null, null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('270', '其它', '拆卸单', 'CXD00000000642', 'CXD00000000642', '2021-06-02 00:24:45', '2021-06-02 00:24:32', null, '63', null, null, null, '0.000000', '现付', null, null, null, null, null, null, null, null, null, null, null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('271', '入库', '采购', 'CGRK00000000651', 'CGRK00000000651', '2021-07-06 23:45:20', '2021-07-06 23:44:45', '57', '63', '17', '-20.000000', null, '-80.000000', '现付', null, null, null, null, '', '', '0.000000', '0.000000', '80.000000', '0.000000', null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('272', '出库', '销售', 'XSCK00000000652', 'XSCK00000000652', '2021-07-06 23:46:07', '2021-07-06 23:45:24', '58', '63', '17', '8.000000', null, '28.000000', '现付', null, null, null, '', '', '', '0.000000', '0.000000', '28.000000', '0.000000', null, '0', '0', null, '63', '0');
|
||||
INSERT INTO `jsh_depot_head` VALUES ('273', '入库', '采购', 'CGRK00000000658', 'CGRK00000000658', '2021-07-28 00:58:12', '2021-07-28 00:58:02', '57', '63', '17', '-60.000000', null, '-60.000000', '现付', null, null, null, null, '', '', '0.000000', '0.000000', '60.000000', '0.000000', null, '0', '0', null, '63', '0');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for jsh_depot_item
|
||||
|
||||
@@ -1359,5 +1359,7 @@ update jsh_depot_head set purchase_status='0';
|
||||
-- 时间 2022年05月28日
|
||||
-- by jishenghua
|
||||
-- 给单据子表增加关联明细id
|
||||
-- 给单据主表增加订金字段
|
||||
-- --------------------------------------------------------
|
||||
alter table jsh_depot_item add link_id bigint(20) DEFAULT NULL COMMENT '关联明细id' after expiration_date;
|
||||
alter table jsh_depot_head add deposit decimal(24,6) DEFAULT NULL COMMENT '订金' after other_money;
|
||||
@@ -376,9 +376,12 @@ public class ExceptionConstants {
|
||||
//单据录入-商品的批号不能为空
|
||||
public static final int DEPOT_HEAD_BATCH_NUMBERE_EMPTY_CODE = 8000015;
|
||||
public static final String DEPOT_HEAD_BATCH_NUMBERE_EMPTY_MSG = "抱歉,商品条码:%s的批号不能为空";
|
||||
//单据录入-商品的批号重复
|
||||
public static final int DEPOT_HEAD_BATCH_NUMBERE_EXISTS_CODE = 8000016;
|
||||
public static final String DEPOT_HEAD_BATCH_NUMBERE_EXISTS_MSG = "抱歉,商品条码:%s的批号已存在";
|
||||
//单据录入-会员预付款余额不足
|
||||
public static final int DEPOT_HEAD_MEMBER_PAY_LACK_CODE = 8000016;
|
||||
public static final String DEPOT_HEAD_MEMBER_PAY_LACK_MSG = "抱歉,会员预付款余额不足";
|
||||
//单据录入-累计订金超出原订单中的订金
|
||||
public static final int DEPOT_HEAD_DEPOSIT_OVER_PRE_CODE = 8000017;
|
||||
public static final String DEPOT_HEAD_DEPOSIT_OVER_PRE_MSG = "抱歉,累计订金超出原订单中的订金";
|
||||
/**
|
||||
* 单据明细信息
|
||||
* type = 90
|
||||
|
||||
@@ -118,6 +118,8 @@ public class AccountController {
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if (null != dataList) {
|
||||
for (AccountVo4InOutList aEx : dataList) {
|
||||
String type = aEx.getType().replace("其它", "");
|
||||
aEx.setType(type);
|
||||
String timeStr = aEx.getOperTime().toString();
|
||||
BigDecimal balance = accountService.getAccountSum(accountId, timeStr, "date").add(accountService.getAccountSumByHead(accountId, timeStr, "date"))
|
||||
.add(accountService.getAccountSumByDetail(accountId, timeStr, "date")).add(accountService.getManyAccountSum(accountId, timeStr, "date")).add(initialAmount);
|
||||
|
||||
@@ -52,6 +52,8 @@ public class DepotHead {
|
||||
|
||||
private BigDecimal otherMoney;
|
||||
|
||||
private BigDecimal deposit;
|
||||
|
||||
private String status;
|
||||
|
||||
private String purchaseStatus;
|
||||
@@ -254,6 +256,14 @@ public class DepotHead {
|
||||
this.otherMoney = otherMoney;
|
||||
}
|
||||
|
||||
public BigDecimal getDeposit() {
|
||||
return deposit;
|
||||
}
|
||||
|
||||
public void setDeposit(BigDecimal deposit) {
|
||||
this.deposit = deposit;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -1656,6 +1656,66 @@ public class DepotHeadExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositIsNull() {
|
||||
addCriterion("deposit is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositIsNotNull() {
|
||||
addCriterion("deposit is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositEqualTo(BigDecimal value) {
|
||||
addCriterion("deposit =", value, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositNotEqualTo(BigDecimal value) {
|
||||
addCriterion("deposit <>", value, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositGreaterThan(BigDecimal value) {
|
||||
addCriterion("deposit >", value, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositGreaterThanOrEqualTo(BigDecimal value) {
|
||||
addCriterion("deposit >=", value, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositLessThan(BigDecimal value) {
|
||||
addCriterion("deposit <", value, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositLessThanOrEqualTo(BigDecimal value) {
|
||||
addCriterion("deposit <=", value, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositIn(List<BigDecimal> values) {
|
||||
addCriterion("deposit in", values, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositNotIn(List<BigDecimal> values) {
|
||||
addCriterion("deposit not in", values, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositBetween(BigDecimal value1, BigDecimal value2) {
|
||||
addCriterion("deposit between", value1, value2, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositNotBetween(BigDecimal value1, BigDecimal value2) {
|
||||
addCriterion("deposit not between", value1, value2, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusIsNull() {
|
||||
addCriterion("status is null");
|
||||
return (Criteria) this;
|
||||
|
||||
@@ -181,4 +181,11 @@ public interface DepotHeadMapperEx {
|
||||
@Param("endTime") String endTime,
|
||||
@Param("materialParam") String materialParam,
|
||||
@Param("depotArray") String[] depotArray);
|
||||
|
||||
BigDecimal getFinishDepositByNumber(
|
||||
@Param("number") String number);
|
||||
|
||||
BigDecimal getFinishDepositByNumberExceptCurrent(
|
||||
@Param("linkNumber") String linkNumber,
|
||||
@Param("number") String number);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ public class DepotHeadVo4List extends DepotHead{
|
||||
|
||||
private String address;
|
||||
|
||||
private BigDecimal finishDeposit;
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
@@ -146,4 +148,12 @@ public class DepotHeadVo4List extends DepotHead{
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public BigDecimal getFinishDeposit() {
|
||||
return finishDeposit;
|
||||
}
|
||||
|
||||
public void setFinishDeposit(BigDecimal finishDeposit) {
|
||||
this.finishDeposit = finishDeposit;
|
||||
}
|
||||
}
|
||||
@@ -135,6 +135,7 @@ public class DepotHeadService {
|
||||
if(dh.getDeposit() == null) {
|
||||
dh.setDeposit(BigDecimal.ZERO);
|
||||
}
|
||||
dh.setFinishDeposit(depotHeadMapperEx.getFinishDepositByNumber(dh.getNumber()));
|
||||
if(StringUtil.isNotEmpty(dh.getSalesMan())) {
|
||||
dh.setSalesManStr(personService.getPersonByMapAndIds(personMap,dh.getSalesMan()));
|
||||
}
|
||||
@@ -745,6 +746,16 @@ public class DepotHeadService {
|
||||
}
|
||||
depotHead.setAccountMoneyList(accountMoneyList);
|
||||
}
|
||||
//校验累计扣除订金是否超出订单中的金额
|
||||
if(depotHead.getDeposit()!=null && StringUtil.isNotEmpty(depotHead.getLinkNumber())) {
|
||||
BigDecimal finishDeposit = depotHeadMapperEx.getFinishDepositByNumberExceptCurrent(depotHead.getLinkNumber(), depotHead.getNumber());
|
||||
//订单中的订金金额
|
||||
BigDecimal preDeposit = getDepotHead(depotHead.getLinkNumber()).getChangeAmount().abs();
|
||||
if(depotHead.getDeposit().add(finishDeposit).compareTo(preDeposit)>0) {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_DEPOSIT_OVER_PRE_CODE,
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_DEPOSIT_OVER_PRE_MSG));
|
||||
}
|
||||
}
|
||||
try{
|
||||
depotHeadMapper.insertSelective(depotHead);
|
||||
}catch(Exception e){
|
||||
@@ -818,6 +829,16 @@ public class DepotHeadService {
|
||||
}
|
||||
depotHead.setAccountMoneyList(accountMoneyList);
|
||||
}
|
||||
//校验累计扣除订金是否超出订单中的金额
|
||||
if(depotHead.getDeposit()!=null && StringUtil.isNotEmpty(depotHead.getLinkNumber())) {
|
||||
BigDecimal finishDeposit = depotHeadMapperEx.getFinishDepositByNumberExceptCurrent(depotHead.getLinkNumber(), depotHead.getNumber());
|
||||
//订单中的订金金额
|
||||
BigDecimal preDeposit = getDepotHead(depotHead.getLinkNumber()).getChangeAmount().abs();
|
||||
if(depotHead.getDeposit().add(finishDeposit).compareTo(preDeposit)>0) {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_DEPOSIT_OVER_PRE_CODE,
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_DEPOSIT_OVER_PRE_MSG));
|
||||
}
|
||||
}
|
||||
try{
|
||||
depotHeadMapper.updateByPrimaryKeySelective(depotHead);
|
||||
}catch(Exception e){
|
||||
|
||||
@@ -414,8 +414,6 @@ public class DepotItemService {
|
||||
}
|
||||
}
|
||||
if (StringUtil.isExist(rowObj.get("batchNumber"))) {
|
||||
//校验录入的批号是否重复
|
||||
checkBatchNumberIsExist(depotHead.getType(), depotHead.getSubType(), materialExtend.getId(), rowObj.getString("batchNumber"), barCode);
|
||||
depotItem.setBatchNumber(rowObj.getString("batchNumber"));
|
||||
} else {
|
||||
//批号不能为空
|
||||
@@ -573,27 +571,6 @@ public class DepotItemService {
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_ROW_FAILED_MSG));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 校验录入的批号是否重复
|
||||
* @param type
|
||||
* @param subType
|
||||
* @param meId
|
||||
* @param batchNumber
|
||||
* @param barCode
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void checkBatchNumberIsExist(String type, String subType, Long meId, String batchNumber, String barCode) {
|
||||
if ((BusinessConstants.SUB_TYPE_PURCHASE.equals(subType) ||
|
||||
BusinessConstants.SUB_TYPE_OTHER.equals(subType) ||
|
||||
BusinessConstants.SUB_TYPE_SALES_RETURN.equals(subType)) &&
|
||||
BusinessConstants.DEPOTHEAD_TYPE_IN.equals(type)) {
|
||||
Long bnCount = depotItemMapperEx.getCountByMaterialAndBatchNumber(meId, batchNumber);
|
||||
if (bnCount > 0) {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EXISTS_CODE,
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EXISTS_MSG, barCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 判断单据的状态
|
||||
* 通过数组对比:原单据的商品和商品数量(汇总) 与 分批操作后单据的商品和商品数量(汇总)
|
||||
|
||||
@@ -424,8 +424,10 @@ public class SerialNumberService {
|
||||
serialNumber.setInBillNo(inBillNo);
|
||||
serialNumberMapper.insertSelective(serialNumber);
|
||||
} else {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_CODE,
|
||||
String.format(ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_MSG, sn));
|
||||
if(!inBillNo.equals(list.get(0).getInBillNo())) {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_CODE,
|
||||
String.format(ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_MSG, sn));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
<result column="discount_money" jdbcType="DECIMAL" property="discountMoney" />
|
||||
<result column="discount_last_money" jdbcType="DECIMAL" property="discountLastMoney" />
|
||||
<result column="other_money" jdbcType="DECIMAL" property="otherMoney" />
|
||||
<result column="deposit" jdbcType="DECIMAL" property="deposit" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="purchase_status" jdbcType="VARCHAR" property="purchaseStatus" />
|
||||
<result column="link_number" jdbcType="VARCHAR" property="linkNumber" />
|
||||
@@ -94,8 +95,8 @@
|
||||
id, type, sub_type, default_number, number, create_time, oper_time, organ_id, creator,
|
||||
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,
|
||||
discount_last_money, other_money, status, purchase_status, link_number, tenant_id,
|
||||
delete_flag
|
||||
discount_last_money, other_money, deposit, status, purchase_status, link_number,
|
||||
tenant_id, delete_flag
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -136,8 +137,9 @@
|
||||
remark, file_name, sales_man,
|
||||
account_id_list, account_money_list, discount,
|
||||
discount_money, discount_last_money, other_money,
|
||||
status, purchase_status, link_number,
|
||||
tenant_id, delete_flag)
|
||||
deposit, status, purchase_status,
|
||||
link_number, tenant_id, delete_flag
|
||||
)
|
||||
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{subType,jdbcType=VARCHAR},
|
||||
#{defaultNumber,jdbcType=VARCHAR}, #{number,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{operTime,jdbcType=TIMESTAMP}, #{organId,jdbcType=BIGINT}, #{creator,jdbcType=BIGINT},
|
||||
@@ -146,8 +148,9 @@
|
||||
#{remark,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR}, #{salesMan,jdbcType=VARCHAR},
|
||||
#{accountIdList,jdbcType=VARCHAR}, #{accountMoneyList,jdbcType=VARCHAR}, #{discount,jdbcType=DECIMAL},
|
||||
#{discountMoney,jdbcType=DECIMAL}, #{discountLastMoney,jdbcType=DECIMAL}, #{otherMoney,jdbcType=DECIMAL},
|
||||
#{status,jdbcType=VARCHAR}, #{purchaseStatus,jdbcType=VARCHAR}, #{linkNumber,jdbcType=VARCHAR},
|
||||
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
|
||||
#{deposit,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR}, #{purchaseStatus,jdbcType=VARCHAR},
|
||||
#{linkNumber,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotHead">
|
||||
insert into jsh_depot_head
|
||||
@@ -224,6 +227,9 @@
|
||||
<if test="otherMoney != null">
|
||||
other_money,
|
||||
</if>
|
||||
<if test="deposit != null">
|
||||
deposit,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status,
|
||||
</if>
|
||||
@@ -313,6 +319,9 @@
|
||||
<if test="otherMoney != null">
|
||||
#{otherMoney,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="deposit != null">
|
||||
#{deposit,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -411,6 +420,9 @@
|
||||
<if test="record.otherMoney != null">
|
||||
other_money = #{record.otherMoney,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.deposit != null">
|
||||
deposit = #{record.deposit,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.status != null">
|
||||
status = #{record.status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -457,6 +469,7 @@
|
||||
discount_money = #{record.discountMoney,jdbcType=DECIMAL},
|
||||
discount_last_money = #{record.discountLastMoney,jdbcType=DECIMAL},
|
||||
other_money = #{record.otherMoney,jdbcType=DECIMAL},
|
||||
deposit = #{record.deposit,jdbcType=DECIMAL},
|
||||
status = #{record.status,jdbcType=VARCHAR},
|
||||
purchase_status = #{record.purchaseStatus,jdbcType=VARCHAR},
|
||||
link_number = #{record.linkNumber,jdbcType=VARCHAR},
|
||||
@@ -538,6 +551,9 @@
|
||||
<if test="otherMoney != null">
|
||||
other_money = #{otherMoney,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="deposit != null">
|
||||
deposit = #{deposit,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -581,6 +597,7 @@
|
||||
discount_money = #{discountMoney,jdbcType=DECIMAL},
|
||||
discount_last_money = #{discountLastMoney,jdbcType=DECIMAL},
|
||||
other_money = #{otherMoney,jdbcType=DECIMAL},
|
||||
deposit = #{deposit,jdbcType=DECIMAL},
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
purchase_status = #{purchaseStatus,jdbcType=VARCHAR},
|
||||
link_number = #{linkNumber,jdbcType=VARCHAR},
|
||||
|
||||
@@ -680,8 +680,23 @@
|
||||
)
|
||||
</if>
|
||||
and (abs(dh.change_amount)+(select ifnull(sum(abs(ai.each_amount)),0) from jsh_account_item ai where ai.bill_id=dh.id and ifnull(ai.delete_flag,'0') !='1'))
|
||||
< (dh.discount_last_money + dh.other_money)
|
||||
< (dh.discount_last_money + dh.other_money - ifnull(dh.deposit,0))
|
||||
and ifnull(dh.delete_flag,'0') !='1'
|
||||
order by dh.id desc
|
||||
</select>
|
||||
|
||||
<select id="getFinishDepositByNumber" resultType="java.math.BigDecimal">
|
||||
select ifnull(sum(dh.deposit),0)
|
||||
from jsh_depot_head dh
|
||||
where dh.link_number=#{number}
|
||||
and ifnull(dh.delete_flag,'0') !='1'
|
||||
</select>
|
||||
|
||||
<select id="getFinishDepositByNumberExceptCurrent" resultType="java.math.BigDecimal">
|
||||
select ifnull(sum(dh.deposit),0)
|
||||
from jsh_depot_head dh
|
||||
where dh.link_number=#{linkNumber}
|
||||
and dh.number!=#{number}
|
||||
and ifnull(dh.delete_flag,'0') !='1'
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user