新增-根据商品信息查询单据

This commit is contained in:
季圣华
2017-09-12 00:13:07 +08:00
parent 92c258bfbd
commit 2c51593e39
18 changed files with 163 additions and 28 deletions

View File

@@ -373,14 +373,40 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
return newNumber;
}
/**
* 根据材料信息获取
*/
public void getHeaderIdByMaterial(){
try {
String materialParam = model.getMaterialParam(); //商品参数
PageUtil pageUtil = new PageUtil();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
depotHeadService.getHeaderIdByMaterial(pageUtil, materialParam);
JSONObject outer = new JSONObject();
String allReturn = pageUtil.getPageList().toString();
allReturn = allReturn.substring(1,allReturn.length()-1);
if(allReturn.equals("null")){
allReturn = "";
}
outer.put("ret", allReturn);
//回写查询结果
toClient(outer.toString());
}
catch (JshException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e);
}
catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询单据信息结果异常", e);
}
}
/**
* 查找单据信息
* @return
*/
public void findBy()
{
try
{
public void findBy() {
try {
PageUtil<DepotHead> pageUtil = new PageUtil<DepotHead>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
@@ -392,10 +418,8 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(DepotHead depotHead:dataList)
{
if(null != dataList) {
for(DepotHead depotHead:dataList) {
JSONObject item = new JSONObject();
item.put("Id", depotHead.getId());
item.put("ProjectId", depotHead.getProjectId()==null?"":depotHead.getProjectId().getId());
@@ -436,12 +460,10 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找单据信息异常", e);
}
catch (IOException e)
{
catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询单据信息结果异常", e);
}
}
@@ -718,6 +740,7 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
condition.put("Type_s_eq",model.getType());
condition.put("SubType_s_eq",model.getSubType());
condition.put("Number_s_like",model.getNumber());
condition.put("Id_s_in",model.getDhIds());
condition.put("OperTime_s_gteq",model.getBeginTime());
condition.put("OperTime_s_lteq",model.getEndTime());
condition.put("Id_s_order","desc");

View File

@@ -124,4 +124,13 @@ public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO {
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setPageList(query.list());
}
@SuppressWarnings("unchecked")
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam) throws JshException {
StringBuffer queryString = new StringBuffer();
queryString.append("select group_concat(CAST(dt.HeaderId AS CHAR)) as ids from jsh_depotitem dt INNER JOIN jsh_material m on dt.MaterialId = m.Id where m.`Name` "+
" like '%" + materialParam + "%' or m.Model like '%" + materialParam + "%' or m.Mfrs like '%" + materialParam + "%'");
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setPageList(query.list());
}
}

View File

@@ -22,5 +22,7 @@ public interface DepotHeadIDAO extends BaseIDAO<DepotHead>
public void findInOutMaterialCount(PageUtil pageUtil,String beginTime,String endTime,String type,Long pid,String dids) throws JshException;
public void findMaterialsListByHeaderId(PageUtil pageUtil,Long headerId) throws JshException;
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam) throws JshException;
}

View File

@@ -42,6 +42,8 @@ public class DepotHeadModel implements Serializable
private String MonthTime; //查询月份
private String supplierId; //单位Id用于查询单位的应收应付
private String MaterialParam; //商品参数
private String dhIds; //单据id列表
/**
* 分类ID
@@ -363,4 +365,20 @@ public class DepotHeadModel implements Serializable
public void setStatus(Boolean status) {
Status = status;
}
public String getMaterialParam() {
return MaterialParam;
}
public void setMaterialParam(String materialParam) {
MaterialParam = materialParam;
}
public String getDhIds() {
return dhIds;
}
public void setDhIds(String dhIds) {
this.dhIds = dhIds;
}
}

View File

@@ -22,4 +22,6 @@ public interface DepotHeadIService extends BaseIService<DepotHead>
public void findInOutMaterialCount(PageUtil pageUtil,String beginTime,String endTime, String type, Long pid,String dids)throws JshException;
public void findMaterialsListByHeaderId(PageUtil pageUtil,Long headerId)throws JshException;
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam)throws JshException;
}

View File

@@ -49,4 +49,8 @@ public class DepotHeadService extends BaseService<DepotHead> implements DepotHea
public void findMaterialsListByHeaderId(PageUtil pageUtil,Long headerId) throws JshException {
depotHeadDao.findMaterialsListByHeaderId(pageUtil, headerId);
}
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam) throws JshException {
depotHeadDao.getHeaderIdByMaterial(pageUtil, materialParam);
}
}