优化商品模块

This commit is contained in:
季圣华
2020-06-03 00:25:28 +08:00
parent 023c065e19
commit d344771c92
11 changed files with 58 additions and 42 deletions

View File

@@ -296,7 +296,7 @@ CREATE TABLE `jsh_depotitem` (
`TaxRate` decimal(24,6) DEFAULT NULL COMMENT '税率',
`TaxMoney` decimal(24,6) DEFAULT NULL COMMENT '税额',
`TaxLastMoney` decimal(24,6) DEFAULT NULL COMMENT '价税合计',
`OtherField1` varchar(50) DEFAULT NULL COMMENT '自定义字段1-',
`OtherField1` varchar(50) DEFAULT NULL COMMENT '自定义字段1-名',
`OtherField2` varchar(50) DEFAULT NULL COMMENT '自定义字段2-型号',
`OtherField3` varchar(50) DEFAULT NULL COMMENT '自定义字段3-制造商',
`OtherField4` varchar(50) DEFAULT NULL COMMENT '自定义字段4',
@@ -715,7 +715,7 @@ INSERT INTO `jsh_material_extend` VALUES ('2', '568', '1001', '个', '11.000000'
INSERT INTO `jsh_material_extend` VALUES ('3', '569', '1002', '', '10.000000', '15.000000', '15.000000', '13.000000', '1', '2020-02-20 23:45:15', 'jsh', 'jsh', '1582213514731', '63', '0');
INSERT INTO `jsh_material_extend` VALUES ('4', '570', '1003', '', '8.000000', '15.000000', '14.000000', '13.000000', '1', '2020-02-20 23:45:37', 'jsh', 'jsh', '1587657604430', '63', '0');
INSERT INTO `jsh_material_extend` VALUES ('5', '577', '1004', '', '10.000000', '20.000000', '20.000000', '20.000000', '1', '2020-02-20 23:46:36', 'jsh', 'jsh', '1582213596494', '63', '0');
INSERT INTO `jsh_material_extend` VALUES ('6', '577', '1005', '', '120.000000', '240.000000', '240.000000', '240.000000', '1', '2020-02-20 23:46:36', 'jsh', 'jsh', '1582213596497', '63', '0');
INSERT INTO `jsh_material_extend` VALUES ('6', '577', '1005', '', '120.000000', '240.000000', '240.000000', '240.000000', '0', '2020-02-20 23:46:36', 'jsh', 'jsh', '1582213596497', '63', '0');
INSERT INTO `jsh_material_extend` VALUES ('7', '579', '1006', '', '20.000000', '30.000000', '30.000000', '30.000000', '1', '2020-02-20 23:47:04', 'jsh', 'jsh', '1587784928581', '63', '0');
INSERT INTO `jsh_material_extend` VALUES ('8', '579', '1007', '', '240.000000', '360.000000', '360.000000', '360.000000', '0', '2020-02-20 23:47:04', 'jsh', 'jsh', '1587784928585', '63', '0');
INSERT INTO `jsh_material_extend` VALUES ('9', '586', '1008', '', '12.000000', '15.000000', '15.000000', '15.000000', '1', '2020-02-20 23:47:23', 'jsh', 'jsh', '1582213643084', '63', '0');

View File

@@ -423,7 +423,7 @@
columns:[[
{ title: '商品类型',field: 'MType',width:80, hidden:isShowMaterialTypeColumn},
{ title: depotHeadName,field: 'DepotName',editor:'validatebox',width:90},
{ title: '(型号)(扩展信息)(单位)',field: 'MaterialName',width:230},
{ title: '(型号)(扩展信息)(单位)',field: 'MaterialName',width:230},
{ title: anotherDepotHeadName,field: 'AnotherDepotName',hidden:isShowAnotherDepot,width:90},
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
@@ -434,7 +434,7 @@
{ title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
{ title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
{ title: '备注',field: 'Remark',editor:'validatebox',width:120},
{ title: '-',field: 'OtherField1',editor:'validatebox',hidden:otherColumns,width:60},
{ title: '-',field: 'OtherField1',editor:'validatebox',hidden:otherColumns,width:60},
{ title: '型号-',field: 'OtherField2',editor:'validatebox',hidden:otherColumns,width:60},
{ title: '颜色-',field: 'OtherField3',editor:'validatebox',hidden:otherColumns,width:60},
{ title: '备注1',field: 'OtherField4',editor:'validatebox',hidden:true,width:60},

View File

@@ -678,7 +678,7 @@
}
}
},
{ title: '条码_(规格)(型号)(扩展信息)(单位)',field: 'MaterialExtendId',width:270,
{ title: '条码_名(规格)(型号)(扩展信息)(单位)',field: 'MaterialExtendId',width:270,
formatter:function(value,row,index){
return row.MaterialName;
},
@@ -696,7 +696,7 @@
panelHeight: 380,//下拉框的高度
columns:[[
{field:'mBarCode',title:'条码',width:120},
{field:'name',title:'',width:140},
{field:'name',title:'',width:140},
{field:'standard',title:'规格',width:80},
{field:'model',title:'型号',width:80},
{field:'unit',title:'单位',width:60},
@@ -833,7 +833,7 @@
});
function materialSelect(rec) {
var body,footer,input; //定义表格和文本框
var ratio = 1; //比例-名专用
var ratio = 1; //比例-名专用
var loadRatio = 1; //在单位输入框上面加载比例字段
if(rec) {
var meId = rec.Id;
@@ -955,7 +955,7 @@
columns:[[
{ title: '商品类型',field: 'MType',width:80, hidden:isShowMaterialTypeColumn},
{ title: depotHeadName,field: 'DepotName',editor:'validatebox',width:90},
{ title: '条码_(规格)(型号)(扩展信息)(单位)',field: 'MaterialName',width:270},
{ title: '条码_名(规格)(型号)(扩展信息)(单位)',field: 'MaterialName',width:270},
{ title: '库存',field: 'Stock',width:50},
{ title: anotherDepotHeadName,field: 'AnotherDepotName',hidden:isShowAnotherDepot,width:90},
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},

View File

@@ -35,7 +35,13 @@
</div>
</div>
<div class="form-group">
<label class="control-label">品名</label>
<label class="control-label">条码</label>
<div class="control-inline">
<input type="text" id="searchBarCode" name="searchBarCode" value="" maxlength="100" class="easyui-textbox width-90"/>
</div>
</div>
<div class="form-group">
<label class="control-label">名称:</label>
<div class="control-inline">
<input type="text" id="searchName" name="searchName" value="" maxlength="100" class="easyui-textbox width-90"/>
</div>
@@ -72,7 +78,7 @@
<div title="基本信息" style="padding:20px;">
<table width="100%" style="min-width:1150px;">
<tr>
<td style="width:60px; height:30px;">名</td>
<td style="width:60px; height:30px;">名</td>
<td style="padding:5px;width:250px;">
<input name="Name" id="Name" class="easyui-textbox"
data-options="required:true,validType:'length[1,30]'"
@@ -464,12 +470,13 @@
return str;
}
},
{title: '品名', field: 'name', width: 120},
{title: '条码', field: 'mBarCode', width: 120},
{title: '名称', field: 'name', width: 120},
{title: '规格', field: 'standard', width: 80},
{title: '型号', field: 'model', width: 80},
{title: '类别', field: 'categoryName', width: 80},
{title: '扩展信息', field: 'materialOther', width: 150},
{title: '单位', field: 'unit', width: 100,
{title: '扩展信息', field: 'materialOther', width: 140},
{title: '单位', field: 'unit', width: 80,
formatter: function (value, rec) {
if(value) {
return value;
@@ -1192,7 +1199,7 @@
//保存信息
$("#saveMaterial").off("click").on("click", function () {
if (!$('#Name').val()) {
$.messager.alert('提示', '名不能为空!', 'warning');
$.messager.alert('提示', '名不能为空!', 'warning');
return;
}
if(!$("#Unit").val() && !$("#manyUnit").val()) {
@@ -1407,6 +1414,7 @@
});
function showMaterialDetails(pageNo, pageSize) {
var barCode = $.trim($("#searchBarCode").val());
var name = $.trim($("#searchName").val());
var standard = $.trim($("#searchStandard").val());
var model = $.trim($("#searchModel").val());
@@ -1416,6 +1424,7 @@
dataType: "json",
data: ({
search: JSON.stringify({
barCode: barCode,
name: name,
standard: standard,
model: model,
@@ -1443,6 +1452,7 @@
//重置按钮
$("#searchResetBtn").unbind().bind({
click: function () {
$("#searchBarCode").textbox("clear");
$("#searchParentName").textbox("clear");
$("#searchParentId").val("");
$("#searchName").textbox("clear");

View File

@@ -24,7 +24,7 @@
collapsible="true" closable="false">
<table id="searchForSelectTable">
<tr>
<td>名:</td>
<td>名</td>
<td>
<input name="searchForSelectName" id="searchForSelectName" style="width:80px;"/>
</td>
@@ -88,7 +88,7 @@
pageList: initPageNum,
columns: [[
{field: 'id', width: 35, align: "center", hidden: true},
{title: '名', field: 'name', width: 150},
{title: '名', field: 'name', width: 150},
{title: '型号', field: 'model', width: 100},
{title: '类别', field: 'categoryName', width: 130},
{title: '单位', field: 'unit', width: 60}

View File

@@ -170,7 +170,7 @@ public class DepotItemController {
ratio = diEx.getUName();
ratio = ratio.substring(ratio.indexOf("("));
}
//名/型号/扩展信息/包装
//名/型号/扩展信息/包装
String MaterialName = diEx.getBarCode() + "_" + ((diEx.getMName() == null || diEx.getMName().equals("")) ? "" : diEx.getMName())
+ ((diEx.getMStandard() == null || diEx.getMStandard().equals("")) ? "" : "(" + diEx.getMStandard() + ")")
+ ((diEx.getMModel() == null || diEx.getMModel().equals("")) ? "" : "(" + diEx.getMModel() + ")");

View File

@@ -161,7 +161,7 @@ public class MaterialController {
ratio = ratio.substring(ratio.indexOf("("));
}
}
//名/型号/扩展信息/包装
//名/型号/扩展信息/包装
String MaterialName = "";
String mBarCode = "";
if(material.getmBarCode()!=null) {
@@ -267,7 +267,7 @@ public class MaterialController {
ratio = material.getUnitName();
ratio = ratio.substring(ratio.indexOf("("));
}
//名/型号/扩展信息/包装
//名/型号/扩展信息/包装
String MaterialName = "";
MaterialName = MaterialName + material.getmBarCode() + "_" + material.getName()
+ ((material.getStandard() == null || material.getStandard().equals("")) ? "" : "(" + material.getStandard() + ")");
@@ -320,7 +320,7 @@ public class MaterialController {
try {
List<MaterialVo4Unit> dataList = materialService.findByAll(StringUtil.toNull(name), StringUtil.toNull(model),
StringUtil.toNull(categoryIds));
String[] names = {"", "类型", "型号", "安全存量", "单位", "零售价", "最低售价", "预计采购价", "批发价", "备注", "状态"};
String[] names = {"", "类型", "型号", "安全存量", "单位", "零售价", "最低售价", "预计采购价", "批发价", "备注", "状态"};
String title = "商品信息";
List<String[]> objects = new ArrayList<String[]>();
if (null != dataList) {

View File

@@ -18,6 +18,7 @@ import java.util.Map;
public interface MaterialMapperEx {
List<MaterialVo4Unit> selectByConditionMaterial(
@Param("barCode") String barCode,
@Param("name") String name,
@Param("standard") String standard,
@Param("model") String model,
@@ -27,6 +28,7 @@ public interface MaterialMapperEx {
@Param("rows") Integer rows);
Long countsByMaterial(
@Param("barCode") String barCode,
@Param("name") String name,
@Param("standard") String standard,
@Param("model") String model,

View File

@@ -32,23 +32,25 @@ public class MaterialComponent implements ICommonQuery {
private List<?> getMaterialList(Map<String, String> map) throws Exception{
String search = map.get(Constants.SEARCH);
String barCode = StringUtil.getInfo(search, "barCode");
String name = StringUtil.getInfo(search, "name");
String standard = StringUtil.getInfo(search, "standard");
String model = StringUtil.getInfo(search, "model");
String categoryIds = StringUtil.getInfo(search, "categoryIds");
String mpList = StringUtil.getInfo(search, "mpList");
return materialService.select(name, standard, model,categoryIds,mpList, QueryUtils.offset(map), QueryUtils.rows(map));
return materialService.select(barCode, name, standard, model,categoryIds,mpList, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
public Long counts(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String barCode = StringUtil.getInfo(search, "barCode");
String name = StringUtil.getInfo(search, "name");
String standard = StringUtil.getInfo(search, "standard");
String model = StringUtil.getInfo(search, "model");
String categoryIds = StringUtil.getInfo(search, "categoryIds");
String mpList = StringUtil.getInfo(search, "mpList");
return materialService.countMaterial(name, standard, model,categoryIds,mpList);
return materialService.countMaterial(barCode, name, standard, model,categoryIds,mpList);
}
@Override

View File

@@ -84,22 +84,17 @@ public class MaterialService {
return list;
}
public List<MaterialVo4Unit> select(String name, String standard, String model, String categoryIds,String mpList, int offset, int rows)
public List<MaterialVo4Unit> select(String barCode, String name, String standard, String model, String categoryIds,String mpList, int offset, int rows)
throws Exception{
String[] mpArr = mpList.split(",");
List<MaterialVo4Unit> resList = new ArrayList<MaterialVo4Unit>();
List<MaterialVo4Unit> resList = new ArrayList<>();
List<MaterialVo4Unit> list =null;
try{
list= materialMapperEx.selectByConditionMaterial(name, standard, model, categoryIds, mpList, offset, rows);
list= materialMapperEx.selectByConditionMaterial(barCode, name, standard, model, categoryIds, mpList, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
if (null != list) {
List<Long> idList = new ArrayList<Long>();
for (MaterialVo4Unit m : list) {
idList.add(m.getId());
}
List<MaterialExtend> meList = materialExtendService.getListByMIds(idList);
for (MaterialVo4Unit m : list) {
//扩展信息
String materialOther = "";
@@ -120,24 +115,16 @@ public class MaterialService {
m.setMaterialOther(materialOther);
Long tenantId = m.getTenantId();
m.setStock(depotItemService.getStockByParam(null,m.getId(),null,null,tenantId));
for(MaterialExtend me:meList) {
if(me.getMaterialId().longValue() == m.getId().longValue()) {
m.setPurchaseDecimal(me.getPurchaseDecimal()); //采购价
m.setCommodityDecimal(me.getCommodityDecimal()); //零售价
m.setWholesaleDecimal(me.getWholesaleDecimal()); //销售价
m.setLowDecimal(me.getLowDecimal()); //最低售价
}
}
resList.add(m);
}
}
return resList;
}
public Long countMaterial(String name, String standard, String model, String categoryIds,String mpList)throws Exception {
public Long countMaterial(String barCode, String name, String standard, String model, String categoryIds,String mpList)throws Exception {
Long result =null;
try{
result= materialMapperEx.countsByMaterial(name, standard, model, categoryIds, mpList);
result= materialMapperEx.countsByMaterial(barCode, name, standard, model, categoryIds, mpList);
}catch(Exception e){
JshException.readFail(logger, e);
}

View File

@@ -4,7 +4,11 @@
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultMapList" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
<result column="unitName" jdbcType="VARCHAR" property="unitName" />
<result column="categoryName" jdbcType="VARCHAR" property="categoryName" />
<result column="m_bar_code" jdbcType="VARCHAR" property="mBarCode" />
<result column="bar_code" jdbcType="VARCHAR" property="mBarCode" />
<result column="purchase_decimal" jdbcType="VARCHAR" property="purchaseDecimal" />
<result column="commodity_decimal" jdbcType="VARCHAR" property="commodityDecimal" />
<result column="wholesale_decimal" jdbcType="VARCHAR" property="wholesaleDecimal" />
<result column="low_decimal" jdbcType="VARCHAR" property="lowDecimal" />
</resultMap>
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultAndUnitMap" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
@@ -12,11 +16,17 @@
</resultMap>
<select id="selectByConditionMaterial" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultMapList">
select m.*,u.uname unitName, mc.name categoryName
select m.*,u.uname unitName, mc.name categoryName, me.bar_code,
me.purchase_decimal, me.commodity_decimal, me.wholesale_decimal,me.low_decimal
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.UnitId = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_materialcategory mc on m.CategoryId = mc.id and ifnull(mc.status,'0') !='2'
where 1=1
and me.default_flag=1
<if test="barCode != null">
and me.bar_code like '%${barCode}%'
</if>
<if test="name != null">
and m.name like '%${name}%'
</if>
@@ -40,9 +50,14 @@
SELECT
COUNT(m.id)
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.UnitId = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_materialcategory mc on m.CategoryId = mc.id and ifnull(mc.status,'0') !='2'
WHERE 1=1
and me.default_flag=1
<if test="barCode != null">
and me.bar_code like '%${barCode}%'
</if>
<if test="name != null">
and m.name like '%${name}%'
</if>