去掉商品的必填项、修复了库存报表的统计bug
This commit is contained in:
@@ -152,7 +152,7 @@ public class DepotItemAction extends BaseAction<DepotItemModel>
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", depotItem.getId());
|
||||
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
|
||||
String MaterialName = ((depotItem.getMaterialId().getModel().equals(""))?"":""+depotItem.getMaterialId().getModel())+" "+depotItem.getMaterialId().getName()
|
||||
String MaterialName = ((depotItem.getMaterialId().getModel() == null||depotItem.getMaterialId().getModel().equals(""))?"":depotItem.getMaterialId().getModel()+" ") + depotItem.getMaterialId().getName()
|
||||
+((depotItem.getMaterialId().getStandard() == null||depotItem.getMaterialId().getStandard().equals(""))?"":"("+depotItem.getMaterialId().getStandard() + ")")
|
||||
+((depotItem.getMaterialId().getColor() == null||depotItem.getMaterialId().getColor().equals(""))?"":"("+depotItem.getMaterialId().getColor() + ")")
|
||||
+((depotItem.getMaterialId().getUnit() == null||depotItem.getMaterialId().getUnit().equals(""))?"":"("+depotItem.getMaterialId().getUnit() + ")");
|
||||
@@ -206,7 +206,10 @@ public class DepotItemAction extends BaseAction<DepotItemModel>
|
||||
JSONObject item = new JSONObject();
|
||||
Integer prevSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),true);
|
||||
Integer InSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
Double prevPrice = sumPrice("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumPrice("出库", depotItem.getMaterialId().getId(), model.getMonthTime(), true);
|
||||
Double InPrice = sumPrice("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
Double OutPrice = sumPrice("出库", depotItem.getMaterialId().getId(), model.getMonthTime(), false);
|
||||
item.put("Id", depotItem.getId());
|
||||
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
|
||||
item.put("MaterialName", depotItem.getMaterialId().getName());
|
||||
@@ -214,12 +217,12 @@ public class DepotItemAction extends BaseAction<DepotItemModel>
|
||||
item.put("MaterialStandard", depotItem.getMaterialId().getStandard());
|
||||
item.put("MaterialColor", depotItem.getMaterialId().getColor());
|
||||
item.put("MaterialUnit", depotItem.getMaterialId().getUnit());
|
||||
item.put("UnitPrice", (prevPrice + InPrice - OutPrice)/(prevSum + InSum - OutSum));
|
||||
item.put("prevSum", prevSum);
|
||||
item.put("InSum", InSum);
|
||||
item.put("OutSum", OutSum);
|
||||
item.put("thisSum", prevSum + InSum - OutSum);
|
||||
item.put("thisAllPrice", depotItem.getUnitPrice() * (prevSum + InSum - OutSum));
|
||||
item.put("UnitPrice", depotItem.getUnitPrice());
|
||||
item.put("thisAllPrice", prevPrice + InPrice - OutPrice);
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
@@ -371,10 +374,10 @@ public class DepotItemAction extends BaseAction<DepotItemModel>
|
||||
{
|
||||
for(DepotItem depotItem:dataList)
|
||||
{
|
||||
Integer prevSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),true);
|
||||
Integer InSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
thisAllPrice = thisAllPrice + depotItem.getUnitPrice() * (prevSum + InSum - OutSum);
|
||||
Double prevPrice = sumPrice("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumPrice("出库", depotItem.getMaterialId().getId(), model.getMonthTime(), true);
|
||||
Double InPrice = sumPrice("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
Double OutPrice = sumPrice("出库", depotItem.getMaterialId().getId(), model.getMonthTime(), false);
|
||||
thisAllPrice = thisAllPrice + (prevPrice + InPrice - OutPrice);
|
||||
}
|
||||
}
|
||||
outer.put("totalCount", thisAllPrice);
|
||||
@@ -417,7 +420,10 @@ public class DepotItemAction extends BaseAction<DepotItemModel>
|
||||
JSONObject item = new JSONObject();
|
||||
Integer prevSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),true);
|
||||
Integer InSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
Double prevPrice = sumPrice("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumPrice("出库", depotItem.getMaterialId().getId(), model.getMonthTime(), true);
|
||||
Double InPrice = sumPrice("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
Double OutPrice = sumPrice("出库", depotItem.getMaterialId().getId(), model.getMonthTime(), false);
|
||||
item.put("Id", depotItem.getId());
|
||||
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
|
||||
item.put("MaterialName", depotItem.getMaterialId().getName());
|
||||
@@ -425,12 +431,12 @@ public class DepotItemAction extends BaseAction<DepotItemModel>
|
||||
item.put("MaterialStandard", depotItem.getMaterialId().getStandard());
|
||||
item.put("MaterialColor", depotItem.getMaterialId().getColor());
|
||||
item.put("MaterialUnit", depotItem.getMaterialId().getUnit());
|
||||
item.put("UnitPrice", (prevPrice + InPrice - OutPrice)/(prevSum + InSum - OutSum));
|
||||
item.put("prevSum", prevSum);
|
||||
item.put("InSum", InSum);
|
||||
item.put("OutSum", OutSum);
|
||||
item.put("thisSum", prevSum + InSum - OutSum);
|
||||
item.put("thisAllPrice", depotItem.getUnitPrice() * (prevSum + InSum - OutSum));
|
||||
item.put("UnitPrice", depotItem.getUnitPrice());
|
||||
item.put("thisAllPrice", prevPrice + InPrice - OutPrice);
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
@@ -446,7 +452,15 @@ public class DepotItemAction extends BaseAction<DepotItemModel>
|
||||
Log.infoFileSync("===================调用导出信息action方法exportExcel结束==================");
|
||||
return EXCEL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 数量合计
|
||||
* @param type
|
||||
* @param MId
|
||||
* @param MonthTime
|
||||
* @param isPrev
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Integer sumNumber(String type,Long MId,String MonthTime, Boolean isPrev) {
|
||||
Integer sumNumber = 0;
|
||||
@@ -469,6 +483,38 @@ public class DepotItemAction extends BaseAction<DepotItemModel>
|
||||
sumNumber = Integer.parseInt(allNumber);
|
||||
return sumNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* 价格合计
|
||||
* @param type
|
||||
* @param MId
|
||||
* @param MonthTime
|
||||
* @param isPrev
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Double sumPrice(String type,Long MId,String MonthTime, Boolean isPrev) {
|
||||
Double sumPrice = 0.0;
|
||||
String allPrice = "";
|
||||
PageUtil pageUtil = new PageUtil();
|
||||
pageUtil.setPageSize(0);
|
||||
pageUtil.setCurPage(0);
|
||||
try {
|
||||
depotItemService.findPriceByType(pageUtil, type, MId, MonthTime, isPrev);
|
||||
allPrice = pageUtil.getPageList().toString();
|
||||
allPrice = allPrice.substring(1,allPrice.length()-1);
|
||||
if(allPrice.equals("null")){
|
||||
allPrice = "0";
|
||||
}
|
||||
allPrice = allPrice.replace(".0", "");
|
||||
} catch (JshException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
sumPrice = Double.parseDouble(allPrice);
|
||||
return sumPrice;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Integer sumNumberBuyOrSale(String type,String subType,Long MId,String MonthTime) {
|
||||
Integer sumNumber = 0;
|
||||
|
||||
@@ -224,14 +224,14 @@ public class MaterialAction extends BaseAction<MaterialModel>
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", material.getId());
|
||||
item.put("Name", material.getName());
|
||||
item.put("Model", material.getModel());
|
||||
item.put("Standard", material.getStandard());
|
||||
item.put("Color", material.getColor());
|
||||
item.put("Unit", material.getUnit());
|
||||
item.put("Model", material.getModel()==null?"" : material.getModel());
|
||||
item.put("Standard", material.getStandard()==null?"": material.getStandard());
|
||||
item.put("Color", material.getColor()==null?"": material.getColor());
|
||||
item.put("Unit", material.getUnit()==null?"": material.getUnit());
|
||||
item.put("RetailPrice", material.getRetailPrice());
|
||||
item.put("LowPrice", material.getLowPrice());
|
||||
item.put("PresetPriceOne", material.getPresetPriceOne());
|
||||
item.put("PresetPriceTwo", material.getPresetPriceTwo());
|
||||
item.put("PresetPriceOne", material.getPresetPriceOne()==null? "":material.getPresetPriceOne());
|
||||
item.put("PresetPriceTwo", material.getPresetPriceTwo()==null? "":material.getPresetPriceTwo());
|
||||
item.put("Remark", material.getRemark());
|
||||
item.put("op", 1);
|
||||
dataArray.add(item);
|
||||
@@ -323,7 +323,7 @@ public class MaterialAction extends BaseAction<MaterialModel>
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", material.getId());
|
||||
//名称
|
||||
String MaterialName = ((material.getModel().equals(""))?"":""+material.getModel()) +" "+ material.getName()
|
||||
String MaterialName = ((material.getModel() == null || material.getModel().equals(""))?"":material.getModel() +" ") + material.getName()
|
||||
+ ((material.getStandard() == null || material.getStandard().equals(""))?"":"("+material.getStandard() + ")")
|
||||
+ ((material.getColor() == null || material.getColor().equals(""))?"":"("+material.getColor() + ")")
|
||||
+ ((material.getUnit() == null || material.getUnit().equals(""))?"":"("+material.getUnit() + ")");
|
||||
|
||||
@@ -36,6 +36,22 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
|
||||
pageUtil.setTotalCount(query.list().size());
|
||||
pageUtil.setPageList(query.list());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void findPriceByType(PageUtil<DepotItem> pageUtil,String type,Long MId,String MonthTime,Boolean isPrev) throws JshException
|
||||
{
|
||||
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
|
||||
Query query;
|
||||
if(isPrev) {
|
||||
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"' and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||
}
|
||||
else {
|
||||
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"' and MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 00:00:00' " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||
}
|
||||
pageUtil.setTotalCount(query.list().size());
|
||||
pageUtil.setPageList(query.list());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,9 @@ import com.jsh.util.PageUtil;
|
||||
|
||||
public interface DepotItemIDAO extends BaseIDAO<DepotItem>
|
||||
{
|
||||
public void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId, String MonthTime,Boolean isPrev) throws JshException;
|
||||
|
||||
public void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId, String MonthTime,Boolean isPrev) throws JshException;
|
||||
|
||||
public void findPriceByType(PageUtil<DepotItem> pageUtil,String type,Long MId, String MonthTime,Boolean isPrev) throws JshException;
|
||||
|
||||
public void buyOrSale(PageUtil<DepotItem> pageUtil,String type, String subType,Long MId, String MonthTime, String sumType) throws JshException;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ import com.jsh.util.PageUtil;
|
||||
public interface DepotItemIService extends BaseIService<DepotItem>
|
||||
{
|
||||
void findByType(PageUtil<DepotItem> depotItem, String type, Long MId, String MonthTime,Boolean isPrev)throws JshException;
|
||||
|
||||
void findPriceByType(PageUtil<DepotItem> depotItem, String type, Long MId, String MonthTime,Boolean isPrev)throws JshException;
|
||||
|
||||
void buyOrSale(PageUtil<DepotItem> depotItem, String type, String subType, Long MId, String MonthTime, String sumType)throws JshException;
|
||||
|
||||
|
||||
@@ -49,6 +49,12 @@ public class DepotItemService extends BaseService<DepotItem> implements DepotIte
|
||||
{
|
||||
depotItemDao.findByType(pageUtil, type, MId, MonthTime,isPrev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findPriceByType(PageUtil<DepotItem> pageUtil, String type,Long MId, String MonthTime,Boolean isPrev) throws JshException
|
||||
{
|
||||
depotItemDao.findPriceByType(pageUtil, type, MId, MonthTime,isPrev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buyOrSale(PageUtil<DepotItem> pageUtil, String type,String subType, Long MId, String MonthTime, String sumType) throws JshException
|
||||
|
||||
@@ -223,7 +223,7 @@
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{field: 'OrganId',width:5, hidden:true},
|
||||
{ title: '单据编号',field: 'BillNo',width:100},
|
||||
{ title: '单据编号',field: 'BillNo',width:140},
|
||||
{ title: '单据时间 ',field: 'BillTime',width:100},
|
||||
{ title: '合计',field: 'TotalPrice',width:80},
|
||||
{ title: '备注',field: 'Remark',width:100},
|
||||
|
||||
@@ -356,9 +356,9 @@
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{field: 'OrganId',width:5, hidden:true},
|
||||
{ title: '单据编号',field: 'Number',width:100},
|
||||
{ title: '单据日期 ',field: 'OperTime',width:100},
|
||||
{ title: '创建时间',field: 'CreateTime',width:100},
|
||||
{ title: '单据编号',field: 'Number',width:140},
|
||||
{ title: '单据日期 ',field: 'OperTime',width:80},
|
||||
{ title: '创建时间',field: 'CreateTime',width:80},
|
||||
{ title: '操作员',field: 'OperPersonName',width:80},
|
||||
{ title: '合计',field: 'TotalPrice',width:50},
|
||||
{ title: payTypeTitle,field: 'ChangeAmount',width:50,hidden:hideType},
|
||||
|
||||
@@ -66,7 +66,8 @@
|
||||
</div>
|
||||
<div class="fitem" style="padding:5px">
|
||||
<label id="loginameLabel">登录名称 </label>
|
||||
<input name="loginame" id="loginame" style="width: 230px;height: 20px"/>
|
||||
<input name="loginame" id="loginame" class="easyui-validatebox" data-options="required:true,validType:'length[2,15]'" style="width: 120px;height: 20px"/>
|
||||
初始密码:123456
|
||||
</div>
|
||||
<div class="fitem" style="padding:5px">
|
||||
<label id="departmentLabel">部 门 </label>
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>型号</td>
|
||||
<td style="padding:5px"><input name="Model" id="Model" class="easyui-validatebox" data-options="required:true,validType:'length[1,30]'" style="width: 180px;height: 20px"/></td>
|
||||
<td style="padding:5px"><input name="Model" id="Model" class="easyui-validatebox" data-options="validType:'length[1,30]'" style="width: 180px;height: 20px"/></td>
|
||||
<td>规格</td>
|
||||
<td style="padding:5px"><input name="Standard" id="Standard" class="easyui-validatebox" data-options="validType:'length[1,30]'" style="width: 180px;height: 20px"/></td>
|
||||
</tr>
|
||||
@@ -84,9 +84,9 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>预设售价一</td>
|
||||
<td style="padding:5px"><input name="PresetPriceOne" id="PresetPriceOne" class="easyui-validatebox" data-options="required:true,validType:'length[1,30]'" style="width: 180px;height: 20px"/></td>
|
||||
<td style="padding:5px"><input name="PresetPriceOne" id="PresetPriceOne" class="easyui-validatebox" data-options="validType:'length[1,30]'" style="width: 180px;height: 20px"/></td>
|
||||
<td>预设售价二</td>
|
||||
<td style="padding:5px"><input name="PresetPriceTwo" id="PresetPriceTwo" class="easyui-validatebox" data-options="required:true,validType:'length[1,30]'" style="width: 180px;height: 20px"/></td>
|
||||
<td style="padding:5px"><input name="PresetPriceTwo" id="PresetPriceTwo" class="easyui-validatebox" data-options="validType:'length[1,30]'" style="width: 180px;height: 20px"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>备注</td>
|
||||
|
||||
Reference in New Issue
Block a user