优化系统,解决单据选择商品的bug
This commit is contained in:
@@ -399,4 +399,13 @@
|
||||
res = false;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一个值是否数字
|
||||
* @param value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function myIsNaN(value) {
|
||||
return typeof value === 'number' && !isNaN(value);
|
||||
}
|
||||
@@ -755,30 +755,9 @@
|
||||
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);
|
||||
// }
|
||||
materialSelect(rowData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -918,6 +897,8 @@
|
||||
var info = res.data;
|
||||
var commodityDecimal = info.commodityDecimal-0; //零售价
|
||||
var purchaseDecimal = info.purchaseDecimal-0; //采购价
|
||||
var wholesaleDecimal = info.wholesaleDecimal-0; //销售价
|
||||
var lowDecimal = info.lowDecimal-0; //最低售价
|
||||
var commodityUnit = info.commodityUnit; //商品单位
|
||||
body =$("#depotHeadFM .datagrid-body");
|
||||
footer =$("#depotHeadFM .datagrid-footer");
|
||||
@@ -948,11 +929,11 @@
|
||||
if(listSubType == "零售" || listSubType == "零售退货") {
|
||||
detailPrice = commodityDecimal;
|
||||
}
|
||||
else if(listTitle == "采购订单列表" || listTitle == "采购入库列表" || listTitle == "销售退货列表" || listTitle == "其它入库列表") {
|
||||
else if(listTitle == "采购订单列表" || listTitle == "采购入库列表" || listTitle == "采购退货列表" || listTitle == "其它入库列表") {
|
||||
detailPrice = purchaseDecimal;
|
||||
}
|
||||
else if(listTitle == "销售订单列表" || listTitle == "销售出库列表" || listTitle == "采购退货列表" || listTitle == "其它出库列表" || listTitle == "调拨出库列表") {
|
||||
detailPrice = commodityDecimal;
|
||||
else if(listTitle == "销售订单列表" || listTitle == "销售出库列表" || listTitle == "销售退货列表" || listTitle == "其它出库列表" || listTitle == "调拨出库列表") {
|
||||
detailPrice = wholesaleDecimal;
|
||||
}
|
||||
//单价和总价赋值
|
||||
if(!detailPrice) {
|
||||
@@ -2314,6 +2295,28 @@
|
||||
//点击商品下拉框,自动加载数量、单价、金额
|
||||
body.find("[field='Stock']").find(input).prop("readonly","readonly");
|
||||
body.find("[field='Unit']").find(input).prop("readonly","readonly");
|
||||
//点击商品名称
|
||||
body.find("[field='MaterialExtendId']").find(input).next().off("mouseup").on("mouseup",function(){
|
||||
var that = $(this);
|
||||
var meId = that.find('input.textbox-text').val()-0;
|
||||
if(myIsNaN(meId)) {
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: '/material/getMaterialByMeId',
|
||||
data: {
|
||||
meId: meId,
|
||||
mpList: mPropertyList
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if (res && res.MaterialName) {
|
||||
that.find('input.textbox-value').val(meId);
|
||||
that.find('input.textbox-text').val(res.MaterialName);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
//修改数量,自动计算金额和合计,另外计算含税单价、税额、价税合计
|
||||
body.find("[field='OperNumber']").find(input).off("keyup").on("keyup",function(){
|
||||
var UnitPrice = body.find("[field='UnitPrice']").find(input).val(); //单价
|
||||
@@ -2425,8 +2428,9 @@
|
||||
$('#materialData').datagrid('getRows')[editIndex]['DepotName'] = DepotName;
|
||||
//商品信息
|
||||
var edMaterial = $('#materialData').datagrid('getEditor', {index:editIndex,field:'MaterialExtendId'});
|
||||
var MaterialName = $(edMaterial.target).combobox('getText');
|
||||
var MaterialName = $(edMaterial.target).next().find('input.textbox-text').val();
|
||||
$('#materialData').datagrid('getRows')[editIndex]['MaterialName'] = MaterialName;
|
||||
//其它信息
|
||||
$('#materialData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
return true;
|
||||
@@ -2441,6 +2445,10 @@
|
||||
$('#materialData').datagrid('selectRow', index).datagrid('beginEdit', index);
|
||||
editIndex = index;
|
||||
autoReckon();
|
||||
setTimeout(function() {
|
||||
var edMaterial = $('#materialData').datagrid('getEditor', {index:editIndex,field:'MaterialExtendId'});
|
||||
$(edMaterial.target).next().find('input.textbox-text').mouseup();
|
||||
},550);
|
||||
} else {
|
||||
$('#materialData').datagrid('selectRow', editIndex);
|
||||
}
|
||||
|
||||
@@ -217,7 +217,8 @@
|
||||
var mPropertyList = null; //商品属性列表
|
||||
var mPropertyListShort = ""; //商品属性列表-传值
|
||||
var clickType = ""; //记录从哪里点击的类别弹窗
|
||||
// var maxBarCode = getMaxBarCode();
|
||||
var maxBarCode = getMaxBarCode(); //获取当前最大条码
|
||||
var thisBarCode = maxBarCode; //全局商品条码
|
||||
//初始化界面
|
||||
$(function () {
|
||||
//初始化系统基础信息
|
||||
@@ -1059,7 +1060,7 @@
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
append(); //新增
|
||||
append(1); //新增
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1546,17 +1547,20 @@
|
||||
}
|
||||
|
||||
//新增
|
||||
function append() {
|
||||
function append(type) {
|
||||
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";
|
||||
if(type ==1) {
|
||||
if(thisBarCode) {
|
||||
thisBarCode = Number(thisBarCode)+1;
|
||||
} else {
|
||||
thisBarCode = "1000";
|
||||
}
|
||||
}
|
||||
$(ed.target).val(Number(thisBarCode)+1);
|
||||
$(ed.target).val(thisBarCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1616,7 +1620,7 @@
|
||||
|
||||
//商品价格扩展
|
||||
function accept(objInfo) {
|
||||
append();
|
||||
append(0);
|
||||
removeit();
|
||||
if ($("#materialExtendData").datagrid('getChanges').length) {
|
||||
if (!CheckData())
|
||||
|
||||
@@ -221,12 +221,6 @@ public class DepotItemController {
|
||||
public String getOtherInfo(String[] mpArr, DepotItemVo4WithInfoEx diEx)throws Exception {
|
||||
String materialOther = "";
|
||||
for (int i = 0; i < mpArr.length; i++) {
|
||||
if (mpArr[i].equals("颜色")) {
|
||||
materialOther = materialOther + ((diEx.getMColor() == null || diEx.getMColor().equals("")) ? "" : "(" + diEx.getMColor() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("规格")) {
|
||||
materialOther = materialOther + ((diEx.getMStandard() == null || diEx.getMStandard().equals("")) ? "" : "(" + diEx.getMStandard() + ")");
|
||||
}
|
||||
if (mpArr[i].equals("制造商")) {
|
||||
materialOther = materialOther + ((diEx.getMMfrs() == null || diEx.getMMfrs().equals("")) ? "" : "(" + diEx.getMMfrs() + ")");
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public class MaterialController {
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping(value = "/getMaterialByMeId")
|
||||
public JSONObject getMaterialByMeId(@RequestParam("meId") long meId,
|
||||
public JSONObject getMaterialByMeId(@RequestParam(value = "meId", required = false) Long meId,
|
||||
@RequestParam("mpList") String mpList,
|
||||
HttpServletRequest request) throws Exception{
|
||||
JSONObject item = new JSONObject();
|
||||
|
||||
@@ -362,6 +362,9 @@ public class MaterialService {
|
||||
public List<MaterialVo4Unit> findBySelectWithBarCode(String q,Integer offset, Integer rows)throws Exception{
|
||||
List<MaterialVo4Unit> list =null;
|
||||
try{
|
||||
if(StringUtil.isNotEmpty(q)) {
|
||||
q = q.replace("'", "");
|
||||
}
|
||||
list= materialMapperEx.findBySelectWithBarCode(q, offset, rows);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
@@ -372,6 +375,9 @@ public class MaterialService {
|
||||
public int findBySelectWithBarCodeCount(String q)throws Exception{
|
||||
int result=0;
|
||||
try{
|
||||
if(StringUtil.isNotEmpty(q)) {
|
||||
q = q.replace("'", "");
|
||||
}
|
||||
result = materialMapperEx.findBySelectWithBarCodeCount(q);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
@@ -712,10 +718,12 @@ public class MaterialService {
|
||||
return stock;
|
||||
}
|
||||
|
||||
public List<MaterialVo4Unit> getMaterialByMeId(long meId) {
|
||||
public List<MaterialVo4Unit> getMaterialByMeId(Long meId) {
|
||||
List<MaterialVo4Unit> result = new ArrayList<MaterialVo4Unit>();
|
||||
try{
|
||||
result= materialMapperEx.getMaterialByMeId(meId);
|
||||
if(meId!=null) {
|
||||
result= materialMapperEx.getMaterialByMeId(meId);
|
||||
}
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,9 @@
|
||||
</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
|
||||
select m.*,u.UName,me.bar_code m_bar_code, me.commodity_unit, me.purchase_decimal, me.commodity_decimal,
|
||||
me.wholesale_decimal, me.low_decimal
|
||||
from jsh_material m
|
||||
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
|
||||
left join jsh_unit u on m.UnitId=u.id and ifnull(u.delete_Flag,'0') !='1'
|
||||
where me.id = ${meId}
|
||||
@@ -220,12 +222,11 @@
|
||||
</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
|
||||
select m.*,me.bar_code m_bar_code,u.uname unitName, mc.name categoryName
|
||||
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}
|
||||
|
||||
Reference in New Issue
Block a user