增加商品单价-自动查询提示
This commit is contained in:
@@ -248,6 +248,54 @@ public class MaterialAction extends BaseAction<MaterialModel>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id来查询商品名称
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public void findById() {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PageUtil<Material> pageUtil = new PageUtil<Material>();
|
||||||
|
pageUtil.setAdvSearch(getConditionById());
|
||||||
|
materialService.find(pageUtil);
|
||||||
|
List<Material> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找商品信息-下拉框
|
* 查找商品信息-下拉框
|
||||||
* @return
|
* @return
|
||||||
@@ -361,6 +409,20 @@ public class MaterialAction extends BaseAction<MaterialModel>
|
|||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼接搜索条件
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Map<String,Object> getConditionById()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 拼接搜索条件
|
||||||
|
*/
|
||||||
|
Map<String,Object> condition = new HashMap<String,Object>();
|
||||||
|
condition.put("Id_n_eq", model.getMaterialID());
|
||||||
|
return condition;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件-下拉框
|
* 拼接搜索条件-下拉框
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@@ -23,3 +23,25 @@
|
|||||||
background: url('../js/easyui-1.3.5/themes/icons/edit_remove.png') no-repeat left center;
|
background: url('../js/easyui-1.3.5/themes/icons/edit_remove.png') no-repeat left center;
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -885,6 +885,62 @@
|
|||||||
TotalPrice = TotalPrice + UnitPrice*OperNumber;
|
TotalPrice = TotalPrice + UnitPrice*OperNumber;
|
||||||
footer.find("[field='AllPrice']").find("div").text((TotalPrice).toFixed(2));
|
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 = "<div class='price-list'>";
|
||||||
|
temp +="<ul>";
|
||||||
|
temp +="<li>预设售价1:" + presetPriceOne + "</li>";
|
||||||
|
temp +="<li>预设售价2:" + presetPriceTwo + "</li>";
|
||||||
|
temp +="<li>零售价:" + retailPrice + "</li>";
|
||||||
|
temp +="</ul>";
|
||||||
|
temp +="</div>";
|
||||||
|
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(){
|
body.find("[field='OperNumber']").find(input).off("keyup").on("keyup",function(){
|
||||||
var UnitPrice = body.find("[field='UnitPrice']").find(input).val(); //单价
|
var UnitPrice = body.find("[field='UnitPrice']").find(input).val(); //单价
|
||||||
|
|||||||
Reference in New Issue
Block a user