给单据明细增加采购单价字段

This commit is contained in:
季圣华 2022-10-02 16:57:05 +08:00
parent 1ed99c8ee1
commit 7a0d007705
6 changed files with 132 additions and 34 deletions

View File

@ -10,7 +10,7 @@ Target Server Type : MYSQL
Target Server Version : 50704
File Encoding : 65001
Date: 2022-08-26 00:10:15
Date: 2022-10-02 16:27:25
*/
SET FOREIGN_KEY_CHECKS=0;
@ -211,6 +211,7 @@ CREATE TABLE `jsh_depot_item` (
`oper_number` decimal(24,6) DEFAULT NULL COMMENT '数量',
`basic_number` decimal(24,6) DEFAULT NULL COMMENT '基础数量如kg、瓶',
`unit_price` decimal(24,6) DEFAULT NULL COMMENT '单价',
`purchase_unit_price` decimal(24,6) DEFAULT NULL COMMENT '采购单价',
`tax_unit_price` decimal(24,6) DEFAULT NULL COMMENT '含税单价',
`all_price` decimal(24,6) DEFAULT NULL COMMENT '金额',
`remark` varchar(200) DEFAULT NULL COMMENT '备注',
@ -236,24 +237,24 @@ CREATE TABLE `jsh_depot_item` (
-- ----------------------------
-- Records of jsh_depot_item
-- ----------------------------
INSERT INTO `jsh_depot_item` VALUES ('312', '258', '588', '10', '', null, '10.000000', '10.000000', '11.000000', null, '110.000000', null, '14', null, null, null, null, null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('313', '259', '588', '10', '', null, '10.000000', '10.000000', '11.000000', null, '110.000000', null, '14', null, null, '0.000000', '110.000000', null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('314', '260', '588', '10', '', null, '2.000000', '2.000000', '11.000000', '11.000000', '22.000000', null, '14', null, '0.000000', '0.000000', '22.000000', null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('315', '261', '588', '10', '', null, '2.000000', '2.000000', '22.000000', null, '44.000000', null, '14', null, null, null, null, null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('316', '262', '588', '10', '', null, '2.000000', '2.000000', '22.000000', null, '44.000000', null, '14', null, null, '0.000000', '44.000000', null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('317', '263', '588', '10', '', null, '1.000000', '1.000000', '22.000000', '22.000000', '22.000000', null, '14', null, '0.000000', '0.000000', '22.000000', null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('318', '264', '588', '10', '', null, '1.000000', '1.000000', '22.000000', null, '22.000000', null, '14', null, null, null, null, null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('319', '265', '588', '10', '', null, '1.000000', '1.000000', '22.000000', null, '22.000000', null, '14', null, null, null, null, null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('320', '266', '568', '2', '', null, '5.000000', '5.000000', '11.000000', null, '55.000000', null, '14', null, null, null, null, null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('321', '267', '568', '2', '', null, '2.000000', '2.000000', '15.000000', null, '30.000000', null, '14', null, null, null, null, null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('322', '268', '568', '2', '', null, '1.000000', '1.000000', '11.000000', null, '11.000000', null, '14', '15', null, null, null, null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('323', '269', '588', '10', '', null, '1.000000', '1.000000', '0.000000', null, '0.000000', null, '14', null, null, null, null, '组合件', null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('324', '269', '568', '2', '', null, '1.000000', '1.000000', '0.000000', null, '0.000000', null, '14', null, null, null, null, '普通子件', null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('325', '270', '588', '10', '', null, '1.000000', '1.000000', '0.000000', null, '0.000000', null, '14', null, null, null, null, '组合件', null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('326', '270', '568', '2', '', null, '1.000000', '1.000000', '0.000000', null, '0.000000', null, '14', null, null, null, null, '普通子件', null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('327', '271', '570', '4', '', null, '10.000000', '10.000000', '8.000000', '8.000000', '80.000000', null, '14', null, '0.000000', '0.000000', '80.000000', null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('328', '272', '570', '4', '', null, '2.000000', '2.000000', '14.000000', '14.000000', '28.000000', null, '14', null, '0.000000', '0.000000', '28.000000', null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('330', '273', '619', '37', '', '橙色,L', '5.000000', '5.000000', '12.000000', '12.000000', '60.000000', null, '14', null, '0.000000', '0.000000', '60.000000', null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('312', '258', '588', '10', '', null, '10.000000', '10.000000', '11.000000', null, null, '110.000000', null, '14', null, null, null, null, null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('313', '259', '588', '10', '', null, '10.000000', '10.000000', '11.000000', null, null, '110.000000', null, '14', null, null, '0.000000', '110.000000', null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('314', '260', '588', '10', '', null, '2.000000', '2.000000', '11.000000', null, '11.000000', '22.000000', null, '14', null, '0.000000', '0.000000', '22.000000', null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('315', '261', '588', '10', '', null, '2.000000', '2.000000', '22.000000', null, null, '44.000000', null, '14', null, null, null, null, null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('316', '262', '588', '10', '', null, '2.000000', '2.000000', '22.000000', null, null, '44.000000', null, '14', null, null, '0.000000', '44.000000', null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('317', '263', '588', '10', '', null, '1.000000', '1.000000', '22.000000', null, '22.000000', '22.000000', null, '14', null, '0.000000', '0.000000', '22.000000', null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('318', '264', '588', '10', '', null, '1.000000', '1.000000', '22.000000', null, null, '22.000000', null, '14', null, null, null, null, null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('319', '265', '588', '10', '', null, '1.000000', '1.000000', '22.000000', null, null, '22.000000', null, '14', null, null, null, null, null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('320', '266', '568', '2', '', null, '5.000000', '5.000000', '11.000000', null, null, '55.000000', null, '14', null, null, null, null, null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('321', '267', '568', '2', '', null, '2.000000', '2.000000', '15.000000', null, null, '30.000000', null, '14', null, null, null, null, null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('322', '268', '568', '2', '', null, '1.000000', '1.000000', '11.000000', null, null, '11.000000', null, '14', '15', null, null, null, null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('323', '269', '588', '10', '', null, '1.000000', '1.000000', '0.000000', null, null, '0.000000', null, '14', null, null, null, null, '组合件', null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('324', '269', '568', '2', '', null, '1.000000', '1.000000', '0.000000', null, null, '0.000000', null, '14', null, null, null, null, '普通子件', null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('325', '270', '588', '10', '', null, '1.000000', '1.000000', '0.000000', null, null, '0.000000', null, '14', null, null, null, null, '组合件', null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('326', '270', '568', '2', '', null, '1.000000', '1.000000', '0.000000', null, null, '0.000000', null, '14', null, null, null, null, '普通子件', null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('327', '271', '570', '4', '', null, '10.000000', '10.000000', '8.000000', null, '8.000000', '80.000000', null, '14', null, '0.000000', '0.000000', '80.000000', null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('328', '272', '570', '4', '', null, '2.000000', '2.000000', '14.000000', null, '14.000000', '28.000000', null, '14', null, '0.000000', '0.000000', '28.000000', null, null, null, null, null, '63', '0');
INSERT INTO `jsh_depot_item` VALUES ('330', '273', '619', '37', '', '橙色,L', '5.000000', '5.000000', '12.000000', null, '12.000000', '60.000000', null, '14', null, '0.000000', '0.000000', '60.000000', null, null, null, null, null, '63', '0');
-- ----------------------------
-- Table structure for jsh_function

View File

@ -1408,3 +1408,10 @@ alter table jsh_material_attribute drop column attribute_field;
-- --------------------------------------------------------
alter table jsh_material change remark remark varchar(500) DEFAULT NULL COMMENT '备注';
alter table jsh_account_head change remark remark varchar(1000) DEFAULT NULL COMMENT '备注';
-- --------------------------------------------------------
-- 时间 2022年10月2日
-- by jishenghua
-- 给单据明细增加采购单价字段
-- --------------------------------------------------------
alter table jsh_depot_item add purchase_unit_price decimal(24,6) DEFAULT NULL COMMENT '采购单价' after unit_price;

View File

@ -22,6 +22,8 @@ public class DepotItem {
private BigDecimal unitPrice;
private BigDecimal purchaseUnitPrice;
private BigDecimal taxUnitPrice;
private BigDecimal allPrice;
@ -124,6 +126,14 @@ public class DepotItem {
this.unitPrice = unitPrice;
}
public BigDecimal getPurchaseUnitPrice() {
return purchaseUnitPrice;
}
public void setPurchaseUnitPrice(BigDecimal purchaseUnitPrice) {
this.purchaseUnitPrice = purchaseUnitPrice;
}
public BigDecimal getTaxUnitPrice() {
return taxUnitPrice;
}

View File

@ -666,6 +666,66 @@ public class DepotItemExample {
return (Criteria) this;
}
public Criteria andPurchaseUnitPriceIsNull() {
addCriterion("purchase_unit_price is null");
return (Criteria) this;
}
public Criteria andPurchaseUnitPriceIsNotNull() {
addCriterion("purchase_unit_price is not null");
return (Criteria) this;
}
public Criteria andPurchaseUnitPriceEqualTo(BigDecimal value) {
addCriterion("purchase_unit_price =", value, "purchaseUnitPrice");
return (Criteria) this;
}
public Criteria andPurchaseUnitPriceNotEqualTo(BigDecimal value) {
addCriterion("purchase_unit_price <>", value, "purchaseUnitPrice");
return (Criteria) this;
}
public Criteria andPurchaseUnitPriceGreaterThan(BigDecimal value) {
addCriterion("purchase_unit_price >", value, "purchaseUnitPrice");
return (Criteria) this;
}
public Criteria andPurchaseUnitPriceGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("purchase_unit_price >=", value, "purchaseUnitPrice");
return (Criteria) this;
}
public Criteria andPurchaseUnitPriceLessThan(BigDecimal value) {
addCriterion("purchase_unit_price <", value, "purchaseUnitPrice");
return (Criteria) this;
}
public Criteria andPurchaseUnitPriceLessThanOrEqualTo(BigDecimal value) {
addCriterion("purchase_unit_price <=", value, "purchaseUnitPrice");
return (Criteria) this;
}
public Criteria andPurchaseUnitPriceIn(List<BigDecimal> values) {
addCriterion("purchase_unit_price in", values, "purchaseUnitPrice");
return (Criteria) this;
}
public Criteria andPurchaseUnitPriceNotIn(List<BigDecimal> values) {
addCriterion("purchase_unit_price not in", values, "purchaseUnitPrice");
return (Criteria) this;
}
public Criteria andPurchaseUnitPriceBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("purchase_unit_price between", value1, value2, "purchaseUnitPrice");
return (Criteria) this;
}
public Criteria andPurchaseUnitPriceNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("purchase_unit_price not between", value1, value2, "purchaseUnitPrice");
return (Criteria) this;
}
public Criteria andTaxUnitPriceIsNull() {
addCriterion("tax_unit_price is null");
return (Criteria) this;

View File

@ -525,6 +525,11 @@ public class DepotItemService {
}
}
}
//如果是销售出库单则给采购单价字段赋值
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType()) &&
BusinessConstants.SUB_TYPE_SALES.equals(depotHead.getSubType())) {
depotItem.setPurchaseUnitPrice(materialExtend.getPurchaseDecimal());
}
if (StringUtil.isExist(rowObj.get("taxUnitPrice"))) {
depotItem.setTaxUnitPrice(rowObj.getBigDecimal("taxUnitPrice"));
}

View File

@ -11,6 +11,7 @@
<result column="oper_number" jdbcType="DECIMAL" property="operNumber" />
<result column="basic_number" jdbcType="DECIMAL" property="basicNumber" />
<result column="unit_price" jdbcType="DECIMAL" property="unitPrice" />
<result column="purchase_unit_price" jdbcType="DECIMAL" property="purchaseUnitPrice" />
<result column="tax_unit_price" jdbcType="DECIMAL" property="taxUnitPrice" />
<result column="all_price" jdbcType="DECIMAL" property="allPrice" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
@ -87,9 +88,9 @@
</sql>
<sql id="Base_Column_List">
id, header_id, material_id, material_extend_id, material_unit, sku, oper_number,
basic_number, unit_price, tax_unit_price, all_price, remark, depot_id, another_depot_id,
tax_rate, tax_money, tax_last_money, material_type, sn_list, batch_number, expiration_date,
link_id, tenant_id, delete_flag
basic_number, unit_price, purchase_unit_price, tax_unit_price, all_price, remark,
depot_id, another_depot_id, tax_rate, tax_money, tax_last_money, material_type, sn_list,
batch_number, expiration_date, link_id, tenant_id, delete_flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="BaseResultMap">
select
@ -125,21 +126,21 @@
insert into jsh_depot_item (id, header_id, material_id,
material_extend_id, material_unit, sku,
oper_number, basic_number, unit_price,
tax_unit_price, all_price, remark,
depot_id, another_depot_id, tax_rate,
tax_money, tax_last_money, material_type,
sn_list, batch_number, expiration_date,
link_id, tenant_id, delete_flag
)
purchase_unit_price, tax_unit_price, all_price,
remark, depot_id, another_depot_id,
tax_rate, tax_money, tax_last_money,
material_type, sn_list, batch_number,
expiration_date, link_id, tenant_id,
delete_flag)
values (#{id,jdbcType=BIGINT}, #{headerId,jdbcType=BIGINT}, #{materialId,jdbcType=BIGINT},
#{materialExtendId,jdbcType=BIGINT}, #{materialUnit,jdbcType=VARCHAR}, #{sku,jdbcType=VARCHAR},
#{operNumber,jdbcType=DECIMAL}, #{basicNumber,jdbcType=DECIMAL}, #{unitPrice,jdbcType=DECIMAL},
#{taxUnitPrice,jdbcType=DECIMAL}, #{allPrice,jdbcType=DECIMAL}, #{remark,jdbcType=VARCHAR},
#{depotId,jdbcType=BIGINT}, #{anotherDepotId,jdbcType=BIGINT}, #{taxRate,jdbcType=DECIMAL},
#{taxMoney,jdbcType=DECIMAL}, #{taxLastMoney,jdbcType=DECIMAL}, #{materialType,jdbcType=VARCHAR},
#{snList,jdbcType=VARCHAR}, #{batchNumber,jdbcType=VARCHAR}, #{expirationDate,jdbcType=TIMESTAMP},
#{linkId,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
)
#{purchaseUnitPrice,jdbcType=DECIMAL}, #{taxUnitPrice,jdbcType=DECIMAL}, #{allPrice,jdbcType=DECIMAL},
#{remark,jdbcType=VARCHAR}, #{depotId,jdbcType=BIGINT}, #{anotherDepotId,jdbcType=BIGINT},
#{taxRate,jdbcType=DECIMAL}, #{taxMoney,jdbcType=DECIMAL}, #{taxLastMoney,jdbcType=DECIMAL},
#{materialType,jdbcType=VARCHAR}, #{snList,jdbcType=VARCHAR}, #{batchNumber,jdbcType=VARCHAR},
#{expirationDate,jdbcType=TIMESTAMP}, #{linkId,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT},
#{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotItem">
insert into jsh_depot_item
@ -171,6 +172,9 @@
<if test="unitPrice != null">
unit_price,
</if>
<if test="purchaseUnitPrice != null">
purchase_unit_price,
</if>
<if test="taxUnitPrice != null">
tax_unit_price,
</if>
@ -245,6 +249,9 @@
<if test="unitPrice != null">
#{unitPrice,jdbcType=DECIMAL},
</if>
<if test="purchaseUnitPrice != null">
#{purchaseUnitPrice,jdbcType=DECIMAL},
</if>
<if test="taxUnitPrice != null">
#{taxUnitPrice,jdbcType=DECIMAL},
</if>
@ -328,6 +335,9 @@
<if test="record.unitPrice != null">
unit_price = #{record.unitPrice,jdbcType=DECIMAL},
</if>
<if test="record.purchaseUnitPrice != null">
purchase_unit_price = #{record.purchaseUnitPrice,jdbcType=DECIMAL},
</if>
<if test="record.taxUnitPrice != null">
tax_unit_price = #{record.taxUnitPrice,jdbcType=DECIMAL},
</if>
@ -389,6 +399,7 @@
oper_number = #{record.operNumber,jdbcType=DECIMAL},
basic_number = #{record.basicNumber,jdbcType=DECIMAL},
unit_price = #{record.unitPrice,jdbcType=DECIMAL},
purchase_unit_price = #{record.purchaseUnitPrice,jdbcType=DECIMAL},
tax_unit_price = #{record.taxUnitPrice,jdbcType=DECIMAL},
all_price = #{record.allPrice,jdbcType=DECIMAL},
remark = #{record.remark,jdbcType=VARCHAR},
@ -435,6 +446,9 @@
<if test="unitPrice != null">
unit_price = #{unitPrice,jdbcType=DECIMAL},
</if>
<if test="purchaseUnitPrice != null">
purchase_unit_price = #{purchaseUnitPrice,jdbcType=DECIMAL},
</if>
<if test="taxUnitPrice != null">
tax_unit_price = #{taxUnitPrice,jdbcType=DECIMAL},
</if>
@ -493,6 +507,7 @@
oper_number = #{operNumber,jdbcType=DECIMAL},
basic_number = #{basicNumber,jdbcType=DECIMAL},
unit_price = #{unitPrice,jdbcType=DECIMAL},
purchase_unit_price = #{purchaseUnitPrice,jdbcType=DECIMAL},
tax_unit_price = #{taxUnitPrice,jdbcType=DECIMAL},
all_price = #{allPrice,jdbcType=DECIMAL},
remark = #{remark,jdbcType=VARCHAR},