|
|
@@ -1,5 +1,6 @@
|
|
|
package restcontroller.webmanage.sale.invbal;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Calendar;
|
|
|
@@ -113,7 +114,8 @@ public class invbal extends Controller {
|
|
|
}
|
|
|
|
|
|
@API(title = "查询Erp库存列表", apiversion = R.ID20230408091703.v1.class)
|
|
|
- public String queryErpInvbalList() throws YosException {
|
|
|
+ public String queryErpInvbalList() throws YosException, IOException {
|
|
|
+ boolean isExport = content.getBooleanValue("isExport");
|
|
|
String itemno = content.getStringValue("itemno");
|
|
|
String itemname = content.getStringValue("itemname");
|
|
|
String agentinfo = content.getStringValue("agentinfo");
|
|
|
@@ -121,16 +123,28 @@ public class invbal extends Controller {
|
|
|
JSONArray itemclassids = content.getJSONArray("itemclassids");
|
|
|
String where ="1=2";
|
|
|
SQLFactory sqlFactory =new SQLFactory(this,"订单明细未发商品列表", pageSize, pageNumber, pageSorting);
|
|
|
+ if (isExport) {
|
|
|
+ sqlFactory = new SQLFactory(this,"订单明细未发商品列表");
|
|
|
+ }
|
|
|
if(!StringUtils.isBlank(itemno)){
|
|
|
sqlFactory=new SQLFactory(this,"商品列表", pageSize, pageNumber, pageSorting);
|
|
|
+ if (isExport) {
|
|
|
+ sqlFactory = new SQLFactory(this,"商品列表");
|
|
|
+ }
|
|
|
where=where+" or t2.itemno like '%"+itemno+"%'";
|
|
|
}
|
|
|
if(!StringUtils.isBlank(itemname)){
|
|
|
sqlFactory=new SQLFactory(this,"商品列表", pageSize, pageNumber, pageSorting);
|
|
|
+ if (isExport) {
|
|
|
+ sqlFactory = new SQLFactory(this,"商品列表");
|
|
|
+ }
|
|
|
where=where+" or t2.itemname like '%"+itemname+"%' ";
|
|
|
}
|
|
|
if (itemclassids.size() > 0) {
|
|
|
sqlFactory=new SQLFactory(this,"商品列表", pageSize, pageNumber, pageSorting);
|
|
|
+ if (isExport) {
|
|
|
+ sqlFactory = new SQLFactory(this,"商品列表");
|
|
|
+ }
|
|
|
ArrayList<Long> itemclassList = new ArrayList<Long>();
|
|
|
for (Object object : itemclassids) {
|
|
|
//System.out.println(row.getLong("itemclassid"));
|
|
|
@@ -148,6 +162,9 @@ public class invbal extends Controller {
|
|
|
}
|
|
|
if(!StringUtils.isBlank(agentinfo)){
|
|
|
sqlFactory =new SQLFactory(this,"订单明细未发商品列表", pageSize, pageNumber, pageSorting);
|
|
|
+ if (isExport) {
|
|
|
+ sqlFactory = new SQLFactory(this,"订单明细未发商品列表");
|
|
|
+ }
|
|
|
//System.out.println(StringUtils.isBlank(itemname) && StringUtils.isBlank(itemno) && itemclassids.size()==0);
|
|
|
if(StringUtils.isBlank(itemname) && StringUtils.isBlank(itemno) && itemclassids.size()==0){
|
|
|
where=where+" or 1=1 and (t6.agentnum like '%"+agentinfo+"%' or t5.enterprisename like '%"+agentinfo+"%') ";
|
|
|
@@ -225,8 +242,48 @@ public class invbal extends Controller {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ for (Row row:rows) {
|
|
|
+ row.put("canbesent", row.getBigDecimal("invbalqty").subtract(row.getBigDecimal("unsoldqty")));
|
|
|
+ row.put("canbesale", (row.getBigDecimal("invbalqty").subtract(row.getBigDecimal("unsoldqty"))).subtract(row.getBigDecimal("undelqty")));
|
|
|
+ }
|
|
|
+ if(isExport){
|
|
|
+ //去除不需要导出项
|
|
|
+ rows.getFieldList().remove("itemid");
|
|
|
+ rows.getFieldList().remove("packageqty");
|
|
|
+ rows.getFieldList().remove("qty");
|
|
|
+ //添加
|
|
|
+// rows.getFieldList().add("canbesent");
|
|
|
+// rows.getFieldList().add("canbesale");
|
|
|
+ rows.getFieldList().add("invbalqty");
|
|
|
+ rows.getFieldList().add("undelqty");
|
|
|
+ ArrayList<String> keylist = rows.getFieldList();
|
|
|
+ for (String str:
|
|
|
+ keylist) {
|
|
|
+ Class fieldclazztype = rows.getFieldMeta(str).getFieldtype();
|
|
|
+ }
|
|
|
+ System.out.println(rows.get(0).toString());
|
|
|
+
|
|
|
+ Rows uploadRows = uploadExcelToObs("invbal", "Erp欠货库存列表", rows, getTitleMap());
|
|
|
+ return getSucReturnObject().setData(uploadRows).toString();
|
|
|
+ }
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
+
|
|
|
+ //返回导出的标题
|
|
|
+ public HashMap<String, String> getTitleMap() {
|
|
|
+ HashMap<String, String> titleMap = new HashMap<>();
|
|
|
+ titleMap.put("itemname", "产品名称");
|
|
|
+ titleMap.put("itemno", "产品编号");
|
|
|
+ titleMap.put("undelqty", "未发数量");
|
|
|
+ titleMap.put("invbalqty", "库存数");
|
|
|
+ titleMap.put("canbesent", "预计可发量");
|
|
|
+ titleMap.put("canbesale", "预计可售量");
|
|
|
+ titleMap.put("unitname", "单位");
|
|
|
+ titleMap.put("itemclass", "营销分类");
|
|
|
+ titleMap.put("isonsale", "是否上架");
|
|
|
+ return titleMap;
|
|
|
+ }
|
|
|
+
|
|
|
@API(title = "查询指定商品对应的未发货订单明细", apiversion = R.ID20230408101803.v1.class)
|
|
|
public String queryOrderDetailList() throws YosException {
|
|
|
String itemno = content.getString("itemno");
|