|
|
|
|
@@ -2132,6 +2132,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|
|
|
|
|
|
|
|
|
WQLObject custTab = WQLObject.getWQLObject("MD_CS_CustomerBase"); // 客户基本信息表
|
|
|
|
|
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_IOStorInv"); // 出入库主表
|
|
|
|
|
WQLObject dtlTab = WQLObject.getWQLObject("ST_IVT_IOStorInv"); // 出入库明细表
|
|
|
|
|
WQLObject disTab = WQLObject.getWQLObject("ST_IVT_IOStorInv"); // 出入库分配明细
|
|
|
|
|
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation"); // 子卷包装关系表
|
|
|
|
|
|
|
|
|
|
JSONObject jsonMst = mstTab.query("iostorinv_id = '" + MapUtil.getStr(whereJson, "iostorinv_id") + "'").uniqueResult(0);
|
|
|
|
|
@@ -2151,21 +2153,35 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|
|
|
|
// WriteSheet sheet = EasyExcel.writerSheet().build();
|
|
|
|
|
// 5.单组填充
|
|
|
|
|
HashMap<String, Object> oneMap = new HashMap<>();
|
|
|
|
|
oneMap.put("bill_code", jsonMst.getString("bill_code")); // 出库单号
|
|
|
|
|
oneMap.put("create_date", DateUtil.today()); // 出库日期
|
|
|
|
|
oneMap.put("consignee", jsonMst.getString("consignee")); // 客户
|
|
|
|
|
oneMap.put("receiptaddress", jsonMst.getString("receiptaddress")); // 客户地址
|
|
|
|
|
oneMap.put("trans_code", jsonMst.getString("trans_code")); // 承运公司
|
|
|
|
|
oneMap.put("receiptaddress2", jsonMst.getString("receiptaddress")); // 收货地址
|
|
|
|
|
oneMap.put("receiptphone", jsonMst.getString("receiver") +"/"+jsonMst.getString("receiptphone")); // 客户电话
|
|
|
|
|
oneMap.put("deliveryphone", jsonMst.getString("deliveryname") +"/"+jsonMst.getString("deliveryphone") ); // 承运人电话
|
|
|
|
|
|
|
|
|
|
// 送货单号
|
|
|
|
|
JSONObject jsonDtl = dtlTab.query("iostorinv_id = '" + jsonMst.getString("iostorinv_id") + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonDtl)) oneMap.put("vbeln",jsonDtl.getString("vbeln"));
|
|
|
|
|
// 页码
|
|
|
|
|
String pageNow = String.valueOf(j + 1);
|
|
|
|
|
oneMap.put("page",pageNow+ "/" + MapUtil.getStr(whereJson,"pageNum"));
|
|
|
|
|
oneMap.put("consignee", jsonMst.getString("consignee")); // 收货单位
|
|
|
|
|
oneMap.put("receiver", jsonMst.getString("receiver")); // 收货人
|
|
|
|
|
oneMap.put("receiptaddress", jsonMst.getString("receiptaddress")); // 收货地址
|
|
|
|
|
oneMap.put("receiptphone", jsonMst.getString("receiptphone")); // 收货人联系电话
|
|
|
|
|
oneMap.put("logisticscompany", jsonMst.getString("logisticscompany")); // 物流公司
|
|
|
|
|
oneMap.put("drivername", jsonMst.getString("drivername")); // 司机
|
|
|
|
|
oneMap.put("carno", jsonMst.getString("carno")); // 车牌号
|
|
|
|
|
oneMap.put("driverphone", jsonMst.getString("driverphone")); // 司机联系电话
|
|
|
|
|
// 总箱数
|
|
|
|
|
/* JSONArray jsonAllBox = WQL.getWO("ST_OUTIVT02").addParam("flag", "4").addParam("iostorinv_id", MapUtil.getStr(whereJson, "iostorinv_id")).process().getResultJSONArray(0);
|
|
|
|
|
JSONArray jsonAllBox = WQL.getWO("ST_OUTIVT02").addParam("flag", "4").addParam("iostorinv_id", MapUtil.getStr(whereJson, "iostorinv_id")).process().getResultJSONArray(0);
|
|
|
|
|
oneMap.put("all_box", jsonAllBox.size());
|
|
|
|
|
oneMap.put("all_qty", "");
|
|
|
|
|
oneMap.put("deliveryaddress", jsonMst.getString("deliveryaddress"));
|
|
|
|
|
oneMap.put("deliveryname", jsonMst.getString("deliveryname"));
|
|
|
|
|
oneMap.put("deliveryphone", jsonMst.getString("deliveryphone"));*/
|
|
|
|
|
// 总毛重
|
|
|
|
|
double all_box_qty = 0;
|
|
|
|
|
for (int t = 0; t < jsonAllBox.size(); t++) {
|
|
|
|
|
JSONObject json = jsonAllBox.getJSONObject(t);
|
|
|
|
|
NumberUtil.add(all_box_qty,json.getDoubleValue("box_qty"));
|
|
|
|
|
}
|
|
|
|
|
oneMap.put("all_box_qty", NumberUtil.round(all_box_qty,2).toString());
|
|
|
|
|
oneMap.put("deliveryaddress", jsonMst.getString("deliveryaddress")); // 送货方地址
|
|
|
|
|
oneMap.put("deliveryname", jsonMst.getString("deliveryname")); // 送货方联系人
|
|
|
|
|
oneMap.put("deliveryphone", jsonMst.getString("deliveryphone")); // 送货方联系电话
|
|
|
|
|
|
|
|
|
|
// 6.多组填充
|
|
|
|
|
JSONArray dtlArr = WQL.getWO("ST_OUTIVT02").addParam("flag", "3").addParam("iostorinv_id", MapUtil.getStr(whereJson, "iostorinv_id")).process().getResultJSONArray(0);
|
|
|
|
|
|
|
|
|
|
@@ -2173,12 +2189,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|
|
|
|
|
|
|
|
|
if (shd_dtl_num > dtlArr.size()) {
|
|
|
|
|
double all_qty = 0;
|
|
|
|
|
String order_no = "";
|
|
|
|
|
ArrayList<HashMap<String, Object>> flData = new ArrayList<>();
|
|
|
|
|
WriteSheet sheet = EasyExcel.writerSheet().build();
|
|
|
|
|
for (int i = 0; i < dtlArr.size(); i++) {
|
|
|
|
|
JSONObject json = dtlArr.getJSONObject(i);
|
|
|
|
|
JSONObject jsonSub = subTab.query("package_box_sn = '" + json.getString("box_no") + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(jsonSub)) throw new BadRequestException("没有查询到子卷包装");
|
|
|
|
|
order_no = jsonSub.getString("sale_order_name");
|
|
|
|
|
|
|
|
|
|
// 规格: 厚度*幅宽
|
|
|
|
|
String material_spec = jsonSub.getString("thickness") + "*" + jsonSub.getString("width");
|
|
|
|
|
@@ -2191,17 +2209,21 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> mapFL = new HashMap<>();
|
|
|
|
|
// 明细
|
|
|
|
|
String date_of_production = jsonSub.getString("date_of_production").replaceAll("[[\\s-:punct:]]", "");
|
|
|
|
|
mapFL.put("date_of_production", date_of_production); // 批号 : 子卷包装生产日期
|
|
|
|
|
// String date_of_production = jsonSub.getString("date_of_production").replaceAll("[[\\s-:punct:]]", "");
|
|
|
|
|
// mapFL.put("date_of_production", date_of_production); // 批号 : 子卷包装生产日期
|
|
|
|
|
mapFL.put("material_name", json.getString("material_name"));
|
|
|
|
|
mapFL.put("material_spec", material_spec);
|
|
|
|
|
mapFL.put("qty_unit_name", "KG");
|
|
|
|
|
// mapFL.put("qty_unit_name", "KG");
|
|
|
|
|
mapFL.put("box_no", sub_box_no);
|
|
|
|
|
mapFL.put("qty", NumberUtil.round(json.getString("qty"), 2).doubleValue());
|
|
|
|
|
flData.add(mapFL);
|
|
|
|
|
all_qty = NumberUtil.add(String.valueOf(all_qty), json.getString("qty")).doubleValue();
|
|
|
|
|
}
|
|
|
|
|
oneMap.put("all_qty",all_qty);
|
|
|
|
|
// 订单号
|
|
|
|
|
if (ObjectUtil.isNotEmpty(order_no)) {
|
|
|
|
|
oneMap.put("order_no",order_no.substring(0,order_no.indexOf("-")));
|
|
|
|
|
}
|
|
|
|
|
oneMap.put("all_qty",all_qty); // 合计
|
|
|
|
|
workBook.fill(oneMap, sheet);
|
|
|
|
|
workBook.fill(new FillWrapper("data", flData), sheet);
|
|
|
|
|
workBook.finish();
|
|
|
|
|
@@ -2211,6 +2233,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|
|
|
|
Integer integer = Integer.valueOf(String.valueOf(NumberUtil.round(ceil, 0)));
|
|
|
|
|
|
|
|
|
|
double all_qty = 0;
|
|
|
|
|
String order_no = "";
|
|
|
|
|
ArrayList<HashMap<String, Object>> flData = new ArrayList<>();
|
|
|
|
|
for (int i = j * shd_dtl_num; i < (j + 1) * shd_dtl_num; i++) {
|
|
|
|
|
if (i == dtlArr.size()) {
|
|
|
|
|
@@ -2220,6 +2243,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|
|
|
|
JSONObject json = dtlArr.getJSONObject(i);
|
|
|
|
|
JSONObject jsonSub = subTab.query("package_box_sn = '" + json.getString("box_no") + "'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(jsonSub)) throw new BadRequestException("没有查询到子卷包装");
|
|
|
|
|
order_no = jsonSub.getString("sale_order_name");
|
|
|
|
|
|
|
|
|
|
// 规格: 厚度*幅宽
|
|
|
|
|
String material_spec = jsonSub.getString("thickness") + "*" + jsonSub.getString("width");
|
|
|
|
|
@@ -2232,11 +2256,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> mapFL = new HashMap<>();
|
|
|
|
|
// 明细
|
|
|
|
|
String date_of_production = jsonSub.getString("date_of_production").replaceAll("[[\\s-:punct:]]", "");
|
|
|
|
|
mapFL.put("date_of_production", date_of_production); // 批号 : 子卷包装生产日期
|
|
|
|
|
// String date_of_production = jsonSub.getString("date_of_production").replaceAll("[[\\s-:punct:]]", "");
|
|
|
|
|
// mapFL.put("date_of_production", date_of_production); // 批号 : 子卷包装生产日期
|
|
|
|
|
mapFL.put("material_name", json.getString("material_name"));
|
|
|
|
|
mapFL.put("material_spec", material_spec);
|
|
|
|
|
mapFL.put("qty_unit_name", "KG");
|
|
|
|
|
// mapFL.put("qty_unit_name", "KG");
|
|
|
|
|
mapFL.put("box_no", sub_box_no);
|
|
|
|
|
mapFL.put("qty", NumberUtil.round(json.getString("qty"), 2).doubleValue());
|
|
|
|
|
flData.add(mapFL);
|
|
|
|
|
@@ -2245,7 +2269,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|
|
|
|
all_qty = NumberUtil.add(String.valueOf(all_qty), json.getString("qty")).doubleValue();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
oneMap.put("all_qty",all_qty);
|
|
|
|
|
// 订单号
|
|
|
|
|
if (ObjectUtil.isNotEmpty(order_no)) {
|
|
|
|
|
oneMap.put("order_no",order_no.substring(0,order_no.indexOf("-")));
|
|
|
|
|
}
|
|
|
|
|
oneMap.put("all_qty",all_qty); // 合计
|
|
|
|
|
WriteSheet sheet = EasyExcel.writerSheet(0).build();
|
|
|
|
|
workBook.fill(oneMap, sheet);
|
|
|
|
|
workBook.fill(new FillWrapper("data", flData), sheet);
|
|
|
|
|
|