diff --git a/src/main/java/com/jsh/action/materials/MaterialAction.java b/src/main/java/com/jsh/action/materials/MaterialAction.java index 4c1d034a..9fac20cd 100644 --- a/src/main/java/com/jsh/action/materials/MaterialAction.java +++ b/src/main/java/com/jsh/action/materials/MaterialAction.java @@ -247,6 +247,54 @@ public class MaterialAction extends BaseAction Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询商品信息结果异常", e); } } + + /** + * 根据id来查询商品名称 + * @return + */ + public void findById() { + try + { + PageUtil pageUtil = new PageUtil(); + pageUtil.setAdvSearch(getConditionById()); + materialService.find(pageUtil); + List dataList = pageUtil.getPageList(); + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(null != dataList) + { + for(Material material:dataList) + { + JSONObject item = new JSONObject(); + item.put("Id", material.getId()); + item.put("Name", material.getName()); + item.put("Model", material.getModel()); + item.put("Color", material.getColor()); + item.put("Unit", material.getUnit()); + item.put("RetailPrice", material.getRetailPrice()); + item.put("LowPrice", material.getLowPrice()); + item.put("PresetPriceOne", material.getPresetPriceOne()); + item.put("PresetPriceTwo", material.getPresetPriceTwo()); + item.put("Remark", material.getRemark()); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } + catch (DataAccessException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找商品信息异常", e); + } + catch (IOException e) + { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询商品信息结果异常", e); + } + } /** * 查找商品信息-下拉框 @@ -360,6 +408,20 @@ public class MaterialAction extends BaseAction condition.put("Id_s_order", "asc"); return condition; } + + /** + * 拼接搜索条件 + * @return + */ + private Map getConditionById() + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("Id_n_eq", model.getMaterialID()); + return condition; + } /** * 拼接搜索条件-下拉框 diff --git a/src/main/webapp/css/common.css b/src/main/webapp/css/common.css index 76166388..2e4654c5 100644 --- a/src/main/webapp/css/common.css +++ b/src/main/webapp/css/common.css @@ -22,4 +22,26 @@ #tablePanel .action-delete { background: url('../js/easyui-1.3.5/themes/icons/edit_remove.png') no-repeat left center; padding-left: 20px; -} \ No newline at end of file +} + +#depotHeadFM .price-list { + width:130px; + float:left; + position:absolute; + border:1px solid #95B8E7; +} + +#depotHeadFM .price-list ul{ + padding-left: 5px; + padding-top: 5px; + margin: 0px; +} + +#depotHeadFM .price-list ul li{ + list-style: none; + padding-bottom: 5px; +} + + + + diff --git a/src/main/webapp/js/pages/materials/in_out.js b/src/main/webapp/js/pages/materials/in_out.js index b8c0cedf..2fc89642 100644 --- a/src/main/webapp/js/pages/materials/in_out.js +++ b/src/main/webapp/js/pages/materials/in_out.js @@ -885,6 +885,62 @@ TotalPrice = TotalPrice + UnitPrice*OperNumber; footer.find("[field='AllPrice']").find("div").text((TotalPrice).toFixed(2)); }); + body.find("[field='UnitPrice']").find(input).off("click").on("click",function(){ + var self = this; + var mValue = body.find("[field='MaterialId'] .combo-value").attr("value"); //获取选中的商品id + if(!mValue) { + return; + } + else { + if(listTitle!="销售出库列表" && listTitle!="采购退货列表" && listTitle!="其它出库列表" && listTitle!="调拨出库列表") { + return; + } + $.ajax({ + url: path + "/material/findById.action", + type: "get", + dataType: "json", + data: { + "MaterialID": mValue - 0 + }, + success: function(res){ + if(res && res.rows && res.rows[0]) { + var retailPrice = res.rows[0].RetailPrice; + var presetPriceOne = res.rows[0].PresetPriceOne; + var presetPriceTwo = res.rows[0].PresetPriceTwo; + //定义模版 + var temp = "
"; + temp +="
    "; + temp +="
  • 预设售价1:" + presetPriceOne + "
  • "; + temp +="
  • 预设售价2:" + presetPriceTwo + "
  • "; + temp +="
  • 零售价:" + retailPrice + "
  • "; + temp +="
"; + temp +="
"; + if($('.price-list').length){ + $('.price-list').remove(); //如果存在价格列表先移除 + } + else { + $(self).after(temp); //加载列表信息 + } + $('.price-list ul li').off("click").on("click",function(){ + var price = $(this).text(); + price = price.substring(price.indexOf(":") + 1); + $(self).val(price); + $(self).keyup(); //模拟键盘操作 + $('.price-list').remove(); //移除价格列表 + }); + //点击空白处移除价格列表 + $(".datagrid-body").off("click").on("click",function(){ + $('.price-list').remove(); //移除价格列表 + }); + } + }, + error: function(){ + $.messager.alert('错误提示','查询商品信息异常,请稍后再试!','error'); + return; + } + }); + } + }); //修改数量,自动计算金额和合计 body.find("[field='OperNumber']").find(input).off("keyup").on("keyup",function(){ var UnitPrice = body.find("[field='UnitPrice']").find(input).val(); //单价