增加商品条码功能
This commit is contained in:
@@ -696,4 +696,40 @@ DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
|
||||
COMMENT='产品初始库存'
|
||||
AUTO_INCREMENT=48
|
||||
ROW_FORMAT=COMPACT
|
||||
;
|
||||
;
|
||||
|
||||
-- ----------------------------
|
||||
-- 增加商品扩展信息表
|
||||
-- 时间 2020-02-15
|
||||
-- by jishenghua
|
||||
-- ----------------------------
|
||||
CREATE TABLE `jsh_material_extend` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键' ,
|
||||
`material_id` bigint(20) NULL DEFAULT NULL COMMENT '商品id' ,
|
||||
`bar_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商品条码' ,
|
||||
`commodity_unit` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商品单位' ,
|
||||
`purchase_decimal` decimal(24,6) NULL DEFAULT NULL COMMENT '采购价格' ,
|
||||
`commodity_decimal` decimal(24,6) NULL DEFAULT NULL COMMENT '零售价格' ,
|
||||
`wholesale_decimal` decimal(24,6) NULL DEFAULT NULL COMMENT '销售价格' ,
|
||||
`low_decimal` decimal(24,6) NULL DEFAULT NULL COMMENT '最低售价' ,
|
||||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建日期' ,
|
||||
`create_serial` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人编码' ,
|
||||
`update_serial` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人编码' ,
|
||||
`update_time` bigint(20) NULL DEFAULT NULL COMMENT '更新时间戳' ,
|
||||
`tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户id' ,
|
||||
`delete_Flag` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标记,0未删除,1删除' ,
|
||||
PRIMARY KEY (`id`)
|
||||
)
|
||||
ENGINE=InnoDB
|
||||
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
|
||||
COMMENT='产品价格扩展'
|
||||
AUTO_INCREMENT=1
|
||||
ROW_FORMAT=COMPACT
|
||||
;
|
||||
|
||||
-- ----------------------------
|
||||
-- 给单据明细表增加商品扩展id
|
||||
-- 时间 2020-02-16
|
||||
-- by jishenghua
|
||||
-- ----------------------------
|
||||
alter table jsh_depotitem add material_extend_id bigint(20) DEFAULT NULL COMMENT '商品扩展id' after MaterialId;
|
||||
@@ -4,7 +4,7 @@
|
||||
}
|
||||
|
||||
.easyui-dialog .fitem label{
|
||||
width:60px;
|
||||
width:80px;
|
||||
float:left;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,31 @@
|
||||
return o;
|
||||
};
|
||||
|
||||
/**
|
||||
* 扩展datagrid的editors方法,支持combogrid
|
||||
*/
|
||||
$.extend($.fn.datagrid.defaults.editors, {
|
||||
combogrid: {
|
||||
init: function (container, options) {
|
||||
var input = $('<input type="text" style="height: 22px;" class="datagrid-editable-input">').appendTo(container);
|
||||
input.combogrid(options);
|
||||
return input;
|
||||
},
|
||||
destroy: function (target) {
|
||||
$(target).combogrid('destroy');
|
||||
},
|
||||
getValue: function (target) {
|
||||
return $(target).combogrid('getValue');
|
||||
},
|
||||
setValue: function (target, value) {
|
||||
$(target).combogrid('setValue', value);
|
||||
},
|
||||
resize: function (target, width) {
|
||||
$(target).combogrid('resize', width);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(function() {
|
||||
domresize();
|
||||
});
|
||||
|
||||
@@ -533,23 +533,25 @@
|
||||
dgResize();
|
||||
}
|
||||
//查找库存的方法
|
||||
function findStockNumById(depotId, mId, monthTime, body, input, ratio, type){
|
||||
function findStockNumById(depotId, meId, monthTime, body, input, ratio, type){
|
||||
var thisRatio = 1; //比例
|
||||
$.ajax({
|
||||
url: "/material/findById",
|
||||
url: "/material/findByIdWithBarCode",
|
||||
type: "get",
|
||||
dataType: "json",
|
||||
data: {
|
||||
id: mId
|
||||
meId: meId
|
||||
},
|
||||
success: function (rec) {
|
||||
if(rec && rec.code === 200 && rec.data && rec.data[0]) {
|
||||
if(rec && rec.code === 200) {
|
||||
var info = rec.data;
|
||||
var commodityUnit = info.commodityUnit; //商品单位
|
||||
var loadRatio = 1; //在单位输入框上面加载比例字段
|
||||
if(rec.data[0].unit) { //如果存在计量单位信息
|
||||
if(info.unit) { //如果存在计量单位信息
|
||||
loadRatio = 1;
|
||||
}
|
||||
else{
|
||||
var unitName = rec.data[0].unitName;
|
||||
var unitName = info.unitName;
|
||||
if(unitName) {
|
||||
thisRatio = unitName.substring(unitName.indexOf(":")+1).replace(")","");
|
||||
unitName = unitName.substring(0, unitName.indexOf("("));
|
||||
@@ -557,24 +559,11 @@
|
||||
var unitArr = unitName.split(",");
|
||||
var basicUnit = unitArr[0]; //基础单位
|
||||
var otherUnit = unitArr[1]; //副单位
|
||||
var unitSetInput =""; //单位
|
||||
if(listSubType === "采购订单" || listSubType === "采购" || listSubType === "采购退货"){
|
||||
unitSetInput = rec.data[0].firstinunit;
|
||||
if(basicUnit==unitSetInput){ //基础单位等于选择的单位
|
||||
loadRatio = 1;
|
||||
}
|
||||
else if(otherUnit==unitSetInput){ //副单位等于选择的单位
|
||||
loadRatio = thisRatio;
|
||||
}
|
||||
if(basicUnit==commodityUnit){ //基础单位等于选择的单位
|
||||
loadRatio = 1;
|
||||
}
|
||||
else if(listSubType === "销售订单" || listSubType === "销售" || listSubType === "销售退货" || listSubType === "零售" || listSubType === "零售退货"){
|
||||
unitSetInput = rec.data[0].firstoutunit;
|
||||
if(basicUnit==unitSetInput){ //基础单位等于选择的单位
|
||||
loadRatio = 1;
|
||||
}
|
||||
else if(otherUnit==unitSetInput){ //副单位等于选择的单位
|
||||
loadRatio = thisRatio;
|
||||
}
|
||||
else if(otherUnit==commodityUnit){ //副单位等于选择的单位
|
||||
loadRatio = thisRatio;
|
||||
}
|
||||
}
|
||||
//查询库存
|
||||
@@ -583,7 +572,7 @@
|
||||
url: '/depotItem/findStockNumById',
|
||||
data:{
|
||||
depotId: depotId,
|
||||
mId: mId
|
||||
mId: info.id
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
@@ -721,7 +710,7 @@
|
||||
body =$("#depotHeadFM .datagrid-body");
|
||||
footer =$("#depotHeadFM .datagrid-footer");
|
||||
input = ".datagrid-editable-input";
|
||||
var mId = body.find("[field='MaterialId']").find(".combo-value").val();
|
||||
var mId = body.find("[field='MaterialExtendId']").find(".combo-value").val();
|
||||
if(mId){
|
||||
var type = "select"; //type 类型:点击 click,选择 select
|
||||
findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
||||
@@ -730,37 +719,71 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '品名(型号)(扩展信息)(单位)',field: 'MaterialId',width:230,
|
||||
{ title: '条码_品名(规格)(型号)(扩展信息)(单位)',field: 'MaterialExtendId',width:270,
|
||||
formatter:function(value,row,index){
|
||||
return row.MaterialName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'MaterialName',
|
||||
method:'get',
|
||||
url: "/material/findBySelect",
|
||||
panelWidth: 300, //下拉框的宽度
|
||||
//全面模糊匹配,过滤字段
|
||||
filter: function(q, row){
|
||||
var opts = $(this).combobox('options');
|
||||
return row[opts.textField].indexOf(q) >-1;
|
||||
},
|
||||
type:'combogrid',
|
||||
options:{
|
||||
url: "/material/findBySelect",
|
||||
idField:'Id',
|
||||
textField:'MaterialName',
|
||||
method:'get',
|
||||
pagination: true,
|
||||
mode: 'remote',
|
||||
hasDownArrow: false,
|
||||
panelWidth: 630, //下拉框的宽度
|
||||
panelHeight: 380,//下拉框的高度
|
||||
columns:[[
|
||||
{field:'mBarCode',title:'条码',width:120},
|
||||
{field:'name',title:'品名',width:140},
|
||||
{field:'standard',title:'规格',width:80},
|
||||
{field:'model',title:'型号',width:80},
|
||||
{field:'unit',title:'单位',width:60},
|
||||
{field:'stock',title:'库存',width:50},
|
||||
{field:'expand',title:'扩展信息',width:80}
|
||||
]],
|
||||
onBeforeLoad: function(param){
|
||||
var edDepot = $('#materialData').datagrid('getEditor', {index:editIndex,field:'DepotId'});
|
||||
if(edDepot) {
|
||||
param.depotId = $(edDepot.target).combobox('getValue');
|
||||
}
|
||||
param.mpList = mPropertyList; //商品属性
|
||||
},
|
||||
onSelect:function(rec){
|
||||
var materialId = $("#depotHeadFM .datagrid-body")
|
||||
.find("[field='MaterialId']").find(".datagrid-editable-input").val();
|
||||
if(materialId !=rec.Id) {
|
||||
materialSelect(rec);
|
||||
onLoadSuccess: function (rec) {
|
||||
if(rec && rec.total==1) {
|
||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||
}
|
||||
//分页后判断下是否有选中的数据行,combogrid会依据上一次选中的值进行初始化,选中datagrid数据行和设置显示值
|
||||
var edMaterial = $('#materialData').datagrid('getEditor', {index:editIndex,field:'MaterialExtendId'});
|
||||
var comboText = $(edMaterial.target).next().find('input.combo-text');
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: '/material/getMaterialByMeId',
|
||||
data: {
|
||||
meId: comboText.val(),
|
||||
mpList: mPropertyList
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if (res && res.MaterialName) {
|
||||
$(edMaterial.target).next().find('input.combo-text').val(res.MaterialName);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onSelect:function(index, rowData){
|
||||
// var materialExtendId = $("#depotHeadFM .datagrid-body")
|
||||
// .find("[field='MaterialExtendId']").find(".datagrid-editable-input").val();
|
||||
// if(materialExtendId !=rowData.Id) {
|
||||
materialSelect(rowData);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '库存',field: 'Stock',editor:'validatebox',width:70},
|
||||
{ title: '库存',field: 'Stock',editor:'validatebox',width:50},
|
||||
{ title: anotherDepotHeadName, field: 'AnotherDepotId',editor:'validatebox',hidden:isShowAnotherDepot,width:90,
|
||||
formatter: function (value, row, index) {
|
||||
return row.AnotherDepotName;
|
||||
@@ -783,12 +806,7 @@
|
||||
{ title: '税率(%)',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ 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: '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},
|
||||
{ title: '备注2',field: 'OtherField5',editor:'validatebox',hidden:true,width:60}
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:100}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
@@ -885,54 +903,33 @@
|
||||
function materialSelect(rec) {
|
||||
var body,footer,input; //定义表格和文本框
|
||||
var ratio = 1; //比例-品名专用
|
||||
var loadRatio = 1; //在单位输入框上面加载比例字段
|
||||
if(rec) {
|
||||
var mId = rec.Id;
|
||||
var meId = rec.Id;
|
||||
$.ajax({
|
||||
url: "/material/findById",
|
||||
url: "/material/findByIdWithBarCode",
|
||||
type: "get",
|
||||
dataType: "json",
|
||||
data: {
|
||||
id: mId
|
||||
meId: meId
|
||||
},
|
||||
success: function (res) {
|
||||
if(res && res.code === 200 && res.data && res.data[0]) {
|
||||
var retailPrice = res.data[0].retailprice-0; //零售价格
|
||||
var presetPriceOne = res.data[0].presetpriceone-0; //预计采购价
|
||||
var presetPriceTwo = res.data[0].presetpricetwo-0; //批发价
|
||||
var firstInUnit = res.data[0].firstinunit; //首选入库单位
|
||||
var firstOutUnit = res.data[0].firstoutunit; //首选出库单位
|
||||
var basicPresetPriceOne = ""; //多单位-入库-基础价格
|
||||
var basicPresetPriceTwo = ""; //多单位-出库-基础价格
|
||||
var retailPriceOne = ""; //多单位-入库-零售价格
|
||||
var otherPresetPriceOne = ""; //多单位-入库-其他价格
|
||||
var otherPresetPriceTwo = ""; //多单位-出库-其他价格
|
||||
var retailPriceTwo = ""; //多单位-出库-零售价格
|
||||
var basicUnit = ""; //基础单位
|
||||
var otherUnit = ""; //其他单位
|
||||
if(!res.data[0].unit){
|
||||
var ps = res.data[0].pricestrategy;
|
||||
var psObj = JSON.parse(ps);
|
||||
basicPresetPriceOne = psObj[0].basic.PresetPriceOne-0;
|
||||
basicPresetPriceTwo = psObj[0].basic.PresetPriceTwo-0;
|
||||
retailPriceOne = psObj[0].basic.RetailPrice-0;
|
||||
otherPresetPriceOne = psObj[1].other.PresetPriceOne-0;
|
||||
otherPresetPriceTwo = psObj[1].other.PresetPriceTwo-0;
|
||||
retailPriceTwo = psObj[1].other.RetailPrice-0;
|
||||
basicUnit = psObj[0].basic.Unit;
|
||||
otherUnit = psObj[1].other.Unit;
|
||||
}
|
||||
body =$("#depotHeadFM .datagrid-body");
|
||||
footer =$("#depotHeadFM .datagrid-footer");
|
||||
input = ".datagrid-editable-input";
|
||||
if(res.data[0].unit){ //如果存在计量单位信息
|
||||
ratio = 1; //重置比例为1
|
||||
body.find("[field='Unit']").find(input).val(res.data[0].unit); //设置-计量单位信息
|
||||
body.find("[field='Unit']").find(input).prop("readonly","readonly"); //设置计量单位为只读
|
||||
body.find("[field='Unit']").find(input).off("click"); //移除点击事件
|
||||
body.find("[field='Unit']").find(input).attr("data-ratio",ratio); //修改比例缓存信息
|
||||
}
|
||||
if(res && res.code === 200) {
|
||||
var info = res.data;
|
||||
var commodityDecimal = info.commodityDecimal-0; //零售价
|
||||
var purchaseDecimal = info.purchaseDecimal-0; //采购价
|
||||
var commodityUnit = info.commodityUnit; //商品单位
|
||||
body =$("#depotHeadFM .datagrid-body");
|
||||
footer =$("#depotHeadFM .datagrid-footer");
|
||||
input = ".datagrid-editable-input";
|
||||
body.find("[field='Unit']").find(input).prop("readonly","readonly"); //设置计量单位为只读
|
||||
body.find("[field='Unit']").find(input).val(commodityUnit); //设置单位
|
||||
if(info.unit){ //如果存在计量单位信息
|
||||
ratio = 1; //重置比例为1
|
||||
loadRatio = ratio;
|
||||
}
|
||||
else {
|
||||
var unitName = res.data[0].unitName;
|
||||
var unitName = info.unitName;
|
||||
if(unitName) {
|
||||
ratio = unitName.substring(unitName.indexOf(":")+1).replace(")",""); //给比例赋值
|
||||
unitName = unitName.substring(0, unitName.indexOf("("));
|
||||
@@ -940,146 +937,29 @@
|
||||
var unitArr = unitName.split(",");
|
||||
var basicUnit = unitArr[0]; //基础单位
|
||||
var otherUnit = unitArr[1]; //副单位
|
||||
var unitSetInput =""; //单位
|
||||
body.find("[field='Unit']").find(input).prop("readonly","readonly"); //设置计量单位为只读
|
||||
var loadRatio = 1; //在单位输入框上面加载比例字段
|
||||
if(listSubType === "采购" || listSubType === "采购退货" || listSubType === "采购订单"){
|
||||
unitSetInput = res.data[0].firstinunit; //给单位文本框赋值
|
||||
if(basicUnit==unitSetInput){ //基础单位等于选择的单位
|
||||
loadRatio = 1;
|
||||
}
|
||||
else if(otherUnit==unitSetInput){ //副单位等于选择的单位
|
||||
loadRatio = ratio;
|
||||
}
|
||||
}
|
||||
else if(listSubType === "销售" || listSubType === "销售退货" || listSubType === "销售订单" || listSubType === "零售" || listSubType === "零售退货"){
|
||||
unitSetInput = res.data[0].firstoutunit; //给单位文本框赋值
|
||||
if(basicUnit==unitSetInput){ //基础单位等于选择的单位
|
||||
loadRatio = 1;
|
||||
}
|
||||
else if(otherUnit==unitSetInput){ //副单位等于选择的单位
|
||||
loadRatio = ratio;
|
||||
}
|
||||
}
|
||||
body.find("[field='Unit']").find(input).val(unitSetInput).attr("data-ratio", loadRatio); //设置-首选单位
|
||||
|
||||
body.find("[field='Unit']").find(input).off("click").on("click",function(){
|
||||
if(basicUnit && otherUnit) {
|
||||
var self = this;
|
||||
//定义模版
|
||||
var temp = "<div class='unit-list'>";
|
||||
temp +="<ul>";
|
||||
temp +="<li data-type='basic' data-ratio='1'>" + basicUnit + "</li>";
|
||||
temp +="<li data-type='other' data-ratio='" + ratio + "'>" + otherUnit + "</li>";
|
||||
temp +="</ul>";
|
||||
temp +="</div>";
|
||||
if($('.unit-list').length){
|
||||
$('.unit-list').remove(); //如果存在计量单位列表先移除
|
||||
}
|
||||
else {
|
||||
$(self).after(temp); //加载列表信息
|
||||
}
|
||||
//计量单位列表的单击事件
|
||||
$('.unit-list ul li').off("click").on("click",function(){
|
||||
var unit = $(this).text();
|
||||
var thisRatio = $(this).attr("data-ratio"); //获取比例
|
||||
$(self).val(unit).attr("data-ratio", thisRatio);
|
||||
$(self).keyup(); //模拟键盘操作
|
||||
$('.unit-list').remove(); //移除计量单位列表
|
||||
var stock = body.find("[field='Stock']").find(input).attr("data-stock"); //从缓存中取值
|
||||
var type = $(this).attr("data-type");
|
||||
var UnitPrice = 0;
|
||||
if(type === "basic"){
|
||||
if(listTitle == "采购订单列表" || listTitle == "采购入库列表" || listTitle == "销售退货列表" || listTitle == "其它入库列表") {
|
||||
UnitPrice = basicPresetPriceOne;
|
||||
loadRatio = ratio;
|
||||
}
|
||||
else if(listTitle == "销售订单列表" || listTitle == "销售出库列表" || listTitle == "采购退货列表" || listTitle == "其它出库列表" || listTitle == "调拨出库列表") {
|
||||
UnitPrice = basicPresetPriceTwo;
|
||||
loadRatio = 1;
|
||||
}
|
||||
else if(listTitle == "零售出库列表" || listTitle == "零售退货列表"){
|
||||
UnitPrice = retailPriceOne;
|
||||
loadRatio = 1;
|
||||
}
|
||||
body.find("[field='Stock']").find(input).val(stock*loadRatio); //修改库存
|
||||
}
|
||||
else if(type === "other"){
|
||||
if(listTitle == "采购订单列表" || listTitle == "采购入库列表" || listTitle == "销售退货列表" || listTitle == "其它入库列表") {
|
||||
UnitPrice = otherPresetPriceOne;
|
||||
loadRatio = 1;
|
||||
}
|
||||
else if(listTitle == "销售订单列表" || listTitle == "销售出库列表" || listTitle == "采购退货列表" || listTitle == "其它出库列表" || listTitle == "调拨出库列表") {
|
||||
UnitPrice = otherPresetPriceTwo;
|
||||
loadRatio = ratio;
|
||||
}
|
||||
else if(listTitle == "零售出库列表" || listTitle == "零售退货列表"){
|
||||
UnitPrice = retailPriceTwo;
|
||||
loadRatio = ratio;
|
||||
}
|
||||
body.find("[field='Stock']").find(input).val((stock/loadRatio).toFixed(2)); //修改库存
|
||||
}
|
||||
body.find("[field='UnitPrice']").find(input).val(UnitPrice); //单价
|
||||
var OperNumber = body.find("[field='OperNumber']").find(input).val(); //获取数量
|
||||
var taxRate = body.find("[field='TaxRate']").find(input).val(); //获取税率
|
||||
body.find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价
|
||||
body.find("[field='AllPrice']").find(input).val((UnitPrice*OperNumber).toFixed(2)); //金额
|
||||
body.find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额
|
||||
body.find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计
|
||||
statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
|
||||
});
|
||||
//点击空白处移除计量单位列表
|
||||
$(".datagrid-body").off("click").on("click",function(){
|
||||
$('.unit-list').remove(); //移除计量单位列表
|
||||
});
|
||||
}
|
||||
});
|
||||
if(basicUnit==commodityUnit){ //基础单位等于选择的单位
|
||||
loadRatio = 1;
|
||||
}
|
||||
else if(otherUnit==commodityUnit){ //副单位等于选择的单位
|
||||
loadRatio = ratio;
|
||||
}
|
||||
}
|
||||
var detailPrice = 0; //明细列表-单价
|
||||
if(listSubType == "零售" || listSubType == "零售退货") {
|
||||
if(res.data[0].unit) { //如果存在计量单位信息
|
||||
detailPrice = retailPrice;
|
||||
}
|
||||
else {
|
||||
if (firstOutUnit == basicUnit) {
|
||||
detailPrice = retailPriceOne;
|
||||
}
|
||||
else if (firstOutUnit == otherUnit) {
|
||||
detailPrice = retailPriceTwo;
|
||||
}
|
||||
}
|
||||
detailPrice = commodityDecimal;
|
||||
}
|
||||
else if(listTitle == "采购订单列表" || listTitle == "采购入库列表" || listTitle == "销售退货列表" || listTitle == "其它入库列表") {
|
||||
if(res.data[0].unit) { //如果存在计量单位信息
|
||||
detailPrice = presetPriceOne;
|
||||
}
|
||||
else {
|
||||
if (firstInUnit == basicUnit) {
|
||||
detailPrice = basicPresetPriceOne;
|
||||
}
|
||||
else if (firstInUnit == otherUnit) {
|
||||
detailPrice = otherPresetPriceOne;
|
||||
}
|
||||
}
|
||||
detailPrice = purchaseDecimal;
|
||||
}
|
||||
else if(listTitle == "销售订单列表" || listTitle == "销售出库列表" || listTitle == "采购退货列表" || listTitle == "其它出库列表" || listTitle == "调拨出库列表") {
|
||||
if(res.data[0].unit) { //如果存在计量单位信息
|
||||
detailPrice = presetPriceTwo;
|
||||
}
|
||||
else {
|
||||
if(firstOutUnit==basicUnit) {
|
||||
detailPrice = basicPresetPriceTwo;
|
||||
}
|
||||
else if(firstOutUnit==otherUnit){
|
||||
detailPrice = otherPresetPriceTwo;
|
||||
}
|
||||
}
|
||||
}
|
||||
body.find("[field='OperNumber']").find(input).val(1); //数量初始化为1
|
||||
//单价和总价赋值
|
||||
if(!detailPrice) {
|
||||
detailPrice = 0;
|
||||
detailPrice = commodityDecimal;
|
||||
}
|
||||
//单价和总价赋值
|
||||
if(!detailPrice) {
|
||||
detailPrice = 0;
|
||||
}
|
||||
var operNumber = 1;
|
||||
body.find("[field='OperNumber']").find(input).val(operNumber); //数量初始化
|
||||
body.find("[field='UnitPrice']").find(input).val(detailPrice);
|
||||
body.find("[field='AllPrice']").find(input).val(detailPrice);
|
||||
var taxRate = body.find("[field='TaxRate']").find(input).val()-0; //获取税率
|
||||
@@ -1092,7 +972,7 @@
|
||||
var depotId = body.find("[field='DepotId']").find(".textbox-value").val();
|
||||
if(depotId) {
|
||||
var type = "select"; //type 类型:点击 click,选择 select
|
||||
findStockNumById(depotId, mId, monthTime, body, input, loadRatio, type);
|
||||
findStockNumById(depotId, meId, monthTime, body, input, loadRatio, type);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1142,8 +1022,8 @@
|
||||
columns:[[
|
||||
{ title: '商品类型',field: 'MType',width:80, hidden:isShowMaterialTypeColumn},
|
||||
{ title: depotHeadName,field: 'DepotName',editor:'validatebox',width:90},
|
||||
{ title: '品名(型号)(扩展信息)(单位)',field: 'MaterialName',width:230},
|
||||
{ title: '库存',field: 'Stock',width:70},
|
||||
{ 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},
|
||||
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
|
||||
@@ -1154,12 +1034,7 @@
|
||||
{ title: '税率',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ 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: '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},
|
||||
{ title: '备注2',field: 'OtherField5',editor:'validatebox',hidden:true,width:60}
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:100}
|
||||
]],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
@@ -2549,7 +2424,7 @@
|
||||
var DepotName = $(edDepot.target).combobox('getText');
|
||||
$('#materialData').datagrid('getRows')[editIndex]['DepotName'] = DepotName;
|
||||
//商品信息
|
||||
var edMaterial = $('#materialData').datagrid('getEditor', {index:editIndex,field:'MaterialId'});
|
||||
var edMaterial = $('#materialData').datagrid('getEditor', {index:editIndex,field:'MaterialExtendId'});
|
||||
var MaterialName = $(edMaterial.target).combobox('getText');
|
||||
$('#materialData').datagrid('getRows')[editIndex]['MaterialName'] = MaterialName;
|
||||
$('#materialData').datagrid('endEdit', editIndex);
|
||||
@@ -2646,7 +2521,7 @@
|
||||
}
|
||||
var totalRowNum = "";
|
||||
for (var i = 0; i < row.length; i++) {
|
||||
if (row[i].DepotId == "" || row[i].MaterialId == "" || row[i].OperNumber == "" || row[i].UnitPrice === "" || row[i].AllPrice === "") {
|
||||
if (row[i].DepotId == "" || row[i].MaterialExtendId == "" || row[i].OperNumber == "" || row[i].UnitPrice === "" || row[i].AllPrice === "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,11 @@
|
||||
<input name="searchName" id="searchName" class="easyui-textbox" style="width:100px;"/>
|
||||
</td>
|
||||
<td> </td>
|
||||
<td>规格:</td>
|
||||
<td>
|
||||
<input name="searchStandard" id="searchStandard" class="easyui-textbox" style="width:100px;"/>
|
||||
</td>
|
||||
<td> </td>
|
||||
<td>型号:</td>
|
||||
<td>
|
||||
<input name="searchModel" id="searchModel" class="easyui-textbox" style="width:100px;"/>
|
||||
@@ -50,167 +55,96 @@
|
||||
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
||||
</div>
|
||||
|
||||
<div id="materialDetailListDlg" class="easyui-dialog" style="width:900px;height:500px;padding:10px 20px" closed="true"
|
||||
<div id="materialDetailListDlg" class="easyui-dialog" style="width:900px;height:520px;padding:10px 20px" closed="true"
|
||||
modal="true" collapsible="false" closable="true">
|
||||
<table id="materialTableData" style="top:50px;border-bottom-color:#FFFFFF"></table>
|
||||
</div>
|
||||
|
||||
<div id="materialDlg" class="easyui-dialog" style="width:860px;height:440px;padding:10px 20px"
|
||||
<div id="materialDlg" class="easyui-dialog" style="width:1200px;height:520px;padding:10px 20px"
|
||||
closed="true" buttons="#dlg-buttons" modal="true" collapsible="false" closable="true">
|
||||
<form id="materialFM" method="post" novalidate>
|
||||
<div id="tt" class="easyui-tabs" style="width:800px;height:320px;">
|
||||
<div id="tt" class="easyui-tabs" style="width:1150px;height:410px;">
|
||||
<div title="基本信息" style="padding:20px;">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:60px; height:30px;">品名</td>
|
||||
<td style="padding:5px;width:180px;">
|
||||
<td style="width:80px; height:30px;">品名</td>
|
||||
<td style="padding:5px;width:250px;">
|
||||
<input name="Name" id="Name" class="easyui-textbox"
|
||||
data-options="required:true,validType:'length[2,30]'"
|
||||
style="width: 180px;"/>
|
||||
</td>
|
||||
<td style="width:80px;">型号</td>
|
||||
<td style="padding:5px;width:180px;">
|
||||
<input name="Model" id="Model" class="easyui-textbox"
|
||||
data-options="required:true,validType:'length[1,30]'"
|
||||
style="width: 180px;"/>
|
||||
</td>
|
||||
<td style="width:200px;"></td>
|
||||
<td style="width:60px;">规格</td>
|
||||
<td style="padding:5px;width:250px;">
|
||||
<input name="Standard" id="Standard"
|
||||
data-options="validType:'length[1,30]'" style="width: 180px;border: 1px solid #95B8E7;border-radius:5px;height: 30px"/>
|
||||
</td>
|
||||
<td style="width:60px;">单位</td>
|
||||
<td style="padding:5px;width:250px;">
|
||||
<input name="Unit" id="Unit"
|
||||
data-options="validType:'length[1,30]'" style="width: 180px;height: 30px;border: 1px solid #95B8E7;border-radius:5px;"/>
|
||||
<select name="manyUnit" id="manyUnit"
|
||||
style="width:180px;display: none;height: 30px;border: 1px solid #95B8E7;border-radius:5px;"></select>
|
||||
<input id="manyUnitCheck" type="checkbox"/>多单位
|
||||
</td>
|
||||
<td style="width:250px"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:80px;">型号</td>
|
||||
<td style="padding:5px;">
|
||||
<input name="Model" id="Model" class="easyui-textbox"
|
||||
data-options="validType:'length[1,30]'" style="width: 180px;"/>
|
||||
</td>
|
||||
<td style="height:30px;">颜色</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Color" id="Color"
|
||||
data-options="validType:'length[1,30]'" style="width: 180px;border: 1px solid #95B8E7;border-radius:5px;height: 30px"/>
|
||||
</td>
|
||||
<td style="height:30px;">类别</td>
|
||||
<td style="padding:5px" colspan="3">
|
||||
<td style="padding:5px">
|
||||
<input name="parentName" id="parentName" class="easyui-textbox" style="width: 180px;" readonly="readonly"/>
|
||||
<a href="javascript:void(0)" class="l-btn l-btn-plain" group="" id="lookForMaterialCategory">
|
||||
<span class="l-btn-left"><span class="l-btn-text icon-search l-btn-icon-left" style="height: 20px;"></span></span></a>
|
||||
<input name="parentid" id="parentid" type="hidden"/>
|
||||
</td>
|
||||
<td></td>
|
||||
<td style="text-align: left;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:80px;">序列号</td>
|
||||
<td style="padding:5px;width:180px;">
|
||||
<td style="padding:5px;">
|
||||
<select name="EnableSerialNumber" id="EnableSerialNumber"
|
||||
style="width:180px;height: 30px;border: 1px solid #95B8E7;border-radius:5px;">
|
||||
style="width:180px;height: 30px;border: 1px solid #95B8E7;border-radius:5px;">
|
||||
<option value="1">有</option>
|
||||
<option value="0">无</option>
|
||||
</select>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="height:30px;">备注</td>
|
||||
<td style="padding:5px" colspan="3">
|
||||
<textarea name="Remark" id="Remark" class="easyui-textbox" data-options="multiline:true" placeholder="暂无备注信息"
|
||||
style="width: 468px; height:40px;"></textarea>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div title="价格信息" style="padding:20px;">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="height:30px;">安全存量</td>
|
||||
<td style="padding:5px">
|
||||
<input name="SafetyStock" id="SafetyStock" class="easyui-textbox"
|
||||
data-options="validType:'length[1,30]'" style="width: 180px;"/>
|
||||
</td>
|
||||
<td>单位</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Unit" id="Unit"
|
||||
data-options="validType:'length[1,30]'" style="width: 180px;height: 30px;border: 1px solid #95B8E7;border-radius:5px;"/>
|
||||
<select name="manyUnit" id="manyUnit"
|
||||
style="width:180px;display: none;height: 30px;border: 1px solid #95B8E7;border-radius:5px;"></select>
|
||||
</td>
|
||||
<td style="text-align: left;">
|
||||
<input id="manyUnitCheck" type="checkbox"/>多单位
|
||||
</td>
|
||||
<td style="height:30px;"></td>
|
||||
<td style="padding:5px"></td>
|
||||
<td style="text-align: left;"></td>
|
||||
</tr>
|
||||
<tr class="first-select-unit">
|
||||
<td style="height:30px;">首选销售单位</td>
|
||||
<td style="padding:5px">
|
||||
<select name="FirstOutUnit" id="FirstOutUnit" style="width:180px; height: 30px;border: 1px solid #95B8E7;border-radius:5px;"></select>
|
||||
</td>
|
||||
<td>首选采购单位</td>
|
||||
<td style="padding:5px">
|
||||
<select name="FirstInUnit" id="FirstInUnit" style="width:180px; height: 30px;border: 1px solid #95B8E7;border-radius:5px;"></select>
|
||||
<tr>
|
||||
<td style="height:30px;">备注</td>
|
||||
<td style="padding:5px" colspan="5">
|
||||
<textarea name="Remark" id="Remark" class="easyui-textbox" data-options="multiline:true" placeholder="暂无备注信息"
|
||||
style="width: 925px; height:40px;"></textarea>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="price-list">
|
||||
<td colspan="5" style="height:30px;">
|
||||
<table width="700px">
|
||||
<tr>
|
||||
<td width="150px" height="25px"><b>价格列表</b></td>
|
||||
<td width="150px">计量单位</td>
|
||||
<td width="18%">零售价</td>
|
||||
<td width="18%">最低售价</td>
|
||||
<td width="18%">预计采购价</td>
|
||||
<td width="18%">销售价</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>基本单位</td>
|
||||
<td style="border: 1px solid #95B8E7;border-radius:5px;"><span id="basicUnit"></span></td>
|
||||
<td><input id="basicRetailPrice" style="height:30px;border: 1px solid #95B8E7;border-radius:5px;"/></td>
|
||||
<td><input id="basicLowPrice" style="height:30px;border: 1px solid #95B8E7;border-radius:5px;"/></td>
|
||||
<td><input id="basicPresetPriceOne" style="height:30px;border: 1px solid #95B8E7;border-radius:5px;"/></td>
|
||||
<td><input id="basicPresetPriceTwo" style="height:30px;border: 1px solid #95B8E7;border-radius:5px;"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>副单位</td>
|
||||
<td style="border: 1px solid #95B8E7;border-radius:5px;"><span id="otherUnit"></span></td>
|
||||
<td><input id="otherRetailPrice" style="height:30px;border: 1px solid #95B8E7;border-radius:5px;"/></td>
|
||||
<td><input id="otherLowPrice" style="height:30px;border: 1px solid #95B8E7;border-radius:5px;"/></td>
|
||||
<td><input id="otherPresetPriceOne" style="height:30px;border: 1px solid #95B8E7;border-radius:5px;"/></td>
|
||||
<td><input id="otherPresetPriceTwo" style="height:30px;border: 1px solid #95B8E7;border-radius:5px;"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
<table id="materialExtendData" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="price-one">
|
||||
<td style="height:30px;">零售价</td>
|
||||
<td style="padding:5px"><input name="RetailPrice" id="RetailPrice" class="easyui-textbox"
|
||||
data-options="validType:'length[1,30]'"
|
||||
style="width: 180px;"/></td>
|
||||
<td>最低售价</td>
|
||||
<td style="padding:5px"><input name="LowPrice" id="LowPrice" class="easyui-textbox"
|
||||
data-options="validType:'length[1,30]'"
|
||||
style="width: 180px;"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="price-two">
|
||||
<td style="height:30px;">预计采购价</td>
|
||||
<td style="padding:5px"><input name="PresetPriceOne" id="PresetPriceOne"
|
||||
class="easyui-textbox"
|
||||
data-options="validType:'length[1,30]'"
|
||||
style="width: 180px;"/></td>
|
||||
<td>销售价</td>
|
||||
<td style="padding:5px"><input name="PresetPriceTwo" id="PresetPriceTwo"
|
||||
class="easyui-textbox"
|
||||
data-options="validType:'length[1,30]'"
|
||||
style="width: 180px;"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div title="扩展信息" style="padding:20px;">
|
||||
<table class="tb-other-info">
|
||||
<tr class="tr-color">
|
||||
<td style="width:60px; height:30px;">颜色</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Color" id="Color"
|
||||
data-options="validType:'length[1,30]'" style="width: 250px;border: 1px solid #95B8E7;border-radius:5px;height: 30px"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tr-standard">
|
||||
<td>规格</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Standard" id="Standard"
|
||||
data-options="validType:'length[1,30]'" style="width: 250px;border: 1px solid #95B8E7;border-radius:5px;height: 30px"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tr-mfrs">
|
||||
<td>制造商</td>
|
||||
<td style="width:80px;">制造商</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Mfrs" id="Mfrs"
|
||||
data-options="validType:'length[1,30]'" style="width: 250px;border: 1px solid #95B8E7;border-radius:5px;height: 30px"/>
|
||||
@@ -253,7 +187,7 @@
|
||||
</div>
|
||||
|
||||
<!-- 导入excel表格 -->
|
||||
<div id="importExcelDlg" class="easyui-dialog" style="width:400px; padding:10px 20px;"
|
||||
<div id="importExcelDlg" class="easyui-dialog" style="width:450px; padding:10px 20px;"
|
||||
closed="true" buttons="#dlg-buttons5" modal="true" collapsible="false" closable="true">
|
||||
<form id="importExcelFM" method="post" enctype="multipart/form-data" action="/material/importExcel">
|
||||
<div class="fitem" style="padding:5px">
|
||||
@@ -276,12 +210,14 @@
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var editIndex = undefined;
|
||||
var materialCategoryList = null;
|
||||
var types = "";
|
||||
var multiple = 0; //倍数
|
||||
var mPropertyList = null; //商品属性列表
|
||||
var mPropertyListShort = ""; //商品属性列表-传值
|
||||
var clickType = ""; //记录从哪里点击的类别弹窗
|
||||
// var maxBarCode = getMaxBarCode();
|
||||
//初始化界面
|
||||
$(function () {
|
||||
//初始化系统基础信息
|
||||
@@ -367,10 +303,6 @@
|
||||
//当前为选中状态
|
||||
$("#Unit").hide();
|
||||
$("#manyUnit").show();
|
||||
$(".first-select-unit").show();
|
||||
$(".price-list").show();
|
||||
$(".price-one").hide();
|
||||
$(".price-two").hide();
|
||||
|
||||
$("#Unit").val(""); //清除单位的填写内容
|
||||
$("#RetailPrice").val("");
|
||||
@@ -382,10 +314,6 @@
|
||||
//当前为不选中状态
|
||||
$("#Unit").show();
|
||||
$("#manyUnit").hide();
|
||||
$(".first-select-unit").hide();
|
||||
$(".price-list").hide();
|
||||
$(".price-one").show();
|
||||
$(".price-two").show();
|
||||
|
||||
$("#manyUnit").val(""); //清除多单位的下拉框
|
||||
$("#FirstOutUnit").val("");
|
||||
@@ -526,6 +454,7 @@
|
||||
}
|
||||
},
|
||||
{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},
|
||||
@@ -546,26 +475,10 @@
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{title: '零售价', field: 'retailprice', width: 60,
|
||||
formatter: function (value, rec) {
|
||||
return parsePrice(value, rec, "retailprice");
|
||||
}
|
||||
},
|
||||
{title: '最低售价', field: 'lowprice', width: 70,
|
||||
formatter: function (value, rec) {
|
||||
return parsePrice(value, rec, "lowprice");
|
||||
}
|
||||
},
|
||||
{title: '预计采购价', field: 'presetpriceone', width: 70,
|
||||
formatter: function (value, rec) {
|
||||
return parsePrice(value, rec, "presetpriceone");
|
||||
}
|
||||
},
|
||||
{title: '销售价', field: 'presetpricetwo', width: 70,
|
||||
formatter: function (value, rec) {
|
||||
return parsePrice(value, rec, "presetpricetwo");
|
||||
}
|
||||
},
|
||||
{title: '采购价', field: 'purchaseDecimal', width: 70},
|
||||
{title: '零售价', field: 'commodityDecimal', width: 70},
|
||||
{title: '销售价', field: 'wholesaleDecimal', width: 70},
|
||||
{title: '最低售价', field: 'lowDecimal', width: 70},
|
||||
{
|
||||
title: '状态', field: 'enabled', width: 50, align: "center", formatter: function (value) {
|
||||
return value ? "启用" : "禁用";
|
||||
@@ -644,7 +557,7 @@
|
||||
//初始化表格数据
|
||||
function initMaterialDetailData(mId) {
|
||||
$('#materialTableData').datagrid({
|
||||
height: heightInfo,
|
||||
height: heightInfo-50,
|
||||
nowrap: false,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
@@ -1024,10 +937,6 @@
|
||||
|
||||
//根据商品属性架子啊
|
||||
function bindMProperty() {
|
||||
var trColor = $(".tr-color").html();
|
||||
trColor = '<tr class="tr-color">' + trColor + '</tr>';
|
||||
var trStandard = $(".tr-standard").html();
|
||||
trStandard = '<tr class="tr-standard">' + trStandard + '</tr>';
|
||||
var trMfrs = $(".tr-mfrs").html();
|
||||
trMfrs = '<tr class="tr-mfrs">' + trMfrs + '</tr>';
|
||||
var trOtherField1 = $(".tr-otherField1").html();
|
||||
@@ -1039,26 +948,6 @@
|
||||
//表格模板变更
|
||||
$(".tb-other-info").html("");
|
||||
for (var i = 0; i < mPropertyList.length; i++) {
|
||||
if (mPropertyList[i].nativename === "颜色") {
|
||||
$(".tb-other-info").append(trColor);
|
||||
$(".tr-color td").first().text(mPropertyList[i].anothername);
|
||||
if (mPropertyList[i].enabled) {
|
||||
$(".tr-color").show();
|
||||
}
|
||||
else {
|
||||
$(".tr-color").hide();
|
||||
}
|
||||
}
|
||||
if (mPropertyList[i].nativename === "规格") {
|
||||
$(".tb-other-info").append(trStandard);
|
||||
$(".tr-standard td").first().text(mPropertyList[i].anothername);
|
||||
if (mPropertyList[i].enabled) {
|
||||
$(".tr-standard").show();
|
||||
}
|
||||
else {
|
||||
$(".tr-standard").hide();
|
||||
}
|
||||
}
|
||||
if (mPropertyList[i].nativename === "制造商") {
|
||||
$(".tb-other-info").append(trMfrs);
|
||||
$(".tr-mfrs td").first().text(mPropertyList[i].anothername);
|
||||
@@ -1106,23 +995,17 @@
|
||||
if(checkPower()){
|
||||
return;
|
||||
}
|
||||
$('#materialFM input').val(""); //将输入框全部清空
|
||||
|
||||
$('#materialFM').form('clear');
|
||||
initTableDataExtend('add','0');
|
||||
bindMProperty(); //根据商品属性绑定
|
||||
// $("#EnableSerialNumber").combobox('setValue','0');
|
||||
$("#EnableSerialNumber").val('0');
|
||||
$('#materialDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui/themes/icons/edit_add.png"/> 增加商品信息');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
$("#Name").val("").focus();
|
||||
$("#manyUnitCheck").prop("checked", false);
|
||||
$("#manyUnit").val(""); //置空
|
||||
//当前为不选中状态
|
||||
$("#Unit").show();
|
||||
$("#manyUnit").hide();
|
||||
$(".first-select-unit").hide();
|
||||
$(".price-list").hide();
|
||||
$(".price-one").show();
|
||||
$(".price-two").show();
|
||||
//选中基本资料tab
|
||||
$("#materialFM #tt .tabs li").first().click();
|
||||
oldName = "";
|
||||
@@ -1140,6 +1023,89 @@
|
||||
initDepotList(materialID); //加载仓库列表页面
|
||||
}
|
||||
|
||||
//商品价格扩展
|
||||
function initTableDataExtend(type,materialId){
|
||||
$('#materialExtendData').datagrid({
|
||||
width:1000,
|
||||
height:150,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ field: 'Id',field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '条码',field: 'BarCode',editor:'validatebox',width:200},
|
||||
{ title: '单位',field: 'CommodityUnit',editor:'validatebox',width:70},
|
||||
{ title: '采购价',field: 'PurchaseDecimal',editor:'validatebox',width:70},
|
||||
{ title: '零售价',field: 'CommodityDecimal',editor:'validatebox',width:70},
|
||||
{ title: '销售价',field: 'WholesaleDecimal',editor:'validatebox',width:70},
|
||||
{ title: '最低售价',field: 'LowDecimal',editor:'validatebox',width:70},
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'append',
|
||||
text:'新增',
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
append(); //新增
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'delete',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function()
|
||||
{
|
||||
removeit(); //删除
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'reject',
|
||||
text:'撤销',
|
||||
iconCls:'icon-undo',
|
||||
handler:function()
|
||||
{
|
||||
reject(); //撤销
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/materialsExtend/getDetailList',
|
||||
data: {
|
||||
materialId: materialId
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#materialExtendData").datagrid('loadData',res.data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//检查商品名称是否存在 ++ 重名无法提示问题需要跟进
|
||||
function checkIsExist() {
|
||||
var mName = $.trim($("#Name").val());
|
||||
@@ -1204,10 +1170,6 @@
|
||||
$.messager.alert('提示', '品名不能为空!', 'warning');
|
||||
return;
|
||||
}
|
||||
if (!$('#Model').val()) {
|
||||
$.messager.alert('提示', '型号不能为空!', 'warning');
|
||||
return;
|
||||
}
|
||||
if(!$("#Unit").val() && !$("#manyUnit").val()) {
|
||||
$.messager.alert('提示', '单位为必填项!', 'warning');
|
||||
return;
|
||||
@@ -1252,6 +1214,7 @@
|
||||
stockObj.number = val;
|
||||
stockArr.push(stockObj);
|
||||
});
|
||||
objInfo = accept(objInfo); //商品价格扩展
|
||||
objInfo.stock = JSON.stringify(stockArr);
|
||||
$.ajax({
|
||||
type: "post",
|
||||
@@ -1310,7 +1273,6 @@
|
||||
$("#parentName").textbox("setValue", rowsdata.categoryName);
|
||||
mId = rowsdata.categoryid;
|
||||
mName = rowsdata.categoryName;
|
||||
$("#Packing").textbox("setValue", rowsdata.packing);
|
||||
$("#SafetyStock").textbox("setValue", rowsdata.safetystock);
|
||||
$("#Model").textbox("setValue", rowsdata.model);
|
||||
$("#Standard").val(rowsdata.standard);
|
||||
@@ -1320,10 +1282,10 @@
|
||||
$("#OtherField2").val(rowsdata.otherfield2);
|
||||
$("#OtherField3").val(rowsdata.otherfield3);
|
||||
$("#Unit").val(rowsdata.unit);
|
||||
$("#RetailPrice").textbox("setValue", rowsdata.retailprice);
|
||||
$("#LowPrice").textbox("setValue", rowsdata.lowprice);
|
||||
$("#PresetPriceOne").textbox("setValue", rowsdata.presetpriceone);
|
||||
$("#PresetPriceTwo").textbox("setValue", rowsdata.presetpricetwo);
|
||||
// $("#RetailPrice").textbox("setValue", rowsdata.retailprice);
|
||||
// $("#LowPrice").textbox("setValue", rowsdata.lowprice);
|
||||
// $("#PresetPriceOne").textbox("setValue", rowsdata.presetpriceone);
|
||||
// $("#PresetPriceTwo").textbox("setValue", rowsdata.presetpricetwo);
|
||||
$("#Remark").textbox("setValue", rowsdata.remark);
|
||||
$("#manyUnit").val(rowsdata.unitid);
|
||||
if (rowsdata.unitid) {
|
||||
@@ -1331,10 +1293,6 @@
|
||||
//当前为选中状态
|
||||
$("#Unit").hide();
|
||||
$("#manyUnit").show();
|
||||
$(".first-select-unit").show();
|
||||
$(".price-list").show();
|
||||
$(".price-one").hide();
|
||||
$(".price-two").hide();
|
||||
var selectItem = $("#manyUnit").children('option:selected').text();
|
||||
if (selectItem !== "(空)") {
|
||||
var firstOutUnitOptions = selectItem.substring(0, selectItem.indexOf("("));
|
||||
@@ -1354,44 +1312,8 @@
|
||||
//当前为不选中状态
|
||||
$("#Unit").show();
|
||||
$("#manyUnit").hide();
|
||||
$(".first-select-unit").hide();
|
||||
$(".price-list").hide();
|
||||
$(".price-one").show();
|
||||
$(".price-two").show();
|
||||
}
|
||||
//单独查询商品的价格列表
|
||||
$.ajax({
|
||||
url: '/material/findById',
|
||||
data: {
|
||||
id: rowsdata.id
|
||||
},
|
||||
type: "get",
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if (res && res.code === 200 && res.data && res.data[0]) {
|
||||
var PriceStrategy = res.data[0].pricestrategy;
|
||||
PriceStrategy = JSON.parse(PriceStrategy);
|
||||
if (PriceStrategy && PriceStrategy[0] && PriceStrategy[1]) {
|
||||
//基本单位
|
||||
$("#basicUnit").text(PriceStrategy[0].basic.Unit);
|
||||
$("#basicRetailPrice").val(PriceStrategy[0].basic.RetailPrice);
|
||||
$("#basicLowPrice").val(PriceStrategy[0].basic.LowPrice);
|
||||
$("#basicPresetPriceOne").val(PriceStrategy[0].basic.PresetPriceOne);
|
||||
$("#basicPresetPriceTwo").val(PriceStrategy[0].basic.PresetPriceTwo);
|
||||
//副单位
|
||||
$("#otherUnit").text(PriceStrategy[1].other.Unit);
|
||||
$("#otherRetailPrice").val(PriceStrategy[1].other.RetailPrice);
|
||||
$("#otherLowPrice").val(PriceStrategy[1].other.LowPrice);
|
||||
$("#otherPresetPriceOne").val(PriceStrategy[1].other.PresetPriceOne);
|
||||
$("#otherPresetPriceTwo").val(PriceStrategy[1].other.PresetPriceTwo);
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
initTableDataExtend('edit',rowsdata.id);
|
||||
oldName = rowsdata.name;
|
||||
oldModel = rowsdata.model;
|
||||
oldColor = rowsdata.color;
|
||||
@@ -1425,7 +1347,7 @@
|
||||
json.depotList = res.data;
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "../../../pages/template/init_depot_list.html?61",
|
||||
url: "../../../pages/template/init_depot_list.html?2121",
|
||||
async: false,
|
||||
success: function (tem) {
|
||||
if (tem) {
|
||||
@@ -1455,9 +1377,9 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function showMaterialDetails(pageNo, pageSize) {
|
||||
var name = $.trim($("#searchName").val());
|
||||
var standard = $.trim($("#searchStandard").val());
|
||||
var model = $.trim($("#searchModel").val());
|
||||
$.ajax({
|
||||
type: "get",
|
||||
@@ -1466,6 +1388,7 @@
|
||||
data: ({
|
||||
search: JSON.stringify({
|
||||
name: name,
|
||||
standard: standard,
|
||||
model: model,
|
||||
categoryIds: types,
|
||||
mpList: mPropertyListShort
|
||||
@@ -1494,6 +1417,7 @@
|
||||
$("#searchParentName").textbox("clear");
|
||||
$("#searchParentId").val("");
|
||||
$("#searchName").textbox("clear");
|
||||
$("#searchStandard").textbox("clear");
|
||||
$("#searchModel").textbox("clear");
|
||||
types = ""; //清空类别
|
||||
//加载完以后重新初始化
|
||||
@@ -1596,6 +1520,116 @@
|
||||
materialCategoryDlgFun();
|
||||
});
|
||||
|
||||
//单击
|
||||
function onClickRow(index) {
|
||||
if (editIndex != index) {
|
||||
if (endEditing()) {
|
||||
$('#materialExtendData').datagrid('selectRow', index)
|
||||
.datagrid('beginEdit', index);
|
||||
editIndex = index;
|
||||
} else {
|
||||
$('#materialExtendData').datagrid('selectRow', editIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//结束编辑
|
||||
function endEditing() {
|
||||
if (editIndex == undefined) { return true }
|
||||
if ($('#materialExtendData').datagrid('validateRow', editIndex)) {
|
||||
$('#materialExtendData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//新增
|
||||
function append() {
|
||||
if (endEditing()) {
|
||||
$('#materialExtendData').datagrid('appendRow', {});
|
||||
editIndex = $('#materialExtendData').datagrid('getRows').length - 1;
|
||||
$('#materialExtendData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
||||
var ed = $('#materialExtendData').datagrid('getEditor', {index:editIndex,field:'BarCode'});
|
||||
var thisBarCode = getMaxBarCode();
|
||||
if(!thisBarCode) {
|
||||
thisBarCode = "1000";
|
||||
}
|
||||
$(ed.target).val(Number(thisBarCode)+1);
|
||||
}
|
||||
}
|
||||
|
||||
//查询最新条码
|
||||
function getMaxBarCode(){
|
||||
var barCode = "";
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/material/getMaxBarCode',
|
||||
async: false,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
barCode = res.data.barCode;
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
return barCode;
|
||||
}
|
||||
|
||||
//删除
|
||||
function removeit() {
|
||||
if (editIndex == undefined) { return }
|
||||
$('#materialExtendData').datagrid('cancelEdit', editIndex)
|
||||
.datagrid('deleteRow', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
|
||||
//撤销
|
||||
function reject() {
|
||||
$('#materialExtendData').datagrid('rejectChanges');
|
||||
editIndex = undefined;
|
||||
}
|
||||
|
||||
//判断
|
||||
function CheckData() {
|
||||
var row = $('#materialExtendData').datagrid('getRows');
|
||||
var totalRowNum = "";
|
||||
for (var i = 0; i < row.length; i++) {
|
||||
if (row[i].BarCode == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
if (row[i].CommodityUnit == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
if (totalRowNum != "") {
|
||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//商品价格扩展
|
||||
function accept(objInfo) {
|
||||
append();
|
||||
removeit();
|
||||
if ($("#materialExtendData").datagrid('getChanges').length) {
|
||||
if (!CheckData())
|
||||
return false;
|
||||
objInfo.inserted = $("#materialExtendData").datagrid('getChanges', "inserted");
|
||||
objInfo.deleted = $("#materialExtendData").datagrid('getChanges', "deleted");
|
||||
objInfo.updated = $("#materialExtendData").datagrid('getChanges', "updated");
|
||||
}
|
||||
if (endEditing()) {
|
||||
$('#materialExtendData').datagrid('acceptChanges');
|
||||
}
|
||||
return objInfo;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<table>
|
||||
{{#depotList}}
|
||||
<tr>
|
||||
<td style="width:100px;float:left;">{{name}}</td>
|
||||
<td>
|
||||
<td style="width:100px;height:30px;line-height:30px;padding:5px;float:left;">{{name}}</td>
|
||||
<td style="padding:5px">
|
||||
<input type="text" id="depot{{id}}" data-id="{{id}}" class="depot" style="width: 250px;border: 1px solid #95B8E7;border-radius:5px;height: 30px" value="{{stock}}"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -158,7 +158,7 @@ public class DepotItemController {
|
||||
for (DepotItemVo4WithInfoEx diEx : dataList) {
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", diEx.getId());
|
||||
item.put("MaterialId", diEx.getMaterialid() == null ? "" : diEx.getMaterialid());
|
||||
item.put("MaterialExtendId", diEx.getMaterialExtendId() == null ? "" : diEx.getMaterialExtendId());
|
||||
String ratio; //比例
|
||||
if (diEx.getUnitId() == null || diEx.getUnitId().equals("")) {
|
||||
ratio = "";
|
||||
@@ -167,7 +167,8 @@ public class DepotItemController {
|
||||
ratio = ratio.substring(ratio.indexOf("("));
|
||||
}
|
||||
//品名/型号/扩展信息/包装
|
||||
String MaterialName = (diEx.getMName() == null || diEx.getMName().equals("")) ? "" : diEx.getMName()
|
||||
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() + ")");
|
||||
String materialOther = getOtherInfo(mpArr, diEx);
|
||||
MaterialName = MaterialName + materialOther + ((diEx.getUName() == null || diEx.getUName().equals("")) ? "" : "(" + diEx.getUName() + ")") + ratio;
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.jsh.erp.datasource.entities.DepotEx;
|
||||
import com.jsh.erp.datasource.entities.Material;
|
||||
import com.jsh.erp.datasource.entities.MaterialVo4Unit;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.depotItem.DepotItemService;
|
||||
import com.jsh.erp.service.material.MaterialService;
|
||||
import com.jsh.erp.utils.*;
|
||||
import jxl.Sheet;
|
||||
@@ -40,6 +41,9 @@ public class MaterialController {
|
||||
@Resource
|
||||
private MaterialService materialService;
|
||||
|
||||
@Resource
|
||||
private DepotItemService depotItemService;
|
||||
|
||||
@GetMapping(value = "/checkIsExist")
|
||||
public String checkIsExist(@RequestParam("id") Long id, @RequestParam("name") String name,
|
||||
@RequestParam("model") String model, @RequestParam("color") String color,
|
||||
@@ -99,6 +103,31 @@ public class MaterialController {
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据meId来查询商品名称
|
||||
* @param meId
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/findByIdWithBarCode")
|
||||
public BaseResponseInfo findByIdWithBarCode(@RequestParam("meId") Long meId, HttpServletRequest request) throws Exception{
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
try {
|
||||
MaterialVo4Unit mu = new MaterialVo4Unit();
|
||||
List<MaterialVo4Unit> list = materialService.findByIdWithBarCode(meId);
|
||||
if(list!=null && list.size()>0) {
|
||||
mu = list.get(0);
|
||||
}
|
||||
res.code = 200;
|
||||
res.data = mu;
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "获取数据失败";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找商品信息-下拉框
|
||||
* @param mpList
|
||||
@@ -106,16 +135,25 @@ public class MaterialController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/findBySelect")
|
||||
public JSONArray findBySelect(@RequestParam("mpList") String mpList, HttpServletRequest request) throws Exception{
|
||||
JSONArray dataArray = new JSONArray();
|
||||
public JSONObject findBySelect(@RequestParam(value = "q", required = false) String q,
|
||||
@RequestParam("mpList") String mpList,
|
||||
@RequestParam(value = "depotId", required = false) Long depotId,
|
||||
@RequestParam("page") Integer currentPage,
|
||||
@RequestParam("rows") Integer pageSize,
|
||||
HttpServletRequest request) throws Exception{
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
List<MaterialVo4Unit> dataList = materialService.findBySelect();
|
||||
Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString());
|
||||
List<MaterialVo4Unit> dataList = materialService.findBySelectWithBarCode(q, (currentPage-1)*pageSize, pageSize);
|
||||
String[] mpArr = mpList.split(",");
|
||||
int total = materialService.findBySelectWithBarCodeCount(q);
|
||||
object.put("total", total);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
//存放数据json数组
|
||||
if (null != dataList) {
|
||||
for (MaterialVo4Unit material : dataList) {
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", material.getId());
|
||||
item.put("Id", material.getMeId()); //商品扩展表的id
|
||||
String ratio; //比例
|
||||
if (material.getUnitid() == null || material.getUnitid().equals("")) {
|
||||
ratio = "";
|
||||
@@ -124,36 +162,50 @@ public class MaterialController {
|
||||
ratio = ratio.substring(ratio.indexOf("("));
|
||||
}
|
||||
//品名/型号/扩展信息/包装
|
||||
String MaterialName = material.getName() + ((material.getModel() == null || material.getModel().equals("")) ? "" : "(" + material.getModel() + ")");
|
||||
String MaterialName = "";
|
||||
String mBarCode = "";
|
||||
if(material.getmBarCode()!=null) {
|
||||
mBarCode = material.getmBarCode();
|
||||
MaterialName = MaterialName + mBarCode + "_";
|
||||
}
|
||||
item.put("mBarCode", mBarCode);
|
||||
MaterialName = MaterialName + " " + material.getName()
|
||||
+ ((material.getStandard() == null || material.getStandard().equals("")) ? "" : "(" + material.getStandard() + ")")
|
||||
+ ((material.getModel() == null || material.getModel().equals("")) ? "" : "(" + material.getModel() + ")");
|
||||
String expand = ""; //扩展信息
|
||||
for (int i = 0; i < mpArr.length; i++) {
|
||||
if (mpArr[i].equals("颜色")) {
|
||||
MaterialName = MaterialName + ((material.getColor() == null || material.getColor().equals("")) ? "" : "(" + material.getColor() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("规格")) {
|
||||
MaterialName = MaterialName + ((material.getStandard() == null || material.getStandard().equals("")) ? "" : "(" + material.getStandard() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("制造商")) {
|
||||
MaterialName = MaterialName + ((material.getMfrs() == null || material.getMfrs().equals("")) ? "" : "(" + material.getMfrs() + ")");
|
||||
expand = expand + ((material.getMfrs() == null || material.getMfrs().equals("")) ? "" : "(" + material.getMfrs() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("自定义1")) {
|
||||
MaterialName = MaterialName + ((material.getOtherfield1() == null || material.getOtherfield1().equals("")) ? "" : "(" + material.getOtherfield1() + ")");
|
||||
expand = expand + ((material.getOtherfield1() == null || material.getOtherfield1().equals("")) ? "" : "(" + material.getOtherfield1() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("自定义2")) {
|
||||
MaterialName = MaterialName + ((material.getOtherfield2() == null || material.getOtherfield2().equals("")) ? "" : "(" + material.getOtherfield2() + ")");
|
||||
expand = expand + ((material.getOtherfield2() == null || material.getOtherfield2().equals("")) ? "" : "(" + material.getOtherfield2() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("自定义3")) {
|
||||
MaterialName = MaterialName + ((material.getOtherfield3() == null || material.getOtherfield3().equals("")) ? "" : "(" + material.getOtherfield3() + ")");
|
||||
expand = expand + ((material.getOtherfield3() == null || material.getOtherfield3().equals("")) ? "" : "(" + material.getOtherfield3() + ")");
|
||||
}
|
||||
}
|
||||
MaterialName = MaterialName + ((material.getUnit() == null || material.getUnit().equals("")) ? "" : "(" + material.getUnit() + ")") + ratio;
|
||||
MaterialName = MaterialName + expand + ((material.getCommodityUnit() == null || material.getCommodityUnit().equals("")) ? "" : "(" + material.getCommodityUnit() + ")") + ratio;
|
||||
item.put("MaterialName", MaterialName);
|
||||
item.put("name", material.getName());
|
||||
item.put("expand", expand);
|
||||
item.put("model", material.getModel());
|
||||
item.put("standard", material.getStandard());
|
||||
item.put("unit", material.getCommodityUnit() + ratio);
|
||||
if(depotId!=null&& StringUtil.isNotEmpty(q)) {
|
||||
BigDecimal stock = depotItemService.getStockByParam(depotId,material.getId(),null,null,tenantId);
|
||||
item.put("stock", stock);
|
||||
}
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
object.put("rows", dataArray);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return dataArray;
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
@@ -188,6 +240,69 @@ public class MaterialController {
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商品id查找商品信息
|
||||
* @param meId
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping(value = "/getMaterialByMeId")
|
||||
public JSONObject getMaterialByMeId(@RequestParam("meId") long meId,
|
||||
@RequestParam("mpList") String mpList,
|
||||
HttpServletRequest request) throws Exception{
|
||||
JSONObject item = new JSONObject();
|
||||
try {
|
||||
String[] mpArr = mpList.split(",");
|
||||
List<MaterialVo4Unit> materialList = materialService.getMaterialByMeId(meId);
|
||||
if(materialList!=null && materialList.size()!=1) {
|
||||
return item;
|
||||
} else if(materialList.size() == 1) {
|
||||
MaterialVo4Unit material = materialList.get(0);
|
||||
item.put("Id", material.getMeId()); //商品扩展表的id
|
||||
String ratio; //比例
|
||||
if (material.getUnitid() == null || material.getUnitid().equals("")) {
|
||||
ratio = "";
|
||||
} else {
|
||||
ratio = material.getUnitName();
|
||||
ratio = ratio.substring(ratio.indexOf("("));
|
||||
}
|
||||
//品名/型号/扩展信息/包装
|
||||
String MaterialName = "";
|
||||
MaterialName = MaterialName + material.getmBarCode() + "_" + material.getName()
|
||||
+ ((material.getStandard() == null || material.getStandard().equals("")) ? "" : "(" + material.getStandard() + ")");
|
||||
String expand = ""; //扩展信息
|
||||
for (int i = 0; i < mpArr.length; i++) {
|
||||
if (mpArr[i].equals("颜色")) {
|
||||
expand = expand + ((material.getColor() == null || material.getColor().equals("")) ? "" : "(" + material.getColor() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("制造商")) {
|
||||
expand = expand + ((material.getMfrs() == null || material.getMfrs().equals("")) ? "" : "(" + material.getMfrs() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("自定义1")) {
|
||||
expand = expand + ((material.getOtherfield1() == null || material.getOtherfield1().equals("")) ? "" : "(" + material.getOtherfield1() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("自定义2")) {
|
||||
expand = expand + ((material.getOtherfield2() == null || material.getOtherfield2().equals("")) ? "" : "(" + material.getOtherfield2() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("自定义3")) {
|
||||
expand = expand + ((material.getOtherfield3() == null || material.getOtherfield3().equals("")) ? "" : "(" + material.getOtherfield3() + ")");
|
||||
}
|
||||
}
|
||||
MaterialName = MaterialName + expand + ((material.getUnit() == null || material.getUnit().equals("")) ? "" : "(" + material.getUnit() + ")") + ratio;
|
||||
item.put("MaterialName", MaterialName);
|
||||
item.put("name", material.getName());
|
||||
item.put("expand", expand);
|
||||
item.put("model", material.getModel());
|
||||
item.put("standard", material.getStandard());
|
||||
item.put("unit", material.getUnit() + ratio);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成excel表格
|
||||
* @param name
|
||||
@@ -340,4 +455,15 @@ public class MaterialController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getMaxBarCode")
|
||||
public BaseResponseInfo getMaxBarCode() throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String barCode = materialService.getMaxBarCode();
|
||||
map.put("barCode", barCode);
|
||||
res.code = 200;
|
||||
res.data = map;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.jsh.erp.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.datasource.vo.MaterialExtendVo4List;
|
||||
import com.jsh.erp.service.MaterialExtend.MaterialExtendService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
import com.jsh.erp.utils.ErpInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||
|
||||
/**
|
||||
* @author jijiaqing
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/materialsExtend")
|
||||
public class MaterialExtendController {
|
||||
private Logger logger = LoggerFactory.getLogger(MaterialExtendController.class);
|
||||
@Resource
|
||||
private MaterialExtendService materialExtendService;
|
||||
|
||||
@GetMapping(value = "/getDetailList")
|
||||
public BaseResponseInfo getDetailList(@RequestParam("materialId") Long materialId,
|
||||
HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
try {
|
||||
List<MaterialExtendVo4List> dataList = new ArrayList<MaterialExtendVo4List>();
|
||||
if(materialId!=0) {
|
||||
dataList = materialExtendService.getDetailList(materialId);
|
||||
}
|
||||
JSONObject outer = new JSONObject();
|
||||
outer.put("total", dataList.size());
|
||||
//存放数据json数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if (null != dataList) {
|
||||
for (MaterialExtendVo4List md : dataList) {
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", md.getId());
|
||||
item.put("BarCode", md.getBarCode());
|
||||
item.put("CommodityUnit", md.getCommodityUnit());
|
||||
item.put("PurchaseDecimal", md.getPurchaseDecimal());
|
||||
item.put("CommodityDecimal", md.getCommodityDecimal());
|
||||
item.put("WholesaleDecimal", md.getWholesaleDecimal());
|
||||
item.put("LowDecimal", md.getLowDecimal());
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
outer.put("rows", dataArray);
|
||||
res.code = 200;
|
||||
res.data = outer;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "获取数据失败";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -3,802 +3,262 @@ package com.jsh.erp.datasource.entities;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class DepotItem {
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.Id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.HeaderId
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Long headerid;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.MaterialId
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Long materialid;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.MUnit
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Long materialExtendId;
|
||||
|
||||
private String munit;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.OperNumber
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private BigDecimal opernumber;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.BasicNumber
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private BigDecimal basicnumber;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.UnitPrice
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private BigDecimal unitprice;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.TaxUnitPrice
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private BigDecimal taxunitprice;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.AllPrice
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private BigDecimal allprice;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.Remark
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.Img
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String img;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.Incidentals
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private BigDecimal incidentals;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.DepotId
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Long depotid;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.AnotherDepotId
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Long anotherdepotid;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.TaxRate
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private BigDecimal taxrate;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.TaxMoney
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private BigDecimal taxmoney;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.TaxLastMoney
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private BigDecimal taxlastmoney;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.OtherField1
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String otherfield1;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.OtherField2
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String otherfield2;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.OtherField3
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String otherfield3;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.OtherField4
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String otherfield4;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.OtherField5
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String otherfield5;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.MType
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String mtype;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.tenant_id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column jsh_depotitem.delete_Flag
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String deleteFlag;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.Id
|
||||
*
|
||||
* @return the value of jsh_depotitem.Id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.Id
|
||||
*
|
||||
* @param id the value for jsh_depotitem.Id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.HeaderId
|
||||
*
|
||||
* @return the value of jsh_depotitem.HeaderId
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Long getHeaderid() {
|
||||
return headerid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.HeaderId
|
||||
*
|
||||
* @param headerid the value for jsh_depotitem.HeaderId
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setHeaderid(Long headerid) {
|
||||
this.headerid = headerid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.MaterialId
|
||||
*
|
||||
* @return the value of jsh_depotitem.MaterialId
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Long getMaterialid() {
|
||||
return materialid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.MaterialId
|
||||
*
|
||||
* @param materialid the value for jsh_depotitem.MaterialId
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setMaterialid(Long materialid) {
|
||||
this.materialid = materialid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.MUnit
|
||||
*
|
||||
* @return the value of jsh_depotitem.MUnit
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Long getMaterialExtendId() {
|
||||
return materialExtendId;
|
||||
}
|
||||
|
||||
public void setMaterialExtendId(Long materialExtendId) {
|
||||
this.materialExtendId = materialExtendId;
|
||||
}
|
||||
|
||||
public String getMunit() {
|
||||
return munit;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.MUnit
|
||||
*
|
||||
* @param munit the value for jsh_depotitem.MUnit
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setMunit(String munit) {
|
||||
this.munit = munit == null ? null : munit.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.OperNumber
|
||||
*
|
||||
* @return the value of jsh_depotitem.OperNumber
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public BigDecimal getOpernumber() {
|
||||
return opernumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.OperNumber
|
||||
*
|
||||
* @param opernumber the value for jsh_depotitem.OperNumber
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setOpernumber(BigDecimal opernumber) {
|
||||
this.opernumber = opernumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.BasicNumber
|
||||
*
|
||||
* @return the value of jsh_depotitem.BasicNumber
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public BigDecimal getBasicnumber() {
|
||||
return basicnumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.BasicNumber
|
||||
*
|
||||
* @param basicnumber the value for jsh_depotitem.BasicNumber
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setBasicnumber(BigDecimal basicnumber) {
|
||||
this.basicnumber = basicnumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.UnitPrice
|
||||
*
|
||||
* @return the value of jsh_depotitem.UnitPrice
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public BigDecimal getUnitprice() {
|
||||
return unitprice;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.UnitPrice
|
||||
*
|
||||
* @param unitprice the value for jsh_depotitem.UnitPrice
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setUnitprice(BigDecimal unitprice) {
|
||||
this.unitprice = unitprice;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.TaxUnitPrice
|
||||
*
|
||||
* @return the value of jsh_depotitem.TaxUnitPrice
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public BigDecimal getTaxunitprice() {
|
||||
return taxunitprice;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.TaxUnitPrice
|
||||
*
|
||||
* @param taxunitprice the value for jsh_depotitem.TaxUnitPrice
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setTaxunitprice(BigDecimal taxunitprice) {
|
||||
this.taxunitprice = taxunitprice;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.AllPrice
|
||||
*
|
||||
* @return the value of jsh_depotitem.AllPrice
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public BigDecimal getAllprice() {
|
||||
return allprice;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.AllPrice
|
||||
*
|
||||
* @param allprice the value for jsh_depotitem.AllPrice
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setAllprice(BigDecimal allprice) {
|
||||
this.allprice = allprice;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.Remark
|
||||
*
|
||||
* @return the value of jsh_depotitem.Remark
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.Remark
|
||||
*
|
||||
* @param remark the value for jsh_depotitem.Remark
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark == null ? null : remark.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.Img
|
||||
*
|
||||
* @return the value of jsh_depotitem.Img
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.Img
|
||||
*
|
||||
* @param img the value for jsh_depotitem.Img
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setImg(String img) {
|
||||
this.img = img == null ? null : img.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.Incidentals
|
||||
*
|
||||
* @return the value of jsh_depotitem.Incidentals
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public BigDecimal getIncidentals() {
|
||||
return incidentals;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.Incidentals
|
||||
*
|
||||
* @param incidentals the value for jsh_depotitem.Incidentals
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setIncidentals(BigDecimal incidentals) {
|
||||
this.incidentals = incidentals;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.DepotId
|
||||
*
|
||||
* @return the value of jsh_depotitem.DepotId
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Long getDepotid() {
|
||||
return depotid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.DepotId
|
||||
*
|
||||
* @param depotid the value for jsh_depotitem.DepotId
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setDepotid(Long depotid) {
|
||||
this.depotid = depotid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.AnotherDepotId
|
||||
*
|
||||
* @return the value of jsh_depotitem.AnotherDepotId
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Long getAnotherdepotid() {
|
||||
return anotherdepotid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.AnotherDepotId
|
||||
*
|
||||
* @param anotherdepotid the value for jsh_depotitem.AnotherDepotId
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setAnotherdepotid(Long anotherdepotid) {
|
||||
this.anotherdepotid = anotherdepotid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.TaxRate
|
||||
*
|
||||
* @return the value of jsh_depotitem.TaxRate
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public BigDecimal getTaxrate() {
|
||||
return taxrate;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.TaxRate
|
||||
*
|
||||
* @param taxrate the value for jsh_depotitem.TaxRate
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setTaxrate(BigDecimal taxrate) {
|
||||
this.taxrate = taxrate;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.TaxMoney
|
||||
*
|
||||
* @return the value of jsh_depotitem.TaxMoney
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public BigDecimal getTaxmoney() {
|
||||
return taxmoney;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.TaxMoney
|
||||
*
|
||||
* @param taxmoney the value for jsh_depotitem.TaxMoney
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setTaxmoney(BigDecimal taxmoney) {
|
||||
this.taxmoney = taxmoney;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.TaxLastMoney
|
||||
*
|
||||
* @return the value of jsh_depotitem.TaxLastMoney
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public BigDecimal getTaxlastmoney() {
|
||||
return taxlastmoney;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.TaxLastMoney
|
||||
*
|
||||
* @param taxlastmoney the value for jsh_depotitem.TaxLastMoney
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setTaxlastmoney(BigDecimal taxlastmoney) {
|
||||
this.taxlastmoney = taxlastmoney;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.OtherField1
|
||||
*
|
||||
* @return the value of jsh_depotitem.OtherField1
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getOtherfield1() {
|
||||
return otherfield1;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.OtherField1
|
||||
*
|
||||
* @param otherfield1 the value for jsh_depotitem.OtherField1
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setOtherfield1(String otherfield1) {
|
||||
this.otherfield1 = otherfield1 == null ? null : otherfield1.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.OtherField2
|
||||
*
|
||||
* @return the value of jsh_depotitem.OtherField2
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getOtherfield2() {
|
||||
return otherfield2;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.OtherField2
|
||||
*
|
||||
* @param otherfield2 the value for jsh_depotitem.OtherField2
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setOtherfield2(String otherfield2) {
|
||||
this.otherfield2 = otherfield2 == null ? null : otherfield2.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.OtherField3
|
||||
*
|
||||
* @return the value of jsh_depotitem.OtherField3
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getOtherfield3() {
|
||||
return otherfield3;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.OtherField3
|
||||
*
|
||||
* @param otherfield3 the value for jsh_depotitem.OtherField3
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setOtherfield3(String otherfield3) {
|
||||
this.otherfield3 = otherfield3 == null ? null : otherfield3.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.OtherField4
|
||||
*
|
||||
* @return the value of jsh_depotitem.OtherField4
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getOtherfield4() {
|
||||
return otherfield4;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.OtherField4
|
||||
*
|
||||
* @param otherfield4 the value for jsh_depotitem.OtherField4
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setOtherfield4(String otherfield4) {
|
||||
this.otherfield4 = otherfield4 == null ? null : otherfield4.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.OtherField5
|
||||
*
|
||||
* @return the value of jsh_depotitem.OtherField5
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getOtherfield5() {
|
||||
return otherfield5;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.OtherField5
|
||||
*
|
||||
* @param otherfield5 the value for jsh_depotitem.OtherField5
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setOtherfield5(String otherfield5) {
|
||||
this.otherfield5 = otherfield5 == null ? null : otherfield5.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.MType
|
||||
*
|
||||
* @return the value of jsh_depotitem.MType
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getMtype() {
|
||||
return mtype;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.MType
|
||||
*
|
||||
* @param mtype the value for jsh_depotitem.MType
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setMtype(String mtype) {
|
||||
this.mtype = mtype == null ? null : mtype.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.tenant_id
|
||||
*
|
||||
* @return the value of jsh_depotitem.tenant_id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Long getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.tenant_id
|
||||
*
|
||||
* @param tenantId the value for jsh_depotitem.tenant_id
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setTenantId(Long tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column jsh_depotitem.delete_Flag
|
||||
*
|
||||
* @return the value of jsh_depotitem.delete_Flag
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getDeleteFlag() {
|
||||
return deleteFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column jsh_depotitem.delete_Flag
|
||||
*
|
||||
* @param deleteFlag the value for jsh_depotitem.delete_Flag
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setDeleteFlag(String deleteFlag) {
|
||||
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
|
||||
}
|
||||
|
||||
@@ -5,118 +5,46 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DepotItemExample {
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
protected String orderByClause;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
protected boolean distinct;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public DepotItemExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
oredCriteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
@@ -125,41 +53,23 @@ public class DepotItemExample {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
criteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
@@ -375,6 +285,66 @@ public class DepotItemExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMaterialExtendIdIsNull() {
|
||||
addCriterion("material_extend_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMaterialExtendIdIsNotNull() {
|
||||
addCriterion("material_extend_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMaterialExtendIdEqualTo(Long value) {
|
||||
addCriterion("material_extend_id =", value, "materialExtendId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMaterialExtendIdNotEqualTo(Long value) {
|
||||
addCriterion("material_extend_id <>", value, "materialExtendId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMaterialExtendIdGreaterThan(Long value) {
|
||||
addCriterion("material_extend_id >", value, "materialExtendId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMaterialExtendIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("material_extend_id >=", value, "materialExtendId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMaterialExtendIdLessThan(Long value) {
|
||||
addCriterion("material_extend_id <", value, "materialExtendId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMaterialExtendIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("material_extend_id <=", value, "materialExtendId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMaterialExtendIdIn(List<Long> values) {
|
||||
addCriterion("material_extend_id in", values, "materialExtendId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMaterialExtendIdNotIn(List<Long> values) {
|
||||
addCriterion("material_extend_id not in", values, "materialExtendId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMaterialExtendIdBetween(Long value1, Long value2) {
|
||||
addCriterion("material_extend_id between", value1, value2, "materialExtendId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMaterialExtendIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("material_extend_id not between", value1, value2, "materialExtendId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMunitIsNull() {
|
||||
addCriterion("MUnit is null");
|
||||
return (Criteria) this;
|
||||
@@ -1796,25 +1766,12 @@ public class DepotItemExample {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated do_not_delete_during_merge
|
||||
*/
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
|
||||
|
||||
private String priceStrategy;
|
||||
|
||||
private String barCode;
|
||||
|
||||
public Long getMId() {
|
||||
return MId;
|
||||
}
|
||||
@@ -163,4 +165,12 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
|
||||
public void setPriceStrategy(String priceStrategy) {
|
||||
this.priceStrategy = priceStrategy;
|
||||
}
|
||||
|
||||
public String getBarCode() {
|
||||
return barCode;
|
||||
}
|
||||
|
||||
public void setBarCode(String barCode) {
|
||||
this.barCode = barCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.jsh.erp.datasource.entities;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class MaterialExtend {
|
||||
private Long id;
|
||||
|
||||
private Long materialId;
|
||||
|
||||
private String barCode;
|
||||
|
||||
private String commodityUnit;
|
||||
|
||||
private BigDecimal purchaseDecimal;
|
||||
|
||||
private BigDecimal commodityDecimal;
|
||||
|
||||
private BigDecimal wholesaleDecimal;
|
||||
|
||||
private BigDecimal lowDecimal;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String createSerial;
|
||||
|
||||
private String updateSerial;
|
||||
|
||||
private Long updateTime;
|
||||
|
||||
private Long tenantId;
|
||||
|
||||
private String deleteFlag;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getMaterialId() {
|
||||
return materialId;
|
||||
}
|
||||
|
||||
public void setMaterialId(Long materialId) {
|
||||
this.materialId = materialId;
|
||||
}
|
||||
|
||||
public String getBarCode() {
|
||||
return barCode;
|
||||
}
|
||||
|
||||
public void setBarCode(String barCode) {
|
||||
this.barCode = barCode == null ? null : barCode.trim();
|
||||
}
|
||||
|
||||
public String getCommodityUnit() {
|
||||
return commodityUnit;
|
||||
}
|
||||
|
||||
public void setCommodityUnit(String commodityUnit) {
|
||||
this.commodityUnit = commodityUnit == null ? null : commodityUnit.trim();
|
||||
}
|
||||
|
||||
public BigDecimal getPurchaseDecimal() {
|
||||
return purchaseDecimal;
|
||||
}
|
||||
|
||||
public void setPurchaseDecimal(BigDecimal purchaseDecimal) {
|
||||
this.purchaseDecimal = purchaseDecimal;
|
||||
}
|
||||
|
||||
public BigDecimal getCommodityDecimal() {
|
||||
return commodityDecimal;
|
||||
}
|
||||
|
||||
public void setCommodityDecimal(BigDecimal commodityDecimal) {
|
||||
this.commodityDecimal = commodityDecimal;
|
||||
}
|
||||
|
||||
public BigDecimal getWholesaleDecimal() {
|
||||
return wholesaleDecimal;
|
||||
}
|
||||
|
||||
public void setWholesaleDecimal(BigDecimal wholesaleDecimal) {
|
||||
this.wholesaleDecimal = wholesaleDecimal;
|
||||
}
|
||||
|
||||
public BigDecimal getLowDecimal() {
|
||||
return lowDecimal;
|
||||
}
|
||||
|
||||
public void setLowDecimal(BigDecimal lowDecimal) {
|
||||
this.lowDecimal = lowDecimal;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getCreateSerial() {
|
||||
return createSerial;
|
||||
}
|
||||
|
||||
public void setCreateSerial(String createSerial) {
|
||||
this.createSerial = createSerial == null ? null : createSerial.trim();
|
||||
}
|
||||
|
||||
public String getUpdateSerial() {
|
||||
return updateSerial;
|
||||
}
|
||||
|
||||
public void setUpdateSerial(String updateSerial) {
|
||||
this.updateSerial = updateSerial == null ? null : updateSerial.trim();
|
||||
}
|
||||
|
||||
public Long getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Long updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Long getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(Long tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public String getDeleteFlag() {
|
||||
return deleteFlag;
|
||||
}
|
||||
|
||||
public void setDeleteFlag(String deleteFlag) {
|
||||
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,20 @@ public class MaterialVo4Unit extends Material{
|
||||
|
||||
private BigDecimal stock;
|
||||
|
||||
private BigDecimal purchaseDecimal;
|
||||
|
||||
private BigDecimal commodityDecimal;
|
||||
|
||||
private BigDecimal wholesaleDecimal;
|
||||
|
||||
private BigDecimal lowDecimal;
|
||||
|
||||
private String mBarCode;
|
||||
|
||||
private String commodityUnit;
|
||||
|
||||
private Long meId;
|
||||
|
||||
public String getUnitName() {
|
||||
return unitName;
|
||||
}
|
||||
@@ -43,4 +57,60 @@ public class MaterialVo4Unit extends Material{
|
||||
public void setStock(BigDecimal stock) {
|
||||
this.stock = stock;
|
||||
}
|
||||
|
||||
public BigDecimal getPurchaseDecimal() {
|
||||
return purchaseDecimal;
|
||||
}
|
||||
|
||||
public void setPurchaseDecimal(BigDecimal purchaseDecimal) {
|
||||
this.purchaseDecimal = purchaseDecimal;
|
||||
}
|
||||
|
||||
public BigDecimal getCommodityDecimal() {
|
||||
return commodityDecimal;
|
||||
}
|
||||
|
||||
public void setCommodityDecimal(BigDecimal commodityDecimal) {
|
||||
this.commodityDecimal = commodityDecimal;
|
||||
}
|
||||
|
||||
public BigDecimal getWholesaleDecimal() {
|
||||
return wholesaleDecimal;
|
||||
}
|
||||
|
||||
public void setWholesaleDecimal(BigDecimal wholesaleDecimal) {
|
||||
this.wholesaleDecimal = wholesaleDecimal;
|
||||
}
|
||||
|
||||
public BigDecimal getLowDecimal() {
|
||||
return lowDecimal;
|
||||
}
|
||||
|
||||
public void setLowDecimal(BigDecimal lowDecimal) {
|
||||
this.lowDecimal = lowDecimal;
|
||||
}
|
||||
|
||||
public String getmBarCode() {
|
||||
return mBarCode;
|
||||
}
|
||||
|
||||
public void setmBarCode(String mBarCode) {
|
||||
this.mBarCode = mBarCode;
|
||||
}
|
||||
|
||||
public String getCommodityUnit() {
|
||||
return commodityUnit;
|
||||
}
|
||||
|
||||
public void setCommodityUnit(String commodityUnit) {
|
||||
this.commodityUnit = commodityUnit;
|
||||
}
|
||||
|
||||
public Long getMeId() {
|
||||
return meId;
|
||||
}
|
||||
|
||||
public void setMeId(Long meId) {
|
||||
this.meId = meId;
|
||||
}
|
||||
}
|
||||
@@ -6,91 +6,25 @@ import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface DepotItemMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int countByExample(DepotItemExample example);
|
||||
long countByExample(DepotItemExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int deleteByExample(DepotItemExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int insert(DepotItem record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int insertSelective(DepotItem record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
List<DepotItem> selectByExample(DepotItemExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
DepotItem selectByPrimaryKey(Long id);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int updateByExampleSelective(@Param("record") DepotItem record, @Param("example") DepotItemExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int updateByExample(@Param("record") DepotItem record, @Param("example") DepotItemExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int updateByPrimaryKeySelective(DepotItem record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table jsh_depotitem
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
int updateByPrimaryKey(DepotItem record);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.jsh.erp.datasource.mappers;
|
||||
|
||||
import com.jsh.erp.datasource.entities.MaterialExtend;
|
||||
import com.jsh.erp.datasource.entities.MaterialExtendExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface MaterialExtendMapper {
|
||||
long countByExample(MaterialExtendExample example);
|
||||
|
||||
int deleteByExample(MaterialExtendExample example);
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(MaterialExtend record);
|
||||
|
||||
int insertSelective(MaterialExtend record);
|
||||
|
||||
List<MaterialExtend> selectByExample(MaterialExtendExample example);
|
||||
|
||||
MaterialExtend selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") MaterialExtend record, @Param("example") MaterialExtendExample example);
|
||||
|
||||
int updateByExample(@Param("record") MaterialExtend record, @Param("example") MaterialExtendExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(MaterialExtend record);
|
||||
|
||||
int updateByPrimaryKey(MaterialExtend record);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.jsh.erp.datasource.mappers;
|
||||
|
||||
import com.jsh.erp.datasource.entities.MaterialExtend;
|
||||
import com.jsh.erp.datasource.vo.MaterialExtendVo4List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface MaterialExtendMapperEx {
|
||||
|
||||
int batchDeleteMaterialExtendByIds(@Param("ids") String ids[]);
|
||||
|
||||
List<MaterialExtendVo4List> getDetailList(
|
||||
@Param("materialId") Long materialId);
|
||||
|
||||
Long getMaxTimeByTenantAndTime(
|
||||
@Param("tenantId") Long tenantId,
|
||||
@Param("lastTime") Long lastTime,
|
||||
@Param("syncNum") Long syncNum);
|
||||
|
||||
List<MaterialExtend> getListByMId(@Param("ids") Long ids[]);
|
||||
}
|
||||
@@ -19,6 +19,7 @@ public interface MaterialMapperEx {
|
||||
|
||||
List<MaterialVo4Unit> selectByConditionMaterial(
|
||||
@Param("name") String name,
|
||||
@Param("standard") String standard,
|
||||
@Param("model") String model,
|
||||
@Param("categoryIds") String categoryIds,
|
||||
@Param("mpList") String mpList,
|
||||
@@ -27,6 +28,7 @@ public interface MaterialMapperEx {
|
||||
|
||||
Long countsByMaterial(
|
||||
@Param("name") String name,
|
||||
@Param("standard") String standard,
|
||||
@Param("model") String model,
|
||||
@Param("categoryIds") String categoryIds,
|
||||
@Param("mpList") String mpList);
|
||||
@@ -35,8 +37,16 @@ public interface MaterialMapperEx {
|
||||
|
||||
List<MaterialVo4Unit> findById(@Param("id") Long id);
|
||||
|
||||
List<MaterialVo4Unit> findByIdWithBarCode(@Param("meId") Long meId);
|
||||
|
||||
List<MaterialVo4Unit> findBySelect();
|
||||
|
||||
List<MaterialVo4Unit> findBySelectWithBarCode(@Param("q") String q,
|
||||
@Param("offset") Integer offset,
|
||||
@Param("rows") Integer rows);
|
||||
|
||||
int findBySelectWithBarCodeCount(@Param("q") String q);
|
||||
|
||||
int updatePriceNullByPrimaryKey(Long id);
|
||||
|
||||
int updateUnitIdNullByPrimaryKey(Long id);
|
||||
@@ -60,5 +70,8 @@ public interface MaterialMapperEx {
|
||||
|
||||
List<Material> getMaterialListByUnitIds(@Param("unitIds") String[] unitIds);
|
||||
|
||||
int insertSelectiveEx(Material record);
|
||||
String getMaxBarCode();
|
||||
|
||||
List<MaterialVo4Unit> getMaterialByMeId(
|
||||
@Param("meId") Long meId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.jsh.erp.datasource.vo;
|
||||
|
||||
import com.jsh.erp.datasource.entities.MaterialExtend;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class MaterialExtendVo4List extends MaterialExtend {
|
||||
|
||||
private String supplier;
|
||||
|
||||
private String originPlace;
|
||||
|
||||
private String unit;
|
||||
|
||||
private String brandName;
|
||||
|
||||
private BigDecimal guaranteePeriod;
|
||||
|
||||
private BigDecimal memberDecimal;
|
||||
|
||||
public String getSupplier() {
|
||||
return supplier;
|
||||
}
|
||||
|
||||
public void setSupplier(String supplier) {
|
||||
this.supplier = supplier;
|
||||
}
|
||||
|
||||
public String getOriginPlace() {
|
||||
return originPlace;
|
||||
}
|
||||
|
||||
public void setOriginPlace(String originPlace) {
|
||||
this.originPlace = originPlace;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void setUnit(String unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
public String getBrandName() {
|
||||
return brandName;
|
||||
}
|
||||
|
||||
public void setBrandName(String brandName) {
|
||||
this.brandName = brandName;
|
||||
}
|
||||
|
||||
public BigDecimal getGuaranteePeriod() {
|
||||
return guaranteePeriod;
|
||||
}
|
||||
|
||||
public void setGuaranteePeriod(BigDecimal guaranteePeriod) {
|
||||
this.guaranteePeriod = guaranteePeriod;
|
||||
}
|
||||
|
||||
public BigDecimal getMemberDecimal() {
|
||||
return memberDecimal;
|
||||
}
|
||||
|
||||
public void setMemberDecimal(BigDecimal memberDecimal) {
|
||||
this.memberDecimal = memberDecimal;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.jsh.erp.service.MaterialExtend;
|
||||
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service(value = "material_extend")
|
||||
@MaterialExtendResource
|
||||
public class MaterialExtendComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private MaterialExtendService materialExtendService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return materialExtendService.getMaterialExtend(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getMaterialList(map);
|
||||
}
|
||||
|
||||
private List<?> getMaterialList(Map<String, String> map) throws Exception{
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
|
||||
return 0L;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(String beanJson, HttpServletRequest request) throws Exception{
|
||||
return materialExtendService.insertMaterialExtend(beanJson, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
|
||||
return materialExtendService.updateMaterialExtend(beanJson, id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return materialExtendService.deleteMaterialExtend(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchDelete(String ids, HttpServletRequest request)throws Exception {
|
||||
return materialExtendService.batchDeleteMaterialExtendByIds(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return materialExtendService.checkIsExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jsh.erp.service.MaterialExtend;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "materialExtend", type = 1574012422)
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface MaterialExtendResource {
|
||||
}
|
||||
@@ -0,0 +1,329 @@
|
||||
package com.jsh.erp.service.MaterialExtend;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.datasource.entities.MaterialExtend;
|
||||
import com.jsh.erp.datasource.entities.MaterialExtendExample;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.datasource.mappers.MaterialExtendMapper;
|
||||
import com.jsh.erp.datasource.mappers.MaterialExtendMapperEx;
|
||||
import com.jsh.erp.datasource.vo.MaterialExtendVo4List;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class MaterialExtendService {
|
||||
private Logger logger = LoggerFactory.getLogger(MaterialExtendService.class);
|
||||
|
||||
@Resource
|
||||
private MaterialExtendMapper materialExtendMapper;
|
||||
@Resource
|
||||
private MaterialExtendMapperEx materialExtendMapperEx;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
public MaterialExtend getMaterialExtend(long id)throws Exception {
|
||||
MaterialExtend result=null;
|
||||
try{
|
||||
result=materialExtendMapper.selectByPrimaryKey(id);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public List<MaterialExtendVo4List> getDetailList(Long materialId) {
|
||||
List<MaterialExtendVo4List> list=null;
|
||||
try{
|
||||
list = materialExtendMapperEx.getDetailList(materialId);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<MaterialExtend> getListByMIds(List<Long> idList) {
|
||||
List<MaterialExtend> meList = null;
|
||||
try{
|
||||
Long [] idArray= StringUtil.listToLongArray(idList);
|
||||
if(idArray!=null && idArray.length>0) {
|
||||
meList = materialExtendMapperEx.getListByMId(idArray);
|
||||
}
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return meList;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public String saveDetials(String inserted, String deleted, String updated,Long materialId) throws Exception {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
logService.insertLog("商品价格扩展",
|
||||
BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
|
||||
//转为json
|
||||
JSONArray insertedJson = JSONArray.parseArray(inserted);
|
||||
JSONArray deletedJson = JSONArray.parseArray(deleted);
|
||||
JSONArray updatedJson = JSONArray.parseArray(updated);
|
||||
if (null != insertedJson) {
|
||||
for (int i = 0; i < insertedJson.size(); i++) {
|
||||
MaterialExtend materialExtend = new MaterialExtend();
|
||||
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
|
||||
materialExtend.setMaterialId(materialId);
|
||||
if (StringUtils.isNotEmpty(tempInsertedJson.getString("BarCode"))) {
|
||||
materialExtend.setBarCode(tempInsertedJson.getString("BarCode"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(tempInsertedJson.getString("CommodityUnit"))) {
|
||||
materialExtend.setCommodityUnit(tempInsertedJson.getString("CommodityUnit"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(tempInsertedJson.getString("PurchaseDecimal"))) {
|
||||
materialExtend.setPurchaseDecimal(tempInsertedJson.getBigDecimal("PurchaseDecimal"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(tempInsertedJson.getString("CommodityDecimal"))) {
|
||||
materialExtend.setCommodityDecimal(tempInsertedJson.getBigDecimal("CommodityDecimal"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(tempInsertedJson.getString("WholesaleDecimal"))) {
|
||||
materialExtend.setWholesaleDecimal(tempInsertedJson.getBigDecimal("WholesaleDecimal"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(tempInsertedJson.getString("LowDecimal"))) {
|
||||
materialExtend.setLowDecimal(tempInsertedJson.getBigDecimal("LowDecimal"));
|
||||
}
|
||||
this.insertMaterialExtend(materialExtend);
|
||||
}
|
||||
}
|
||||
if (null != deletedJson) {
|
||||
StringBuffer bf=new StringBuffer();
|
||||
for (int i = 0; i < deletedJson.size(); i++) {
|
||||
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
|
||||
bf.append(tempDeletedJson.getLong("Id"));
|
||||
if(i<(deletedJson.size()-1)){
|
||||
bf.append(",");
|
||||
}
|
||||
}
|
||||
this.batchDeleteMaterialExtendByIds(bf.toString(), request);
|
||||
}
|
||||
if (null != updatedJson) {
|
||||
for (int i = 0; i < updatedJson.size(); i++) {
|
||||
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
|
||||
MaterialExtend materialExtend = new MaterialExtend();
|
||||
materialExtend.setId(tempUpdatedJson.getLong("Id"));
|
||||
if (StringUtils.isNotEmpty(tempUpdatedJson.getString("BarCode"))) {
|
||||
materialExtend.setBarCode(tempUpdatedJson.getString("BarCode"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(tempUpdatedJson.getString("CommodityUnit"))) {
|
||||
materialExtend.setCommodityUnit(tempUpdatedJson.getString("CommodityUnit"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(tempUpdatedJson.getString("PurchaseDecimal"))) {
|
||||
materialExtend.setPurchaseDecimal(tempUpdatedJson.getBigDecimal("PurchaseDecimal"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(tempUpdatedJson.getString("CommodityDecimal"))) {
|
||||
materialExtend.setCommodityDecimal(tempUpdatedJson.getBigDecimal("CommodityDecimal"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(tempUpdatedJson.getString("WholesaleDecimal"))) {
|
||||
materialExtend.setWholesaleDecimal(tempUpdatedJson.getBigDecimal("WholesaleDecimal"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(tempUpdatedJson.getString("LowDecimal"))) {
|
||||
materialExtend.setLowDecimal(tempUpdatedJson.getBigDecimal("LowDecimal"));
|
||||
}
|
||||
this.updateMaterialExtend(materialExtend, request);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertMaterialExtend(MaterialExtend materialExtend)throws Exception {
|
||||
User user = userService.getCurrentUser();
|
||||
materialExtend.setDeleteFlag(BusinessConstants.DELETE_FLAG_EXISTS);
|
||||
materialExtend.setCreateTime(new Date());
|
||||
materialExtend.setUpdateTime(new Date().getTime());
|
||||
materialExtend.setCreateSerial(user.getLoginame());
|
||||
materialExtend.setUpdateSerial(user.getLoginame());
|
||||
int result =0;
|
||||
try{
|
||||
result= materialExtendMapper.insertSelective(materialExtend);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateMaterialExtend(MaterialExtend MaterialExtend, HttpServletRequest request) throws Exception{
|
||||
User user = userService.getCurrentUser();
|
||||
MaterialExtend.setUpdateTime(new Date().getTime());
|
||||
MaterialExtend.setUpdateSerial(user.getLoginame());
|
||||
int res =0;
|
||||
try{
|
||||
res= materialExtendMapper.updateByPrimaryKeySelective(MaterialExtend);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public int checkIsExist(Long id, String MaterialExtendName)throws Exception {
|
||||
MaterialExtendExample example = new MaterialExtendExample();
|
||||
MaterialExtendExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andBarCodeEqualTo(MaterialExtendName);
|
||||
if (id > 0) {
|
||||
criteria.andIdNotEqualTo(id);
|
||||
}
|
||||
List<MaterialExtend> list =null;
|
||||
try{
|
||||
list= materialExtendMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list==null?0:list.size();
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteMaterialExtend(Long id, HttpServletRequest request)throws Exception {
|
||||
int result =0;
|
||||
MaterialExtend materialExtend = new MaterialExtend();
|
||||
materialExtend.setId(id);
|
||||
materialExtend.setDeleteFlag(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
Object userInfo = request.getSession().getAttribute("user");
|
||||
User user = (User)userInfo;
|
||||
materialExtend.setUpdateTime(new Date().getTime());
|
||||
materialExtend.setUpdateSerial(user.getLoginame());
|
||||
try{
|
||||
result= materialExtendMapper.updateByPrimaryKeySelective(materialExtend);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteMaterialExtendByIds(String ids, HttpServletRequest request) throws Exception{
|
||||
logService.insertLog("商品价格扩展",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
String [] idArray=ids.split(",");
|
||||
int result = 0;
|
||||
try{
|
||||
result = materialExtendMapperEx.batchDeleteMaterialExtendByIds(idArray);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public int insertMaterialExtend(String beanJson, HttpServletRequest request) throws Exception{
|
||||
MaterialExtend materialExtend = JSONObject.parseObject(beanJson, MaterialExtend.class);
|
||||
int result=0;
|
||||
try{
|
||||
result = materialExtendMapper.insertSelective(materialExtend);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public int updateMaterialExtend(String beanJson, Long id, HttpServletRequest request)throws Exception {
|
||||
MaterialExtend materialExtend = JSONObject.parseObject(beanJson, MaterialExtend.class);
|
||||
int result=0;
|
||||
try{
|
||||
result = materialExtendMapper.insertSelective(materialExtend);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<MaterialExtend> getMaterialExtendByTenantAndTime(Long tenantId, Long lastTime, Long syncNum)throws Exception {
|
||||
List<MaterialExtend> list=new ArrayList<MaterialExtend>();
|
||||
try{
|
||||
//先获取最大的时间戳,再查两个时间戳之间的数据,这样同步能够防止丢失数据(应为时间戳有重复)
|
||||
Long maxTime = materialExtendMapperEx.getMaxTimeByTenantAndTime(tenantId, lastTime, syncNum);
|
||||
if(tenantId!=null && lastTime!=null && maxTime!=null) {
|
||||
MaterialExtendExample example = new MaterialExtendExample();
|
||||
example.createCriteria().andTenantIdEqualTo(tenantId)
|
||||
.andUpdateTimeGreaterThan(lastTime)
|
||||
.andUpdateTimeLessThanOrEqualTo(maxTime);
|
||||
list=materialExtendMapper.selectByExample(example);
|
||||
}
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条码更新零售价
|
||||
* @param retailPrice
|
||||
* @param barCode
|
||||
*/
|
||||
public int updateRetailPriceByCode(BigDecimal retailPrice,String barCode) {
|
||||
int result=0;
|
||||
try{
|
||||
MaterialExtend materialExtend = new MaterialExtend();
|
||||
materialExtend.setCommodityDecimal(retailPrice);
|
||||
MaterialExtendExample example = new MaterialExtendExample();
|
||||
example.createCriteria().andBarCodeEqualTo(barCode);
|
||||
result = materialExtendMapper.updateByExampleSelective(materialExtend, example);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条码更新进价
|
||||
* @param purchasePrice
|
||||
* @param barCode
|
||||
*/
|
||||
public int updatePurchasePriceByCode(BigDecimal purchasePrice,String barCode) {
|
||||
int result=0;
|
||||
try{
|
||||
MaterialExtend materialExtend = new MaterialExtend();
|
||||
materialExtend.setPurchaseDecimal(purchasePrice);
|
||||
MaterialExtendExample example = new MaterialExtendExample();
|
||||
example.createCriteria().andBarCodeEqualTo(barCode);
|
||||
result = materialExtendMapper.updateByExampleSelective(materialExtend, example);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条码更新进价
|
||||
* @param barCode
|
||||
* @param barCode
|
||||
*/
|
||||
public MaterialExtend getMaterialExtendByBarCode(String barCode) {
|
||||
MaterialExtend me = new MaterialExtend();
|
||||
try{
|
||||
MaterialExtendExample example = new MaterialExtendExample();
|
||||
example.createCriteria().andBarCodeEqualTo(barCode);
|
||||
List<MaterialExtend> list = materialExtendMapper.selectByExample(example);
|
||||
if(list!=null && list.size()>0) {
|
||||
me = list.get(0);
|
||||
}
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return me;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
|
||||
import com.jsh.erp.datasource.vo.DepotItemVo4Stock;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.MaterialExtend.MaterialExtendService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.material.MaterialService;
|
||||
import com.jsh.erp.service.serialNumber.SerialNumberService;
|
||||
@@ -49,6 +50,8 @@ public class DepotItemService {
|
||||
@Resource
|
||||
private MaterialService materialService;
|
||||
@Resource
|
||||
private MaterialExtendService materialExtendService;
|
||||
@Resource
|
||||
SerialNumberMapperEx serialNumberMapperEx;
|
||||
@Resource
|
||||
private DepotHeadMapper depotHeadMapper;
|
||||
@@ -349,20 +352,18 @@ public class DepotItemService {
|
||||
DepotItem depotItem = new DepotItem();
|
||||
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
|
||||
depotItem.setHeaderid(headerId);
|
||||
depotItem.setMaterialid(tempInsertedJson.getLong("MaterialId"));
|
||||
Long materialExtendId = tempInsertedJson.getLong("MaterialExtendId");
|
||||
Long materialId = materialExtendService.getMaterialExtend(materialExtendId).getMaterialId();
|
||||
depotItem.setMaterialid(materialId);
|
||||
depotItem.setMaterialExtendId(tempInsertedJson.getLong("MaterialExtendId"));
|
||||
depotItem.setMunit(tempInsertedJson.getString("Unit"));
|
||||
if (!StringUtil.isEmpty(tempInsertedJson.get("OperNumber").toString())) {
|
||||
depotItem.setOpernumber(tempInsertedJson.getBigDecimal("OperNumber"));
|
||||
try {
|
||||
String Unit = tempInsertedJson.get("Unit").toString();
|
||||
BigDecimal oNumber = tempInsertedJson.getBigDecimal("OperNumber");
|
||||
Long mId = Long.parseLong(tempInsertedJson.get("MaterialId").toString());
|
||||
/***
|
||||
* 为什么调用的方法要先把基础单位去掉,去掉之后后续还能获取到?
|
||||
* */
|
||||
//以下进行单位换算
|
||||
// String UnitName = findUnitName(mId); //查询计量单位名称
|
||||
String unitName = materialService.findUnitName(mId);
|
||||
String unitName = materialService.findUnitName(materialId); //查询计量单位名称
|
||||
if (!StringUtil.isEmpty(unitName)) {
|
||||
String unitList = unitName.substring(0, unitName.indexOf("("));
|
||||
String ratioList = unitName.substring(unitName.indexOf("("));
|
||||
@@ -484,7 +485,13 @@ public class DepotItemService {
|
||||
this.updateDepotItemWithObj(depotItem);
|
||||
}
|
||||
depotItem.setId(tempUpdatedJson.getLong("Id"));
|
||||
depotItem.setMaterialid(tempUpdatedJson.getLong("MaterialId"));
|
||||
Long materialId = null;
|
||||
if (StringUtil.isExist(tempUpdatedJson.get("MaterialExtendId"))) {
|
||||
Long materialExtendId = tempUpdatedJson.getLong("MaterialExtendId");
|
||||
materialId = materialExtendService.getMaterialExtend(materialExtendId).getMaterialId();
|
||||
depotItem.setMaterialid(materialId);
|
||||
depotItem.setMaterialExtendId(tempUpdatedJson.getLong("MaterialExtendId"));
|
||||
}
|
||||
depotItem.setMunit(tempUpdatedJson.getString("Unit"));
|
||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) {
|
||||
depotItem.setOpernumber(tempUpdatedJson.getBigDecimal("OperNumber"));
|
||||
@@ -493,8 +500,7 @@ public class DepotItemService {
|
||||
BigDecimal oNumber = tempUpdatedJson.getBigDecimal("OperNumber");
|
||||
Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString());
|
||||
//以下进行单位换算
|
||||
// String UnitName = findUnitName(mId); //查询计量单位名称
|
||||
String unitName = materialService.findUnitName(mId);
|
||||
String unitName = materialService.findUnitName(mId); //查询计量单位名称
|
||||
if (!StringUtil.isEmpty(unitName)) {
|
||||
String unitList = unitName.substring(0, unitName.indexOf("("));
|
||||
String ratioList = unitName.substring(unitName.indexOf("("));
|
||||
|
||||
@@ -33,21 +33,22 @@ public class MaterialComponent implements ICommonQuery {
|
||||
private List<?> getMaterialList(Map<String, String> map) throws Exception{
|
||||
String search = map.get(Constants.SEARCH);
|
||||
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");
|
||||
String order = QueryUtils.order(map);
|
||||
return materialService.select(name, model,categoryIds,mpList, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
return materialService.select(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 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, model,categoryIds,mpList);
|
||||
return materialService.countMaterial(name, standard, model,categoryIds,mpList);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.jsh.erp.datasource.mappers.MaterialMapperEx;
|
||||
import com.jsh.erp.datasource.mappers.MaterialStockMapper;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.MaterialExtend.MaterialExtendService;
|
||||
import com.jsh.erp.service.depot.DepotService;
|
||||
import com.jsh.erp.service.depotItem.DepotItemService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
@@ -59,6 +60,8 @@ public class MaterialService {
|
||||
private MaterialStockMapper materialStockMapper;
|
||||
@Resource
|
||||
private DepotService depotService;
|
||||
@Resource
|
||||
private MaterialExtendService materialExtendService;
|
||||
|
||||
public Material getMaterial(long id)throws Exception {
|
||||
Material result=null;
|
||||
@@ -82,27 +85,26 @@ public class MaterialService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<MaterialVo4Unit> select(String name, String model, String categoryIds,String mpList, int offset, int rows)
|
||||
public List<MaterialVo4Unit> select(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> list =null;
|
||||
try{
|
||||
list= materialMapperEx.selectByConditionMaterial(name, model,categoryIds,mpList, offset, rows);
|
||||
list= materialMapperEx.selectByConditionMaterial(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 = "";
|
||||
for (int i = 0; i < mpArr.length; i++) {
|
||||
if (mpArr[i].equals("颜色")) {
|
||||
materialOther = materialOther + ((m.getColor() == null || m.getColor().equals("")) ? "" : "(" + m.getColor() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("规格")) {
|
||||
materialOther = materialOther + ((m.getStandard() == null || m.getStandard().equals("")) ? "" : "(" + m.getStandard() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("制造商")) {
|
||||
materialOther = materialOther + ((m.getMfrs() == null || m.getMfrs().equals("")) ? "" : "(" + m.getMfrs() + ")");
|
||||
}
|
||||
@@ -119,16 +121,24 @@ 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 model, String categoryIds,String mpList)throws Exception {
|
||||
public Long countMaterial(String name, String standard, String model, String categoryIds,String mpList)throws Exception {
|
||||
Long result =null;
|
||||
try{
|
||||
result= materialMapperEx.countsByMaterial(name, model,categoryIds,mpList);
|
||||
result= materialMapperEx.countsByMaterial(name, standard, model, categoryIds, mpList);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
@@ -137,13 +147,18 @@ public class MaterialService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertMaterial(String beanJson, HttpServletRequest request)throws Exception {
|
||||
Material material = JSONObject.parseObject(beanJson, Material.class);
|
||||
material.setEnabled(true);
|
||||
int result =0;
|
||||
Material m = JSONObject.parseObject(beanJson, Material.class);
|
||||
m.setEnabled(true);
|
||||
try{
|
||||
result= materialMapper.insertSelective(material);
|
||||
Long mId = null;
|
||||
materialMapper.insertSelective(m);
|
||||
List<Material> materials = getMaterialListByParam(m.getName(),m.getModel(),m.getColor(),
|
||||
m.getStandard(), m.getMfrs(),m.getUnit(),m.getUnitid());
|
||||
if(materials!=null && materials.size()>0) {
|
||||
mId = materials.get(0).getId();
|
||||
}
|
||||
JSONObject mObj = JSON.parseObject(beanJson);
|
||||
Long mId = material.getId();
|
||||
materialExtendService.saveDetials(mObj.getString("inserted"), mObj.getString("deleted"), mObj.getString("updated"), mId);
|
||||
if(mObj.get("stock")!=null) {
|
||||
String stockStr = mObj.getString("stock");
|
||||
JSONArray stockArr = JSONArray.parseArray(stockStr);
|
||||
@@ -159,19 +174,19 @@ public class MaterialService {
|
||||
}
|
||||
}
|
||||
logService.insertLog("商品", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
|
||||
return 1;
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
return 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateMaterial(String beanJson, Long id, HttpServletRequest request) throws Exception{
|
||||
Material material = JSONObject.parseObject(beanJson, Material.class);
|
||||
material.setId(id);
|
||||
int res =0;
|
||||
try{
|
||||
res= materialMapper.updateByPrimaryKeySelective(material);
|
||||
materialMapper.updateByPrimaryKeySelective(material);
|
||||
Long unitId = material.getUnitid();
|
||||
if(unitId != null) {
|
||||
materialMapperEx.updatePriceNullByPrimaryKey(id); //将价格置空
|
||||
@@ -179,6 +194,7 @@ public class MaterialService {
|
||||
materialMapperEx.updateUnitIdNullByPrimaryKey(id); //将多单位置空
|
||||
}
|
||||
JSONObject mObj = JSON.parseObject(beanJson);
|
||||
materialExtendService.saveDetials(mObj.getString("inserted"),mObj.getString("deleted"),mObj.getString("updated"),id);
|
||||
if(mObj.get("stock")!=null) {
|
||||
String stockStr = mObj.getString("stock");
|
||||
JSONArray stockArr = JSONArray.parseArray(stockStr);
|
||||
@@ -199,11 +215,11 @@ public class MaterialService {
|
||||
}
|
||||
logService.insertLog("商品",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
|
||||
return 1;
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
@@ -310,6 +326,16 @@ public class MaterialService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<MaterialVo4Unit> findByIdWithBarCode(Long meId)throws Exception{
|
||||
List<MaterialVo4Unit> list =null;
|
||||
try{
|
||||
list= materialMapperEx.findByIdWithBarCode(meId);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<MaterialVo4Unit> findBySelect()throws Exception{
|
||||
List<MaterialVo4Unit> list =null;
|
||||
try{
|
||||
@@ -333,6 +359,29 @@ public class MaterialService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<MaterialVo4Unit> findBySelectWithBarCode(String q,Integer offset, Integer rows)throws Exception{
|
||||
List<MaterialVo4Unit> list =null;
|
||||
try{
|
||||
list= materialMapperEx.findBySelectWithBarCode(q, offset, rows);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public int findBySelectWithBarCodeCount(String q)throws Exception{
|
||||
int result=0;
|
||||
try{
|
||||
result = materialMapperEx.findBySelectWithBarCodeCount(q);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<MaterialVo4Unit> findByAll(String name, String model, String categoryIds)throws Exception {
|
||||
List<MaterialVo4Unit> resList = new ArrayList<MaterialVo4Unit>();
|
||||
List<MaterialVo4Unit> list =null;
|
||||
@@ -442,8 +491,12 @@ public class MaterialService {
|
||||
List<Material> materials = getMaterialListByParam(m.getName(),m.getModel(),m.getColor(),m.getStandard(),
|
||||
m.getMfrs(),m.getUnit(),m.getUnitid());
|
||||
if(materials.size()<=0) {
|
||||
materialMapperEx.insertSelectiveEx(m);
|
||||
mId = m.getId();
|
||||
materialMapper.insertSelective(m);
|
||||
List<Material> newList = getMaterialListByParam(m.getName(),m.getModel(),m.getColor(),m.getStandard(),
|
||||
m.getMfrs(),m.getUnit(),m.getUnitid());
|
||||
if(newList!=null && newList.size()>0) {
|
||||
mId = newList.get(0).getId();
|
||||
}
|
||||
} else {
|
||||
mId = materials.get(0).getId();
|
||||
String materialJson = JSON.toJSONString(m);
|
||||
@@ -658,4 +711,19 @@ public class MaterialService {
|
||||
}
|
||||
return stock;
|
||||
}
|
||||
|
||||
public List<MaterialVo4Unit> getMaterialByMeId(long meId) {
|
||||
List<MaterialVo4Unit> result = new ArrayList<MaterialVo4Unit>();
|
||||
try{
|
||||
result= materialMapperEx.getMaterialByMeId(meId);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getMaxBarCode() {
|
||||
String maxBarCodeOld = materialMapperEx.getMaxBarCode();
|
||||
return Long.parseLong(maxBarCodeOld)+"";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +148,13 @@ public class StringUtil {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
public static Long[] listToLongArray(List<Long> list) {
|
||||
if (list != null && !list.isEmpty()) {
|
||||
return list.toArray(new Long[list.size()]);
|
||||
}
|
||||
return new Long[0];
|
||||
}
|
||||
|
||||
public static List<String> stringToListArray(String[] strings) {
|
||||
if (strings != null && strings.length > 0) {
|
||||
return Arrays.asList(strings);
|
||||
@@ -223,6 +230,19 @@ public class StringUtil {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static boolean isExist(Object value) {
|
||||
if(value!=null) {
|
||||
String str = value.toString();
|
||||
if("".equals(str.trim())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
int i = 10/3;
|
||||
System.out.println(i);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,6 +28,7 @@
|
||||
<result column="AnotherDepotName" jdbcType="VARCHAR" property="AnotherDepotName" />
|
||||
<result column="UnitId" jdbcType="BIGINT" property="UnitId" />
|
||||
<result column="UName" jdbcType="VARCHAR" property="UName" />
|
||||
<result column="barCode" jdbcType="VARCHAR" property="barCode" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap extends="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap" id="ResultByMaterial" type="com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx">
|
||||
@@ -134,9 +135,10 @@
|
||||
<select id="getDetailList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultWithInfoExMap">
|
||||
select di.*,m.Name MName,m.Model MModel,m.Unit MaterialUnit,m.Color MColor,m.Standard MStandard,m.Mfrs MMfrs,
|
||||
m.OtherField1 MOtherField1,m.OtherField2 MOtherField2,m.OtherField3 MOtherField3,
|
||||
dp1.name DepotName,dp2.name AnotherDepotName, u.id UnitId, u.UName
|
||||
dp1.name DepotName,dp2.name AnotherDepotName, u.id UnitId, u.UName, me.bar_code barCode
|
||||
from jsh_depotitem di
|
||||
left join jsh_material m on di.MaterialId=m.id and ifnull(m.delete_Flag,'0') !='1'
|
||||
left join jsh_material_extend me on me.id=di.material_extend_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_depot dp1 on di.DepotId=dp1.id and ifnull(dp1.delete_Flag,'0') !='1'
|
||||
left join jsh_depot dp2 on di.AnotherDepotId=dp2.id and ifnull(dp2.delete_Flag,'0') !='1'
|
||||
|
||||
353
src/main/resources/mapper_xml/MaterialExtendMapper.xml
Normal file
353
src/main/resources/mapper_xml/MaterialExtendMapper.xml
Normal file
@@ -0,0 +1,353 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jsh.erp.datasource.mappers.MaterialExtendMapper">
|
||||
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.MaterialExtend">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="material_id" jdbcType="BIGINT" property="materialId" />
|
||||
<result column="bar_code" jdbcType="VARCHAR" property="barCode" />
|
||||
<result column="commodity_unit" jdbcType="VARCHAR" property="commodityUnit" />
|
||||
<result column="purchase_decimal" jdbcType="DECIMAL" property="purchaseDecimal" />
|
||||
<result column="commodity_decimal" jdbcType="DECIMAL" property="commodityDecimal" />
|
||||
<result column="wholesale_decimal" jdbcType="DECIMAL" property="wholesaleDecimal" />
|
||||
<result column="low_decimal" jdbcType="DECIMAL" property="lowDecimal" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="create_serial" jdbcType="VARCHAR" property="createSerial" />
|
||||
<result column="update_serial" jdbcType="VARCHAR" property="updateSerial" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
|
||||
<result column="delete_Flag" jdbcType="VARCHAR" property="deleteFlag" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, material_id, bar_code, commodity_unit, purchase_decimal, commodity_decimal, wholesale_decimal,
|
||||
low_decimal, create_time, create_serial, update_serial, update_time, tenant_id, delete_Flag
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExtendExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from jsh_material_extend
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from jsh_material_extend
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from jsh_material_extend
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExtendExample">
|
||||
delete from jsh_material_extend
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.MaterialExtend">
|
||||
insert into jsh_material_extend (id, material_id, bar_code,
|
||||
commodity_unit, purchase_decimal, commodity_decimal,
|
||||
wholesale_decimal, low_decimal, create_time,
|
||||
create_serial, update_serial, update_time,
|
||||
tenant_id, delete_Flag)
|
||||
values (#{id,jdbcType=BIGINT}, #{materialId,jdbcType=BIGINT}, #{barCode,jdbcType=VARCHAR},
|
||||
#{commodityUnit,jdbcType=VARCHAR}, #{purchaseDecimal,jdbcType=DECIMAL}, #{commodityDecimal,jdbcType=DECIMAL},
|
||||
#{wholesaleDecimal,jdbcType=DECIMAL}, #{lowDecimal,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{createSerial,jdbcType=VARCHAR}, #{updateSerial,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT},
|
||||
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.MaterialExtend">
|
||||
insert into jsh_material_extend
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="materialId != null">
|
||||
material_id,
|
||||
</if>
|
||||
<if test="barCode != null">
|
||||
bar_code,
|
||||
</if>
|
||||
<if test="commodityUnit != null">
|
||||
commodity_unit,
|
||||
</if>
|
||||
<if test="purchaseDecimal != null">
|
||||
purchase_decimal,
|
||||
</if>
|
||||
<if test="commodityDecimal != null">
|
||||
commodity_decimal,
|
||||
</if>
|
||||
<if test="wholesaleDecimal != null">
|
||||
wholesale_decimal,
|
||||
</if>
|
||||
<if test="lowDecimal != null">
|
||||
low_decimal,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="createSerial != null">
|
||||
create_serial,
|
||||
</if>
|
||||
<if test="updateSerial != null">
|
||||
update_serial,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id,
|
||||
</if>
|
||||
<if test="deleteFlag != null">
|
||||
delete_Flag,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="materialId != null">
|
||||
#{materialId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="barCode != null">
|
||||
#{barCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="commodityUnit != null">
|
||||
#{commodityUnit,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="purchaseDecimal != null">
|
||||
#{purchaseDecimal,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="commodityDecimal != null">
|
||||
#{commodityDecimal,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="wholesaleDecimal != null">
|
||||
#{wholesaleDecimal,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="lowDecimal != null">
|
||||
#{lowDecimal,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="createSerial != null">
|
||||
#{createSerial,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateSerial != null">
|
||||
#{updateSerial,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
#{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="deleteFlag != null">
|
||||
#{deleteFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExtendExample" resultType="java.lang.Long">
|
||||
select count(*) from jsh_material_extend
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update jsh_material_extend
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.materialId != null">
|
||||
material_id = #{record.materialId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.barCode != null">
|
||||
bar_code = #{record.barCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.commodityUnit != null">
|
||||
commodity_unit = #{record.commodityUnit,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.purchaseDecimal != null">
|
||||
purchase_decimal = #{record.purchaseDecimal,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.commodityDecimal != null">
|
||||
commodity_decimal = #{record.commodityDecimal,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.wholesaleDecimal != null">
|
||||
wholesale_decimal = #{record.wholesaleDecimal,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.lowDecimal != null">
|
||||
low_decimal = #{record.lowDecimal,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="record.createSerial != null">
|
||||
create_serial = #{record.createSerial,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.updateSerial != null">
|
||||
update_serial = #{record.updateSerial,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.tenantId != null">
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.deleteFlag != null">
|
||||
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update jsh_material_extend
|
||||
set id = #{record.id,jdbcType=BIGINT},
|
||||
material_id = #{record.materialId,jdbcType=BIGINT},
|
||||
bar_code = #{record.barCode,jdbcType=VARCHAR},
|
||||
commodity_unit = #{record.commodityUnit,jdbcType=VARCHAR},
|
||||
purchase_decimal = #{record.purchaseDecimal,jdbcType=DECIMAL},
|
||||
commodity_decimal = #{record.commodityDecimal,jdbcType=DECIMAL},
|
||||
wholesale_decimal = #{record.wholesaleDecimal,jdbcType=DECIMAL},
|
||||
low_decimal = #{record.lowDecimal,jdbcType=DECIMAL},
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
create_serial = #{record.createSerial,jdbcType=VARCHAR},
|
||||
update_serial = #{record.updateSerial,jdbcType=VARCHAR},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.MaterialExtend">
|
||||
update jsh_material_extend
|
||||
<set>
|
||||
<if test="materialId != null">
|
||||
material_id = #{materialId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="barCode != null">
|
||||
bar_code = #{barCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="commodityUnit != null">
|
||||
commodity_unit = #{commodityUnit,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="purchaseDecimal != null">
|
||||
purchase_decimal = #{purchaseDecimal,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="commodityDecimal != null">
|
||||
commodity_decimal = #{commodityDecimal,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="wholesaleDecimal != null">
|
||||
wholesale_decimal = #{wholesaleDecimal,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="lowDecimal != null">
|
||||
low_decimal = #{lowDecimal,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="createSerial != null">
|
||||
create_serial = #{createSerial,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateSerial != null">
|
||||
update_serial = #{updateSerial,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="deleteFlag != null">
|
||||
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.MaterialExtend">
|
||||
update jsh_material_extend
|
||||
set material_id = #{materialId,jdbcType=BIGINT},
|
||||
bar_code = #{barCode,jdbcType=VARCHAR},
|
||||
commodity_unit = #{commodityUnit,jdbcType=VARCHAR},
|
||||
purchase_decimal = #{purchaseDecimal,jdbcType=DECIMAL},
|
||||
commodity_decimal = #{commodityDecimal,jdbcType=DECIMAL},
|
||||
wholesale_decimal = #{wholesaleDecimal,jdbcType=DECIMAL},
|
||||
low_decimal = #{lowDecimal,jdbcType=DECIMAL},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
create_serial = #{createSerial,jdbcType=VARCHAR},
|
||||
update_serial = #{updateSerial,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
delete_Flag = #{deleteFlag,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
55
src/main/resources/mapper_xml/MaterialExtendMapperEx.xml
Normal file
55
src/main/resources/mapper_xml/MaterialExtendMapperEx.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.jsh.erp.datasource.mappers.MaterialExtendMapperEx" >
|
||||
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialExtendMapper.BaseResultMap" id="ResultMapList" type="com.jsh.erp.datasource.vo.MaterialExtendVo4List">
|
||||
|
||||
</resultMap>
|
||||
|
||||
<select id="getDetailList" parameterType="com.jsh.erp.datasource.entities.MaterialExtendExample" resultMap="ResultMapList">
|
||||
select DISTINCT d.Id,d.bar_code,d.commodity_unit,d.commodity_decimal,d.purchase_decimal,d.wholesale_decimal,d.low_decimal
|
||||
from jsh_material_extend d
|
||||
where d.material_id = '${materialId}'
|
||||
and ifnull(d.delete_Flag,'0') !='1'
|
||||
order by d.id asc
|
||||
</select>
|
||||
|
||||
<select id="getMaxTimeByTenantAndTime" resultType="java.lang.Long">
|
||||
select max(update_time) from
|
||||
(
|
||||
select update_time from jsh_material_extend
|
||||
where 1=1
|
||||
<if test="lastTime != null">
|
||||
and update_time > ${lastTime}
|
||||
</if>
|
||||
order by update_time asc
|
||||
<if test="syncNum != null">
|
||||
limit 0,#{syncNum}
|
||||
</if>
|
||||
) time_list
|
||||
</select>
|
||||
|
||||
<select id="getListByMId" resultType="com.jsh.erp.datasource.entities.MaterialExtend">
|
||||
select
|
||||
<include refid="com.jsh.erp.datasource.mappers.MaterialExtendMapper.Base_Column_List" />
|
||||
from jsh_material_extend
|
||||
where 1=1
|
||||
and material_id in (
|
||||
<foreach collection="ids" item="id" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
)
|
||||
group by material_id
|
||||
</select>
|
||||
|
||||
<update id="batchDeleteMaterialExtendByIds">
|
||||
update jsh_material_extend
|
||||
set delete_Flag='1'
|
||||
where 1=1
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
and id in (
|
||||
<foreach collection="ids" item="id" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -4,6 +4,7 @@
|
||||
<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" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultAndUnitMap" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
|
||||
@@ -19,6 +20,9 @@
|
||||
<if test="name != null">
|
||||
and m.name like '%${name}%'
|
||||
</if>
|
||||
<if test="standard != null">
|
||||
and m.Standard like '%${standard}%'
|
||||
</if>
|
||||
<if test="model != null">
|
||||
and m.model like '%${model}%'
|
||||
</if>
|
||||
@@ -42,6 +46,9 @@
|
||||
<if test="name != null">
|
||||
and m.name like '%${name}%'
|
||||
</if>
|
||||
<if test="standard != null">
|
||||
and m.Standard like '%${standard}%'
|
||||
</if>
|
||||
<if test="model != null">
|
||||
and m.model like '%${model}%'
|
||||
</if>
|
||||
@@ -65,6 +72,14 @@
|
||||
and ifnull(m.delete_Flag,'0') !='1'
|
||||
</select>
|
||||
|
||||
<select id="findByIdWithBarCode" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
|
||||
select m.*,u.UName,me.bar_code m_bar_code, me.commodity_unit, me.purchase_decimal, me.commodity_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'
|
||||
where me.id = ${meId}
|
||||
and ifnull(m.delete_Flag,'0') !='1'
|
||||
</select>
|
||||
|
||||
<select id="findBySelect" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
|
||||
select m.*,u.UName from jsh_material m
|
||||
left join jsh_unit u on m.UnitId=u.id and ifnull(u.delete_Flag,'0') !='1'
|
||||
@@ -73,6 +88,32 @@
|
||||
ORDER BY Id desc
|
||||
</select>
|
||||
|
||||
<select id="findBySelectWithBarCode" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
|
||||
select m.*,u.UName,me.bar_code m_bar_code,me.id meId,me.commodity_unit 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'
|
||||
where m.enabled=1 and me.id is not null
|
||||
<if test="q != null">
|
||||
and (m.name like '%${q}%' or me.bar_code like '%${q}%')
|
||||
</if>
|
||||
and ifnull(m.delete_Flag,'0') !='1'
|
||||
ORDER BY Id desc
|
||||
<if test="offset != null and rows != null">
|
||||
limit #{offset},#{rows}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="findBySelectWithBarCodeCount" resultType="java.lang.Integer">
|
||||
select count(1) 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'
|
||||
where m.enabled=1 and me.id is not null
|
||||
<if test="q != null">
|
||||
and (m.name like '%${q}%' or me.bar_code like '%${q}%')
|
||||
</if>
|
||||
and ifnull(m.delete_Flag,'0') !='1'
|
||||
</select>
|
||||
|
||||
<update id="updatePriceNullByPrimaryKey" parameterType="java.lang.Long">
|
||||
update jsh_material
|
||||
set
|
||||
@@ -174,168 +215,21 @@
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
</select>
|
||||
|
||||
<insert id="insertSelectiveEx" parameterType="com.jsh.erp.datasource.entities.Material"
|
||||
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
insert into jsh_material
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
Id,
|
||||
</if>
|
||||
<if test="categoryid != null">
|
||||
CategoryId,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
Name,
|
||||
</if>
|
||||
<if test="mfrs != null">
|
||||
Mfrs,
|
||||
</if>
|
||||
<if test="packing != null">
|
||||
Packing,
|
||||
</if>
|
||||
<if test="safetystock != null">
|
||||
SafetyStock,
|
||||
</if>
|
||||
<if test="model != null">
|
||||
Model,
|
||||
</if>
|
||||
<if test="standard != null">
|
||||
Standard,
|
||||
</if>
|
||||
<if test="color != null">
|
||||
Color,
|
||||
</if>
|
||||
<if test="unit != null">
|
||||
Unit,
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
Remark,
|
||||
</if>
|
||||
<if test="retailprice != null">
|
||||
RetailPrice,
|
||||
</if>
|
||||
<if test="lowprice != null">
|
||||
LowPrice,
|
||||
</if>
|
||||
<if test="presetpriceone != null">
|
||||
PresetPriceOne,
|
||||
</if>
|
||||
<if test="presetpricetwo != null">
|
||||
PresetPriceTwo,
|
||||
</if>
|
||||
<if test="unitid != null">
|
||||
UnitId,
|
||||
</if>
|
||||
<if test="firstoutunit != null">
|
||||
FirstOutUnit,
|
||||
</if>
|
||||
<if test="firstinunit != null">
|
||||
FirstInUnit,
|
||||
</if>
|
||||
<if test="pricestrategy != null">
|
||||
PriceStrategy,
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
Enabled,
|
||||
</if>
|
||||
<if test="otherfield1 != null">
|
||||
OtherField1,
|
||||
</if>
|
||||
<if test="otherfield2 != null">
|
||||
OtherField2,
|
||||
</if>
|
||||
<if test="otherfield3 != null">
|
||||
OtherField3,
|
||||
</if>
|
||||
<if test="enableserialnumber != null">
|
||||
enableSerialNumber,
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id,
|
||||
</if>
|
||||
<if test="deleteFlag != null">
|
||||
delete_Flag,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="categoryid != null">
|
||||
#{categoryid,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="mfrs != null">
|
||||
#{mfrs,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="packing != null">
|
||||
#{packing,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="safetystock != null">
|
||||
#{safetystock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="model != null">
|
||||
#{model,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="standard != null">
|
||||
#{standard,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="color != null">
|
||||
#{color,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="unit != null">
|
||||
#{unit,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
#{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="retailprice != null">
|
||||
#{retailprice,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="lowprice != null">
|
||||
#{lowprice,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="presetpriceone != null">
|
||||
#{presetpriceone,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="presetpricetwo != null">
|
||||
#{presetpricetwo,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="unitid != null">
|
||||
#{unitid,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="firstoutunit != null">
|
||||
#{firstoutunit,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="firstinunit != null">
|
||||
#{firstinunit,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="pricestrategy != null">
|
||||
#{pricestrategy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
#{enabled,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="otherfield1 != null">
|
||||
#{otherfield1,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="otherfield2 != null">
|
||||
#{otherfield2,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="otherfield3 != null">
|
||||
#{otherfield3,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="enableserialnumber != null">
|
||||
#{enableserialnumber,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
#{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="deleteFlag != null">
|
||||
#{deleteFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="getMaxBarCode" resultType="java.lang.String">
|
||||
select max(CAST(l.bar_code AS SIGNED)) bar_code from jsh_material_extend l
|
||||
</select>
|
||||
|
||||
<select id="getMaterialByMeId" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultMapList">
|
||||
select m.*,me.bar_code m_bar_code,u.uname unitName, mc.name categoryName, org.org_abr
|
||||
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'
|
||||
left join jsh_organization org on m.orga_id = org.id
|
||||
where 1=1
|
||||
<if test="meId != null">
|
||||
and me.id = ${meId}
|
||||
</if>
|
||||
and ifnull(m.delete_Flag,'0') !='1'
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -51,6 +51,7 @@
|
||||
<table tableName="jsh_inoutitem" domainObjectName="InOutItem"></table>
|
||||
<table tableName="jsh_log" domainObjectName="Log"></table>
|
||||
<table tableName="jsh_material" domainObjectName="Material"></table>
|
||||
<table tableName="jsh_material_extend" domainObjectName="MaterialExtend"></table>
|
||||
<table tableName="jsh_material_stock" domainObjectName="MaterialStock"></table>
|
||||
<table tableName="jsh_materialcategory" domainObjectName="MaterialCategory"></table>
|
||||
<table tableName="jsh_materialproperty" domainObjectName="MaterialProperty"></table>
|
||||
|
||||
Reference in New Issue
Block a user