优化对账单

This commit is contained in:
季圣华
2017-10-25 00:23:41 +08:00
parent 9ba0a3b4cf
commit 67305e5084
6 changed files with 26 additions and 160 deletions

View File

@@ -739,13 +739,11 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
PageUtil pageUtil = new PageUtil();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
Long pid =model.getProjectId();
String dids =model.getDepotIds();
String beginTime = model.getBeginTime();
String endTime = model.getEndTime();
Long organId = model.getOrganId();
try{
depotHeadService.findStatementAccount(pageUtil, beginTime, endTime, organId, pid, dids);
depotHeadService.findStatementAccount(pageUtil, beginTime, endTime, organId);
List dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
outer.put("total", pageUtil.getTotalCount());
@@ -757,15 +755,10 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
Object dl = dataList.get(i); //获取对象
Object[] arr = (Object[]) dl; //转为数组
item.put("number", arr[0]); //单据编号
item.put("materialName", arr[1]); //商品名称
item.put("materialModel", arr[2]); //商品型号
item.put("unitPrice", arr[3]); //单价
item.put("operNumber", arr[4]); //入库出库数量
item.put("allPrice", arr[5]); //金额
item.put("supplierName", arr[6]); //供应商
item.put("depotName", arr[7]); //仓库
item.put("operTime", arr[8]); //入库出库日期
item.put("type", arr[9]); //单据类型
item.put("changeAmount", arr[1]); //金额
item.put("totalPrice", arr[2]); //金额
item.put("supplierName", arr[3]); //供应商
item.put("operTime", arr[4]); //入库出库日期
dataArray.add(item);
}
}

View File

@@ -129,24 +129,22 @@ public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO {
}
@SuppressWarnings("unchecked")
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime,Long organId,Long pid,String dids) throws JshException {
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime,Long organId) throws JshException {
StringBuffer queryString = new StringBuffer();
queryString.append("select dh.Number,m.`name`,m.Model,di.UnitPrice,di.OperNumber,di.AllPrice,s.supplier,d.dName,date_format(dh.OperTime, '%Y-%m-%d'),dh.type " +
"from jsh_depothead dh inner join jsh_depotitem di on di.HeaderId=dh.id " +
"inner join jsh_material m on m.id=di.MaterialId " +
"inner join jsh_supplier s on s.id=dh.OrganId " +
"inner join (select id,name as dName from jsh_depot) d on d.id=di.DepotId " +
"where s.type!='会员' and dh.OperTime >='"+ beginTime +"' and dh.OperTime <='"+ endTime +"' ");
if(pid!=null){
queryString.append(" and di.DepotId=" + pid );
}
else {
queryString.append(" and di.DepotId in (" + dids + ")" );
}
queryString.append("select dh.Number,dh.ChangeAmount,dh.TotalPrice,s.supplier,date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime from jsh_depothead dh " +
"inner join jsh_supplier s on s.id=dh.OrganId where s.type!='会员' " +
"and dh.OperTime >='"+ beginTime +"' and dh.OperTime<='"+ endTime +"' ");
if(organId!=null && !organId.equals("")) {
queryString.append(" and dh.OrganId='"+ organId +"'");
queryString.append(" and dh.OrganId='"+ organId +"' ");
}
queryString.append(" ORDER BY OperTime DESC,Number desc");
queryString.append("UNION ALL " +
"select ah.BillNo,ah.ChangeAmount,ah.TotalPrice,s.supplier,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime from jsh_accounthead ah " +
"inner join jsh_supplier s on s.id=ah.OrganId where s.type!='会员' " +
"and ah.BillTime >='"+ beginTime +"' and ah.BillTime<='"+ endTime +"' ");
if(organId!=null && !organId.equals("")) {
queryString.append(" and ah.OrganId='"+ organId +"' ");
}
queryString.append(" ORDER BY oTime");
Query query;
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());

View File

@@ -23,7 +23,7 @@ public interface DepotHeadIDAO extends BaseIDAO<DepotHead>
public void findMaterialsListByHeaderId(PageUtil pageUtil,Long headerId) throws JshException;
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime,Long organId,Long pid,String dids) throws JshException;
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime,Long organId) throws JshException;
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam) throws JshException;

View File

@@ -23,7 +23,7 @@ public interface DepotHeadIService extends BaseIService<DepotHead>
public void findMaterialsListByHeaderId(PageUtil pageUtil,Long headerId)throws JshException;
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime, Long organId, Long pid,String dids)throws JshException;
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime, Long organId)throws JshException;
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam)throws JshException;
}

View File

@@ -50,8 +50,8 @@ public class DepotHeadService extends BaseService<DepotHead> implements DepotHea
depotHeadDao.findMaterialsListByHeaderId(pageUtil, headerId);
}
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime,Long organId,Long pid,String dids) throws JshException {
depotHeadDao.findStatementAccount(pageUtil, beginTime, endTime, organId, pid, dids);
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime,Long organId) throws JshException {
depotHeadDao.findStatementAccount(pageUtil, beginTime, endTime, organId);
}
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam) throws JshException {