给单据增加sku字段

This commit is contained in:
季圣华 2021-07-28 00:54:30 +08:00
parent f073488317
commit 1f166552b2
9 changed files with 141 additions and 27 deletions

View File

@ -1176,4 +1176,11 @@ alter table jsh_depot_item drop column other_field1;
alter table jsh_depot_item drop column other_field2;
alter table jsh_depot_item drop column other_field3;
alter table jsh_depot_item drop column other_field4;
alter table jsh_depot_item drop column other_field5;
alter table jsh_depot_item drop column other_field5;
-- --------------------------------------------------------
-- 时间 2021年7月27日
-- by jishenghua
-- 移除机构表的全名字段
-- --------------------------------------------------------
alter table jsh_depot_item add sku varchar(50) DEFAULT NULL COMMENT '多属性' after material_unit;

View File

@ -185,6 +185,7 @@ public class DepotItemController {
}
item.put("stock", stock);
item.put("unit", diEx.getMaterialUnit());
item.put("sku", diEx.getSku());
item.put("operNumber", diEx.getOperNumber());
item.put("basicNumber", diEx.getBasicNumber());
item.put("unitPrice", diEx.getUnitPrice());

View File

@ -195,18 +195,17 @@ public class MaterialController {
item.put("standard", material.getStandard());
item.put("model", material.getModel());
item.put("unit", material.getCommodityUnit() + ratio);
if(depotId!=null) {
BigDecimal stock = depotItemService.getStockByParam(depotId,material.getId(),null,null,tenantId);
if (material.getUnitId()!=null){
Unit unit = unitService.getUnit(material.getUnitId());
if(material.getCommodityUnit().equals(unit.getOtherUnit())) {
if(unit.getRatio()!=0) {
stock = stock.divide(BigDecimal.valueOf(unit.getRatio()),2,BigDecimal.ROUND_HALF_UP);
}
item.put("sku", material.getSku());
BigDecimal stock = depotItemService.getStockByParam(depotId,material.getId(),null,null,tenantId);
if (material.getUnitId()!=null){
Unit unit = unitService.getUnit(material.getUnitId());
if(material.getCommodityUnit().equals(unit.getOtherUnit())) {
if(unit.getRatio()!=0) {
stock = stock.divide(BigDecimal.valueOf(unit.getRatio()),2,BigDecimal.ROUND_HALF_UP);
}
}
item.put("stock", stock);
}
item.put("stock", stock);
String expand = ""; //扩展信息
for (int i = 0; i < mpArr.length; i++) {
if (mpArr[i].equals("制造商")) {

View File

@ -13,6 +13,8 @@ public class DepotItem {
private String materialUnit;
private String sku;
private BigDecimal operNumber;
private BigDecimal basicNumber;
@ -81,6 +83,14 @@ public class DepotItem {
this.materialUnit = materialUnit == null ? null : materialUnit.trim();
}
public String getSku() {
return sku;
}
public void setSku(String sku) {
this.sku = sku == null ? null : sku.trim();
}
public BigDecimal getOperNumber() {
return operNumber;
}

View File

@ -415,6 +415,76 @@ public class DepotItemExample {
return (Criteria) this;
}
public Criteria andSkuIsNull() {
addCriterion("sku is null");
return (Criteria) this;
}
public Criteria andSkuIsNotNull() {
addCriterion("sku is not null");
return (Criteria) this;
}
public Criteria andSkuEqualTo(String value) {
addCriterion("sku =", value, "sku");
return (Criteria) this;
}
public Criteria andSkuNotEqualTo(String value) {
addCriterion("sku <>", value, "sku");
return (Criteria) this;
}
public Criteria andSkuGreaterThan(String value) {
addCriterion("sku >", value, "sku");
return (Criteria) this;
}
public Criteria andSkuGreaterThanOrEqualTo(String value) {
addCriterion("sku >=", value, "sku");
return (Criteria) this;
}
public Criteria andSkuLessThan(String value) {
addCriterion("sku <", value, "sku");
return (Criteria) this;
}
public Criteria andSkuLessThanOrEqualTo(String value) {
addCriterion("sku <=", value, "sku");
return (Criteria) this;
}
public Criteria andSkuLike(String value) {
addCriterion("sku like", value, "sku");
return (Criteria) this;
}
public Criteria andSkuNotLike(String value) {
addCriterion("sku not like", value, "sku");
return (Criteria) this;
}
public Criteria andSkuIn(List<String> values) {
addCriterion("sku in", values, "sku");
return (Criteria) this;
}
public Criteria andSkuNotIn(List<String> values) {
addCriterion("sku not in", values, "sku");
return (Criteria) this;
}
public Criteria andSkuBetween(String value1, String value2) {
addCriterion("sku between", value1, value2, "sku");
return (Criteria) this;
}
public Criteria andSkuNotBetween(String value1, String value2) {
addCriterion("sku not between", value1, value2, "sku");
return (Criteria) this;
}
public Criteria andOperNumberIsNull() {
addCriterion("oper_number is null");
return (Criteria) this;

View File

@ -34,6 +34,8 @@ public class MaterialVo4Unit extends Material{
private BigDecimal currentStockPrice;
private String sku;
public String getUnitName() {
return unitName;
}
@ -153,4 +155,12 @@ public class MaterialVo4Unit extends Material{
public void setCurrentStockPrice(BigDecimal currentStockPrice) {
this.currentStockPrice = currentStockPrice;
}
public String getSku() {
return sku;
}
public void setSku(String sku) {
this.sku = sku;
}
}

View File

@ -331,6 +331,7 @@ public class DepotItemService {
depotItem.setMaterialId(materialExtend.getMaterialId());
depotItem.setMaterialExtendId(materialExtend.getId());
depotItem.setMaterialUnit(rowObj.getString("unit"));
depotItem.setSku(rowObj.getString("sku"));
if (StringUtil.isExist(rowObj.get("operNumber"))) {
depotItem.setOperNumber(rowObj.getBigDecimal("operNumber"));
String unit = rowObj.get("unit").toString();

View File

@ -7,6 +7,7 @@
<result column="material_id" jdbcType="BIGINT" property="materialId" />
<result column="material_extend_id" jdbcType="BIGINT" property="materialExtendId" />
<result column="material_unit" jdbcType="VARCHAR" property="materialUnit" />
<result column="sku" jdbcType="VARCHAR" property="sku" />
<result column="oper_number" jdbcType="DECIMAL" property="operNumber" />
<result column="basic_number" jdbcType="DECIMAL" property="basicNumber" />
<result column="unit_price" jdbcType="DECIMAL" property="unitPrice" />
@ -81,9 +82,9 @@
</where>
</sql>
<sql id="Base_Column_List">
id, header_id, material_id, material_extend_id, material_unit, 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, tenant_id, delete_flag
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, tenant_id, delete_flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="BaseResultMap">
select
@ -117,19 +118,19 @@
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.DepotItem">
insert into jsh_depot_item (id, header_id, material_id,
material_extend_id, material_unit, 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, tenant_id,
delete_flag)
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,
tenant_id, delete_flag)
values (#{id,jdbcType=BIGINT}, #{headerId,jdbcType=BIGINT}, #{materialId,jdbcType=BIGINT},
#{materialExtendId,jdbcType=BIGINT}, #{materialUnit,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}, #{tenantId,jdbcType=BIGINT},
#{deleteFlag,jdbcType=VARCHAR})
#{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},
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotItem">
insert into jsh_depot_item
@ -149,6 +150,9 @@
<if test="materialUnit != null">
material_unit,
</if>
<if test="sku != null">
sku,
</if>
<if test="operNumber != null">
oper_number,
</if>
@ -208,6 +212,9 @@
<if test="materialUnit != null">
#{materialUnit,jdbcType=VARCHAR},
</if>
<if test="sku != null">
#{sku,jdbcType=VARCHAR},
</if>
<if test="operNumber != null">
#{operNumber,jdbcType=DECIMAL},
</if>
@ -276,6 +283,9 @@
<if test="record.materialUnit != null">
material_unit = #{record.materialUnit,jdbcType=VARCHAR},
</if>
<if test="record.sku != null">
sku = #{record.sku,jdbcType=VARCHAR},
</if>
<if test="record.operNumber != null">
oper_number = #{record.operNumber,jdbcType=DECIMAL},
</if>
@ -330,6 +340,7 @@
material_id = #{record.materialId,jdbcType=BIGINT},
material_extend_id = #{record.materialExtendId,jdbcType=BIGINT},
material_unit = #{record.materialUnit,jdbcType=VARCHAR},
sku = #{record.sku,jdbcType=VARCHAR},
oper_number = #{record.operNumber,jdbcType=DECIMAL},
basic_number = #{record.basicNumber,jdbcType=DECIMAL},
unit_price = #{record.unitPrice,jdbcType=DECIMAL},
@ -363,6 +374,9 @@
<if test="materialUnit != null">
material_unit = #{materialUnit,jdbcType=VARCHAR},
</if>
<if test="sku != null">
sku = #{sku,jdbcType=VARCHAR},
</if>
<if test="operNumber != null">
oper_number = #{operNumber,jdbcType=DECIMAL},
</if>
@ -414,6 +428,7 @@
material_id = #{materialId,jdbcType=BIGINT},
material_extend_id = #{materialExtendId,jdbcType=BIGINT},
material_unit = #{materialUnit,jdbcType=VARCHAR},
sku = #{sku,jdbcType=VARCHAR},
oper_number = #{operNumber,jdbcType=DECIMAL},
basic_number = #{basicNumber,jdbcType=DECIMAL},
unit_price = #{unitPrice,jdbcType=DECIMAL},

View File

@ -25,6 +25,7 @@
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultAndUnitMap" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
<result column="unit_name" jdbcType="VARCHAR" property="unitName" />
<result column="sku" jdbcType="VARCHAR" property="sku" />
</resultMap>
<select id="selectByConditionMaterial" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultMapList">
@ -124,7 +125,7 @@
</select>
<select id="findBySelectWithBarCode" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
select m.*,u.name unit_name,mc.name categoryName,me.bar_code m_bar_code,me.id meId,me.commodity_unit from jsh_material m
select m.*,u.name unit_name,mc.name categoryName,me.bar_code m_bar_code,me.id meId,me.commodity_unit,me.sku from jsh_material m
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
@ -302,7 +303,7 @@
<select id="getMaterialByBarCode" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
select m.*,u.name unit_name,me.bar_code m_bar_code, me.commodity_unit, me.purchase_decimal, me.commodity_decimal,
me.wholesale_decimal, me.low_decimal
me.wholesale_decimal, me.low_decimal, me.sku
from jsh_material m
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'