增加商品单价-自动查询提示
This commit is contained in:
parent
59e7be2b84
commit
53ee7dfea8
@ -247,6 +247,54 @@ public class MaterialAction extends BaseAction<MaterialModel>
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询商品信息结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找商品信息-下拉框
|
||||
@ -360,6 +408,20 @@ public class MaterialAction extends BaseAction<MaterialModel>
|
||||
condition.put("Id_s_order", "asc");
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件-下拉框
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
#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;
|
||||
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(){
|
||||
var UnitPrice = body.find("[field='UnitPrice']").find(input).val(); //单价
|
||||
|
||||
Loading…
Reference in New Issue
Block a user