20241126更新

main
lcode 2 months ago
parent 1e5b68bf0a
commit 2e6d71c92e

@ -1,17 +1,21 @@
package com.currency.appengine.controller.export; package com.currency.appengine.controller.export;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.handler.inter.IExcelExportServer;
import com.currency.appengine.annotation.CheckToken;
import com.currency.appengine.domain.export.UserInfoExport; import com.currency.appengine.domain.export.UserInfoExport;
import com.currency.appengine.export.ExportServer; import com.currency.appengine.export.ExportServer;
import com.currency.appengine.export.impl.ExportServerImpl; import com.currency.appengine.export.impl.ExportServerImpl;
import com.currency.appengine.utils.StringUtil;
import com.currency.appengine.utils.export.poi.ExcelExportUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sun.security.util.PendingException; import sun.security.util.PendingException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
@RestController @RestController
@ -35,5 +39,4 @@ public class ExportController {
exportServer.exportExpertWord(json, request, response); exportServer.exportExpertWord(json, request, response);
} }
} }

@ -3,12 +3,17 @@ package com.currency.appengine.service.export;
import org.apache.poi.xssf.streaming.SXSSFSheet; import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
public interface ExportDataPageService { public interface ExportDataPageService {
int findCount(Map<String, Object> params, int method); int findCount(Map<String, Object> params, int method);
Object findPage(Map<String, Object> params, int method); Object findPage(Map<String, Object> params, int method);
void setWorkbook(SXSSFWorkbook wb, SXSSFSheet eachSheet, Integer startRowCount, Integer endRowCount, Object datas, int method); void setWorkbook(SXSSFWorkbook wb, SXSSFSheet eachSheet, Integer startRowCount, Integer endRowCount, Object datas, int method);
void magicExport(Integer count, Map bodyObj, String className, String sqlFunc, String fileName, String excelTitle,
String sheetName);
} }

@ -1,9 +1,13 @@
package com.currency.appengine.service.export.impl; package com.currency.appengine.service.export.impl;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.handler.inter.IExcelExportServer;
import com.currency.appengine.domain.export.UserInfoExport; import com.currency.appengine.domain.export.UserInfoExport;
import com.currency.appengine.handler.exception.MyException; import com.currency.appengine.handler.exception.MyException;
import com.currency.appengine.mapper.export.ExportMapper; import com.currency.appengine.mapper.export.ExportMapper;
import com.currency.appengine.service.export.ExportDataPageService; import com.currency.appengine.service.export.ExportDataPageService;
import com.currency.appengine.utils.ObjectUtil;
import com.currency.appengine.utils.export.poi.ExcelExportUtil;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font; import org.apache.poi.ss.usermodel.Font;
@ -13,11 +17,14 @@ import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.ssssssss.magicapi.core.context.RequestContext;
import org.ssssssss.magicapi.core.service.MagicAPIService;
import java.util.ArrayList; import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.Objects;
@Service @Service
public class ExportDataPageServiceImpl implements ExportDataPageService { public class ExportDataPageServiceImpl implements ExportDataPageService {
@ -25,8 +32,12 @@ public class ExportDataPageServiceImpl implements ExportDataPageService {
@Autowired @Autowired
private ExportMapper exportMapper; private ExportMapper exportMapper;
@Autowired
MagicAPIService service;
/** /**
* *
*
* @param params * @param params
* @param method * @param method
* @return * @return
@ -37,34 +48,36 @@ public class ExportDataPageServiceImpl implements ExportDataPageService {
} }
/** /**
* sql * sql
*
* @param params * @param params
* @param method * @param method
* @return * @return
*/ */
private String sql(Map<String, Object> params, int method){ private String sql(Map<String, Object> params, int method) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
switch (method) { switch (method) {
case 0:// 0 用户信息 case 0:// 0 用户信息
buffer.append("select id, user_id, status, date_format(create_time,'%Y-%m-%d %T') create_time, nick_name, user_img from mini_user where 1=1 "); buffer.append("select id, user_id, status, date_format(create_time,'%Y-%m-%d %T') create_time, nick_name, user_img from mini_user where 1=1 ");
if(Objects.nonNull(params.get("userId"))){ if (Objects.nonNull(params.get("userId"))) {
buffer.append(" and user_id like CONCAT('%',#{userId},'%') "); buffer.append(" and user_id like CONCAT('%',#{userId},'%') ");
} }
if(Objects.nonNull(params.get("nickName"))){ if (Objects.nonNull(params.get("nickName"))) {
buffer.append(" and nick_name like CONCAT('%',#{nickName},'%') "); buffer.append(" and nick_name like CONCAT('%',#{nickName},'%') ");
} }
if(Objects.nonNull(params.get("status"))){ if (Objects.nonNull(params.get("status"))) {
buffer.append(" and and status = #{status} "); buffer.append(" and and status = #{status} ");
} }
break; break;
default: default:
throw new MyException("导出失败传入method参数不匹配请检查代码"); throw new MyException("导出失败传入method参数不匹配请检查代码");
} }
return buffer.toString(); return buffer.toString();
} }
/** /**
* *
*
* @param params * @param params
* @param method * @param method
* @return * @return
@ -74,7 +87,7 @@ public class ExportDataPageServiceImpl implements ExportDataPageService {
Object list = new ArrayList<>(); Object list = new ArrayList<>();
switch (method) { switch (method) {
case 0:// 0 用户信息 case 0:// 0 用户信息
params.put("sql",this.sql(params, method)); params.put("sql", this.sql(params, method));
list = exportMapper.findUserInfoPage(params); list = exportMapper.findUserInfoPage(params);
break; break;
} }
@ -84,12 +97,13 @@ public class ExportDataPageServiceImpl implements ExportDataPageService {
/** /**
* 使 * 使
*
* @param wb * @param wb
* @param eachSheet * @param eachSheet
* @param startRowCount * @param startRowCount
* @param endRowCount * @param endRowCount
* @param datas * @param datas
* @param method * @param method
*/ */
@Override @Override
public void setWorkbook(SXSSFWorkbook wb, SXSSFSheet eachSheet, Integer startRowCount, Integer endRowCount, Object datas, int method) { public void setWorkbook(SXSSFWorkbook wb, SXSSFSheet eachSheet, Integer startRowCount, Integer endRowCount, Object datas, int method) {
@ -106,6 +120,41 @@ public class ExportDataPageServiceImpl implements ExportDataPageService {
} }
} }
@Override
public void magicExport(Integer count, Map bodyObj, String className, String sqlFunc, String fileName, String excelTitle,
String sheetName) {
try {
IExcelExportServer iExcelExportServer = new IExcelExportServer() {
@Override
// 分页查询 obj 总页数 page 第几页
public List<Object> selectListForExcelExport(Object obj, int page) {
bodyObj.put("page", page);
Map<String, Object> params = new HashMap<>();
params.put("body", bodyObj);
Object value = service.invoke(sqlFunc, params);
try {
List<Object> list = new ArrayList<>();
list.addAll(ObjectUtil.convertObjectToListBean(value, Class.forName(className)));
return list;
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
};
ExportParams exportParams = new ExportParams(excelTitle, sheetName);
ExcelExportUtil.exportBigEasyPoi(getResponse(), exportParams, fileName, Class.forName(className), iExcelExportServer, count);
} catch (Exception e) {
e.printStackTrace();
}
}
private HttpServletResponse getResponse() {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
return requestAttributes instanceof ServletRequestAttributes ? ((ServletRequestAttributes) requestAttributes).getResponse() : RequestContext.getHttpServletResponse().getResponse();
}
private void setUserInfoExportData(SXSSFWorkbook wb, SXSSFSheet eachSheet, Integer startRowCount, Integer endRowCount, List<UserInfoExport> list) { private void setUserInfoExportData(SXSSFWorkbook wb, SXSSFSheet eachSheet, Integer startRowCount, Integer endRowCount, List<UserInfoExport> list) {
for (int i = startRowCount; i <= endRowCount; i++) { for (int i = startRowCount; i <= endRowCount; i++) {
@ -118,10 +167,10 @@ public class ExportDataPageServiceImpl implements ExportDataPageService {
eachDataRow.createCell(3).setCellValue(model.getCreateTime()); eachDataRow.createCell(3).setCellValue(model.getCreateTime());
eachDataRow.createCell(4).setCellValue(model.getStatus()); eachDataRow.createCell(4).setCellValue(model.getStatus());
if("1".equals(model.getStatus())) { if ("1".equals(model.getStatus())) {
int physicalNumberOfCells = eachDataRow.getPhysicalNumberOfCells(); int physicalNumberOfCells = eachDataRow.getPhysicalNumberOfCells();
for (int j = 0; j < physicalNumberOfCells; j++) { for (int j = 0; j < physicalNumberOfCells; j++) {
if(i <= 1){ if (i <= 1) {
eachSheet.setColumnWidth(j, 20 * 256); eachSheet.setColumnWidth(j, 20 * 256);
} }
//获取当前单元格 中的value //获取当前单元格 中的value

@ -0,0 +1,76 @@
package com.currency.appengine.service.export.model;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class ExtrusionScheduleExport {
@Excel(name = "排产单号", width = 40)
private String scheduleNumber;
@Excel(name = "挤压排产日期", width = 40)
private String extrusionDate;
@Excel(name = "挤压机台", width = 40)
private String extrusionMachineName;
@Excel(name = "挤压班组", width = 40)
private String extrusionTeamName;
@Excel(name = "销售订单编号", width = 40)
private String salesOrderCode;
@Excel(name = "销售员", width = 40)
private String salespersonName;
@Excel(name = "物料编码", width = 40)
private String materialCode;
@Excel(name = "物料名称", width = 40)
private String materialName;
@Excel(name = "订单长度 (M)", width = 40)
private BigDecimal orderLength;
@Excel(name = "订单总数 (支)", width = 40)
private Integer orderTotalQuantity;
@Excel(name = "表面方式 (颜色)", width = 40)
private String surfaceMethod;
@Excel(name = "规格型号 (MM)", width = 40)
private String specification;
@Excel(name = "客方料号", width = 40)
private String customerMaterialCode;
@Excel(name = "壁厚", width = 40)
private BigDecimal thickness;
@Excel(name = "理论重量 (KG)", width = 40)
private BigDecimal theoreticalWeight;
@Excel(name = "实际总重量KG)", width = 40)
private BigDecimal actualWeight;
@Excel(name = "包装数量(扎数)", width = 40)
private Integer packingQuantity;
@Excel(name = "包装方式", width = 40)
private String packagingMethod;
@Excel(name = "排产长度", width = 40)
private BigDecimal productionLength;
@Excel(name = "排产支数", width = 40)
private Integer productionPieces;
@Excel(name = "锯切方式", width = 40)
private String sawingMethod;
@Excel(name = "排产理论重量", width = 40)
private BigDecimal productionWeight;
}

@ -0,0 +1,152 @@
package com.currency.appengine.service.export.model;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
*
*/
@Data
public class OrderTrackingExport {
@Excel(name = "销售订单号", width = 40)
private String salesOrderCode;
@Excel(name = "订单号", width = 40)
private String orderNo;
@Excel(name = "产品编码", width = 40)
private String materialCode;
@Excel(name = "物料名称", width = 40)
private String materialName;
@Excel(name = "型材型号", width = 40)
private String profileModel;
@Excel(name = "规格型号", width = 40)
private String specification;
@Excel(name = "壁厚", width = 40)
private String thickness;
@Excel(name = "米重 (kg/m)", width = 40)
private String weight;
@Excel(name = "订单总数 (支)", width = 40)
private String orderLength;
@Excel(name = "订单长度 (M)", width = 40)
private String orderTotalQuantity;
@Excel(name = "表面方式 (颜色)", width = 40)
private String surfaceMethod;
@Excel(name = "订单日期", width = 40)
private String deliveryDate;
@Excel(name = "理论重量 (KG)", width = 40)
private String theoreticalWeight;
@Excel(name = "生产支数", width = 40)
private String producedPieces;
@Excel(name = "生产长度 (m)", width = 40)
private String producedLength;
@Excel(name = "计划支数", width = 40)
private String plannedPieces;
@Excel(name = "排产长度", width = 40)
private String productionLength;
@Excel(name = "排产支数", width = 40)
private String productionPieces;
@Excel(name = "锯切方式", width = 40)
private String sawingMethod;
@Excel(name = "实际米重", width = 40)
private String jiya_productionWeight;
@Excel(name = "已挤压支数", width = 40)
private String jiya_productionNumber;
@Excel(name = "已挤压重量(KG)", width = 40)
private String jiya_actualWeight;
@Excel(name = "已精品支数", width = 40)
private String jingpin_productionNumber;
@Excel(name = "已精品重量(KG)", width = 40)
private String jingpin_productionWeight;
@Excel(name = "已氧化上排支数", width = 40)
private String yanghau1_productionNumber;
@Excel(name = "已氧化上排重量(KG)", width = 40)
private String yanghau1_actualWeight;
@Excel(name = "已氧化下排支数", width = 40)
private String yanghua2_productionNumber;
@Excel(name = "已氧化下排重量(KG)", width = 40)
private String yanghua2_actualWeight;
@Excel(name = "已精切支数", width = 40)
private String jingqie_productionNumber;
@Excel(name = "已精切重量(KG)", width = 40)
private String jingqie_actualWeight;
@Excel(name = "已打孔支数", width = 40)
private String dk_productionNumber;
@Excel(name = "已打孔重量(KG)", width = 40)
private String dk_actualWeight;
@Excel(name = "已包装支数", width = 40)
private String bz_productionNumber;
@Excel(name = "已包装重量(KG)", width = 40)
private String bz_actualWeight;
@Excel(name = "入库支数", width = 40)
private String receiptQuantity;
@Excel(name = "已入库重量(KG)", width = 40)
private String actualWeight;
@Excel(name = "交货支数", width = 40)
private String shipmentQuantity;
@Excel(name = "已交货重量(KG)", width = 40)
private String shipmentActualWeight;
@Excel(name = "未交货支数", width = 40)
private String noShipmentQuantity;
@Excel(name = "未交货重量(KG)", width = 40)
private String noActualWeight;
@Excel(name = "库存总支数", width = 40)
private String existingInventory;
@Excel(name = "库存总重量(KG)", width = 40)
private String existingActualWeight;
@Excel(name = "长料报废支数", width = 40)
private String longScrapNumber;
@Excel(name = "长料报废重量(KG)", width = 40)
private String longScrapWeight;
@Excel(name = "短料报费支数", width = 40)
private String shortageScrapNumber;
@Excel(name = "短料报费重量(KG)", width = 40)
private String shortageScrapWeight;
}

@ -7,6 +7,8 @@ import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
public class ObjectUtil { public class ObjectUtil {
@ -57,6 +59,47 @@ public class ObjectUtil {
return null; return null;
} }
public static <T> List<T> convertObjectToListBean(Object obj, Class<T> beanClass) {
List<T> beanList = new ArrayList<>();
if (obj instanceof List<?>) {
@SuppressWarnings("unchecked")
List<Map<String, Object>> listMap = (List<Map<String, Object>>) obj;
for (Map<String, Object> map : listMap) {
T bean;
try {
bean = beanClass.newInstance(); // 创建Bean实例
Field[] fields = beanClass.getDeclaredFields(); // 获取Bean的所有字段
for (Field field : fields) {
field.setAccessible(true); // 设置字段可访问
Object value = map.get(field.getName()); // 从Map中获取值
if (value != null) {
if (value != null && !field.getType().isAssignableFrom(value.getClass())) {
// 进行类型转换
if (BigDecimal.class.isAssignableFrom(field.getType())) {
value = new BigDecimal(value.toString());
} else if (Integer.class.isAssignableFrom(field.getType())) {
value = Integer.parseInt(value.toString());
} else if (Double.class.isAssignableFrom(field.getType())) {
value = Double.parseDouble(value.toString());
} else {
value = String.valueOf(value);
}
// 其他类型转换...
}
field.set(bean, value); // 将值设置到Bean的字段中
}
}
beanList.add(bean); // 将填充好的Bean添加到列表中
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
}
}
return beanList;
}
public static <K, V> List<Map<K, V>> castListMap(Object obj, Class<K> kCalzz, Class<V> vCalzz) { public static <K, V> List<Map<K, V>> castListMap(Object obj, Class<K> kCalzz, Class<V> vCalzz) {
List<Map<K, V>> result = new ArrayList<>(); List<Map<K, V>> result = new ArrayList<>();
if (obj instanceof List<?>) { if (obj instanceof List<?>) {

@ -5,7 +5,7 @@
"groupId" : "40879f3a602c40e493f0b273de9fc01e", "groupId" : "40879f3a602c40e493f0b273de9fc01e",
"name" : "列表仓库物料", "name" : "列表仓库物料",
"createTime" : null, "createTime" : null,
"updateTime" : 1728715379207, "updateTime" : 1732449052120,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -51,6 +51,7 @@ String materialCode = body.materialCode;
String materialName = body.materialName; String materialName = body.materialName;
String profileModel = body.profileModel; String profileModel = body.profileModel;
String warehouse = body.warehouse; String warehouse = body.warehouse;
String queryType = body['type']; // 1-只查看有库存的
return db.page(""" return db.page("""
select select
@ -83,9 +84,10 @@ return db.page("""
mwm.create_by, mwm.create_by,
mwm.pieces mwm.pieces
from mini_warehouse_material mwm from mini_warehouse_material mwm
where 1=1 where 1=1
?{materialCode != null and materialCode != "", and mwm.material_code like concat('%', #{materialCode}, '%') } ?{materialCode != null and materialCode != "", and mwm.material_code like concat('%', #{materialCode}, '%') }
?{materialName != null and materialName != "", and mwm.material_name like concat('%', #{materialName}, '%') } ?{materialName != null and materialName != "", and mwm.material_name like concat('%', #{materialName}, '%') }
?{profileModel != null and profileModel != "", and mwm.profile_model like concat('%', #{profileModel}, '%') } ?{profileModel != null and profileModel != "", and mwm.profile_model like concat('%', #{profileModel}, '%') }
?{warehouse != null and warehouse != "", and mwm.warehouse = #{warehouse} } ?{warehouse != null and warehouse != "", and mwm.warehouse = #{warehouse} }
?{queryType != null and queryType != "" and queryType == 1, and mwm.existing_inventory > 0 }
"""); """);

@ -0,0 +1,14 @@
{
"properties" : { },
"id" : "01a85821982944e8855e0cb8d3d48c72",
"name" : "导出",
"type" : "api",
"parentId" : "c6ba5ea7aca143ef95dffaf14b4960e5",
"path" : "/export",
"createTime" : 1732603484379,
"updateTime" : null,
"createBy" : null,
"updateBy" : null,
"paths" : [ ],
"options" : [ ]
}

@ -0,0 +1,36 @@
{
"properties" : { },
"id" : "ec8de9306e07460eb7f04f43b5e7edcf",
"script" : null,
"groupId" : "01a85821982944e8855e0cb8d3d48c72",
"name" : "挤压排产单导出",
"createTime" : null,
"updateTime" : 1732611077461,
"lock" : null,
"createBy" : null,
"updateBy" : null,
"path" : "/extrusionSchedule",
"method" : "POST",
"parameters" : [ ],
"options" : [ ],
"requestBody" : "",
"headers" : [ ],
"paths" : [ ],
"responseBody" : null,
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
}
================================
import 'exportDataPageServiceImpl' as exportDataPageServiceImpl;
import '@/sql/extrusionSchedule/count' as masterFind;
import response
int count = masterFind(body);
body['page'] = 1
body['size'] = 100;
exportDataPageServiceImpl.magicExport(count, body, "com.currency.appengine.service.export.model.ExtrusionScheduleExport", '/sql/extrusionSchedule/list', '挤压排产', '挤压排产', '挤压排产');
response.end();

@ -0,0 +1,36 @@
{
"properties" : { },
"id" : "914ca6c8b3ae43e3ae6029318edff17c",
"script" : null,
"groupId" : "01a85821982944e8855e0cb8d3d48c72",
"name" : "订单跟踪导出",
"createTime" : null,
"updateTime" : 1732610997776,
"lock" : null,
"createBy" : null,
"updateBy" : null,
"path" : "/orderTracking",
"method" : "POST",
"parameters" : [ ],
"options" : [ ],
"requestBody" : "",
"headers" : [ ],
"paths" : [ ],
"responseBody" : null,
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
}
================================
import 'exportDataPageServiceImpl' as exportDataPageServiceImpl;
import '@/sql/orderTracking/count' as masterFind;
import response
int count = masterFind(body);
body['page'] = 1
body['size'] = 100;
exportDataPageServiceImpl.magicExport(count, body, "com.currency.appengine.service.export.model.OrderTrackingExport", '/sql/orderTracking/list', '订单跟踪表', '订单跟踪表', '订单跟踪表');
response.end();

@ -5,7 +5,7 @@
"groupId" : "4aa6b5de02c244e2981c22bf5a95394d", "groupId" : "4aa6b5de02c244e2981c22bf5a95394d",
"name" : "产品入库详细列表", "name" : "产品入库详细列表",
"createTime" : null, "createTime" : null,
"updateTime" : 1732270231302, "updateTime" : 1732592493010,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -26,7 +26,13 @@ import '@/common/sql' as sql
String warehouseProductMaterial = sql("warehouseProductMaterial") String warehouseProductMaterial = sql("warehouseProductMaterial")
warehouseProductMaterial = warehouseProductMaterial.replace('mwp.packing_quantity,', '').replace('mwp.customer_id,', '') warehouseProductMaterial = warehouseProductMaterial.replace('mwp.packing_quantity,', '').replace('mwp.customer_id,', '')
String documentNumber = body.documentNumber; String documentNumber = body['documentNumber'];
String orderNo = body['orderNo'];
String materialCode = body['materialCode'];
String profileModel = body['profileModel'];
String customerId = body['customerId'];
String surfaceMethod = body['surfaceMethod'];
return db.page(""" return db.page("""
select select
@ -52,4 +58,10 @@ return db.page("""
left join mini_warehouses mw on mw.warehouse_code = mwp.warehouse left join mini_warehouses mw on mw.warehouse_code = mwp.warehouse
where 1=1 where 1=1
?{documentNumber!=null && documentNumber!="", and mpr.document_number like concat('%', #{documentNumber} ,'%') } ?{documentNumber!=null && documentNumber!="", and mpr.document_number like concat('%', #{documentNumber} ,'%') }
?{orderNo != null and orderNo != '', and mwp.order_no like concat('%', #{orderNo}, '%')}
?{materialCode != null and materialCode != '', and mwp.material_code like concat('%', #{materialCode}, '%')}
?{profileModel != null and profileModel != '', and mwp.profile_model like concat('%', #{profileModel}, '%')}
?{customerId != null and customerId != '', and mpr.customer_id = #{customerId}}
?{surfaceMethod != null and surfaceMethod != '', and mwp.surface_method = #{surfaceMethod}}
"""); """);

@ -5,7 +5,7 @@
"groupId" : "f4b3acf704cf4db29258ba70e24f8fc5", "groupId" : "f4b3acf704cf4db29258ba70e24f8fc5",
"name" : "列表", "name" : "列表",
"createTime" : null, "createTime" : null,
"updateTime" : 1732243472745, "updateTime" : 1732611589866,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -25,10 +25,10 @@
"expression" : null, "expression" : null,
"children" : null "children" : null
} ], } ],
"requestBody" : "", "requestBody" : "{\r\n \"page\": 1,\r\n \"size\": 30\r\n}",
"headers" : [ { "headers" : [ {
"name" : "authorization", "name" : "authorization",
"value" : null, "value" : "5E34C0D7EA601026B93C26119C7E1AD5FD8181534AF63488EA20A16DC159FCC834A620E0A0B1706ADEAA4B0F75B5AF85",
"description" : "登录token", "description" : "登录token",
"required" : false, "required" : false,
"dataType" : "String", "dataType" : "String",
@ -40,7 +40,7 @@
"children" : null "children" : null
} ], } ],
"paths" : [ ], "paths" : [ ],
"responseBody" : null, "responseBody" : "{\n \"code\": -1,\n \"data\": null,\n \"message\": \"系统内部出现错误\"\n}",
"description" : null, "description" : null,
"requestBodyDefinition" : null, "requestBodyDefinition" : null,
"responseBodyDefinition" : null "responseBodyDefinition" : null
@ -66,10 +66,11 @@ var sql = """
left join sys_user su on su.user_id = mes.extrusion_team left join sys_user su on su.user_id = mes.extrusion_team
left join mini_production_machines mpm on mpm.machine_code = mes.extrusion_machine left join mini_production_machines mpm on mpm.machine_code = mes.extrusion_machine
where 1=1 where 1=1
?{scheduleNumber!=null && scheduleNumber!="", and mes.schedule_number like concat('%', #{scheduleNumber} ,'%') } ?{scheduleNumber!=null && scheduleNumber!="", and mes.schedule_number like concat('%', #{scheduleNumber} ,'%') }
?{extrusionDate!=null && extrusionDate!="", and date(mes.extrusion_date) = #{extrusionDate} } ?{extrusionDate!=null && extrusionDate!="", and date(mes.extrusion_date) = #{extrusionDate} }
?{extrusionMachine!=null && extrusionMachine!="", and mes.extrusion_machine = #{extrusionMachine} } ?{extrusionMachine!=null && extrusionMachine!="", and mes.extrusion_machine = #{extrusionMachine} }
?{extrusionTeam!=null && extrusionTeam!="", and mes.extrusion_team = #{extrusionTeam} } ?{extrusionTeam!=null && extrusionTeam!="", and mes.extrusion_team = #{extrusionTeam} }
""" """
return db.page(sql); return db.page(sql)

@ -5,7 +5,7 @@
"groupId" : "f4b3acf704cf4db29258ba70e24f8fc5", "groupId" : "f4b3acf704cf4db29258ba70e24f8fc5",
"name" : "详情列表", "name" : "详情列表",
"createTime" : null, "createTime" : null,
"updateTime" : 1732271133944, "updateTime" : 1732611995797,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -548,6 +548,10 @@ String materialCode = body["materialCode"];
String profileModel = body["profileModel"]; String profileModel = body["profileModel"];
String salesStatus = body["salesStatus"]; String salesStatus = body["salesStatus"];
String extrusionDate = body['extrusionDate'];
String customerId = body['customerId'];
String surfaceMethod = body['surfaceMethod'];
return db.page(""" return db.page("""
select select
date_format(mes.extrusion_date, '%Y-%m-%d') as extrusion_date, date_format(mes.extrusion_date, '%Y-%m-%d') as extrusion_date,
@ -578,4 +582,8 @@ return db.page("""
?{materialCode != null and materialCode != '', and msm.material_code like concat('%', #{materialCode}, '%')} ?{materialCode != null and materialCode != '', and msm.material_code like concat('%', #{materialCode}, '%')}
?{profileModel != null and profileModel != '', and msm.profile_model like concat('%', #{profileModel}, '%')} ?{profileModel != null and profileModel != '', and msm.profile_model like concat('%', #{profileModel}, '%')}
?{salesStatus != null and salesStatus != '', and mso.status = #{salesStatus}} ?{salesStatus != null and salesStatus != '', and mso.status = #{salesStatus}}
?{extrusionDate!=null && extrusionDate!="", and date(mes.extrusion_date) = #{extrusionDate} }
?{customerId != null and customerId != '', and mso.customer_id = #{customerId}}
?{surfaceMethod != null and surfaceMethod != '', and msm.surface_method = #{surfaceMethod}}
""") """)

@ -5,7 +5,7 @@
"groupId" : "d4e06c480fb04ecaaaee36cd3ad92aea", "groupId" : "d4e06c480fb04ecaaaee36cd3ad92aea",
"name" : "领料物料列表", "name" : "领料物料列表",
"createTime" : null, "createTime" : null,
"updateTime" : 1732270091770, "updateTime" : 1732592621097,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -27,6 +27,12 @@ import '@/common/sql' as sql
String documentNumber = body.documentNumber; String documentNumber = body.documentNumber;
String warehouse = body.warehouse; String warehouse = body.warehouse;
String orderNo = body['orderNo'];
String materialCode = body['materialCode'];
String profileModel = body['profileModel'];
String customerId = body['customerId'];
String surfaceMethod = body['surfaceMethod'];
String warehouseMaterial = sql("warehouseMaterial") String warehouseMaterial = sql("warehouseMaterial")
return db.page(""" return db.page("""

@ -5,7 +5,7 @@
"groupId" : "a170047f79ab4cb1b892edc5cccd823e", "groupId" : "a170047f79ab4cb1b892edc5cccd823e",
"name" : "详情列表", "name" : "详情列表",
"createTime" : null, "createTime" : null,
"updateTime" : 1732419716776, "updateTime" : 1732592442218,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -24,6 +24,12 @@
================================ ================================
String documentNumber = body["documentNumber"]; String documentNumber = body["documentNumber"];
String orderNo = body['orderNo'];
String materialCode = body['materialCode'];
String profileModel = body['profileModel'];
String customerId = body['customerId'];
String surfaceMethod = body['surfaceMethod'];
var sql = """ var sql = """
select select
mss.customer_id, mss.customer_id,
@ -61,8 +67,15 @@ var sql = """
left join mini_sales_shipment_materials mssm on mssm.sales_shipment_code = mss.document_number left join mini_sales_shipment_materials mssm on mssm.sales_shipment_code = mss.document_number
left join mini_warehouse_product mwp on left join mini_warehouse_product mwp on
mwp.material_code = mssm.material_code and mwp.warehouse = mssm.warehouse and mwp.sales_order_code = mssm.sales_order_code and mwp.order_no = mssm.order_no mwp.material_code = mssm.material_code and mwp.warehouse = mssm.warehouse and mwp.sales_order_code = mssm.sales_order_code and mwp.order_no = mssm.order_no
left join mini_sales_orders mso on mwp.sales_order_code = mso.document_number
where 1 = 1 where 1 = 1
?{documentNumber != null and documentNumber != '', and mss.document_number like concat('%', #{documentNumber}, '%')} ?{documentNumber != null and documentNumber != '', and mss.document_number like concat('%', #{documentNumber}, '%')}
?{orderNo != null and orderNo != '', and mwp.order_no like concat('%', #{orderNo}, '%')}
?{materialCode != null and materialCode != '', and mwp.material_code like concat('%', #{materialCode}, '%')}
?{profileModel != null and profileModel != '', and mwp.profile_model like concat('%', #{profileModel}, '%')}
?{customerId != null and customerId != '', and mso.customer_id = #{customerId}}
?{surfaceMethod != null and surfaceMethod != '', and mwp.surface_method = #{surfaceMethod}}
""" """
return db.page(sql); return db.page(sql);

@ -5,7 +5,7 @@
"groupId" : "e631b317606f4246ac82585a7c1f1c5b", "groupId" : "e631b317606f4246ac82585a7c1f1c5b",
"name" : "详情列表", "name" : "详情列表",
"createTime" : null, "createTime" : null,
"updateTime" : 1732266000158, "updateTime" : 1732591664784,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -25,6 +25,12 @@
String salesOrderCode = body.salesOrderCode; String salesOrderCode = body.salesOrderCode;
String status = body.status; String status = body.status;
String orderNo = body['orderNo'];
String materialCode = body['materialCode'];
String profileModel = body['profileModel'];
String customerId = body['customerId'];
String surfaceMethod = body['surfaceMethod'];
return db.page(""" return db.page("""
select select
msom.id, msom.id,
@ -78,8 +84,11 @@ return db.page("""
left join sys_user su on su.user_id = mso.salesperson left join sys_user su on su.user_id = mso.salesperson
left join mini_customer_info mci on mci.customer_code = mso.customer_id left join mini_customer_info mci on mci.customer_code = mso.customer_id
where 1=1 where 1=1
?{salesOrderCode != null and salesOrderCode != "", ?{salesOrderCode != null and salesOrderCode != "", and msom.sales_order_code list concat('%',#{salesOrderCode},'%') }
and msom.sales_order_code list concat('%',#{salesOrderCode},'%') } ?{status != null and status != "", and msom.status = #{status} }
?{status != null and status != "", ?{orderNo != null and orderNo != '', and msom.order_no like concat('%', #{orderNo}, '%')}
and msom.status = #{status} } ?{materialCode != null and materialCode != '', and msom.material_code like concat('%', #{materialCode}, '%')}
?{profileModel != null and profileModel != '', and msom.profile_model like concat('%', #{profileModel}, '%')}
?{customerId != null and customerId != '', and mso.customer_id = #{customerId}}
?{surfaceMethod != null and surfaceMethod != '', and msom.surface_method = #{surfaceMethod}}
""") """)

@ -0,0 +1,14 @@
{
"properties" : { },
"id" : "753fe736c4d7438090c366180c352d95",
"name" : "挤压排产",
"type" : "function",
"parentId" : "414d04bbdc2e4cb5a23145a0bfe0e649",
"path" : "extrusionSchedule",
"createTime" : 1732610226287,
"updateTime" : null,
"createBy" : null,
"updateBy" : null,
"paths" : [ ],
"options" : [ ]
}

@ -0,0 +1,69 @@
{
"properties" : { },
"id" : "7f8e4140006446d28b625fcb7aa6b967",
"script" : null,
"groupId" : "753fe736c4d7438090c366180c352d95",
"name" : "挤压排产列表",
"createTime" : null,
"updateTime" : 1732611845401,
"lock" : null,
"createBy" : null,
"updateBy" : null,
"path" : "/list",
"description" : null,
"returnType" : null,
"mappingPath" : null,
"parameters" : [ ]
}
================================
import '@/common/sql' as sql
String salesOrdeSelect = sql("salesOrder")
String scheduleNumber = body["scheduleNumber"];
String salesOrderCode = body["salesOrderCode"];
String orderNo = body["orderNo"];
String materialCode = body["materialCode"];
String profileModel = body["profileModel"];
String salesStatus = body["salesStatus"];
String extrusionDate = body['extrusionDate'];
String customerId = body['customerId'];
String surfaceMethod = body['surfaceMethod'];
var list = db.page("""
select
date_format(mes.extrusion_date, '%Y-%m-%d') as extrusion_date,
mes.extrusion_machine,
mpm.machine_name as extrusion_machine_name,
mes.extrusion_team,
su.user_name as extrusion_team_name,
mesd.schedule_number,
mesd.production_length,
mesd.production_pieces,
mesd.sawing_method,
su2.user_name as salesperson_name,
${salesOrdeSelect}
from
mini_extrusion_schedule_detail mesd
left join mini_extrusion_schedule mes on mes.schedule_number = mesd.schedule_number
left join sys_user su on su.user_id = mes.extrusion_team
left join mini_production_machines mpm on mpm.machine_code = mes.extrusion_machine
left join mini_sales_order_materials msm
on mesd.sales_order_code = msm.sales_order_code and mesd.material_code = msm.material_code and mesd.order_no = msm.order_no
left join mini_sales_orders mso on mso.document_number = msm.sales_order_code
left join sys_user su2 on su2.user_id = mso.salesperson
where 1=1
?{scheduleNumber != null and scheduleNumber != '', and mesd.schedule_number like concat('%', #{scheduleNumber}, '%')}
?{salesOrderCode != null and salesOrderCode != '', and msm.sales_order_code like concat('%', #{salesOrderCode}, '%')}
?{orderNo != null and orderNo != '', and msm.order_no like concat('%', #{orderNo}, '%')}
?{materialCode != null and materialCode != '', and msm.material_code like concat('%', #{materialCode}, '%')}
?{profileModel != null and profileModel != '', and msm.profile_model like concat('%', #{profileModel}, '%')}
?{salesStatus != null and salesStatus != '', and mso.status = #{salesStatus}}
?{extrusionDate!=null && extrusionDate!="", and date(mes.extrusion_date) = #{extrusionDate} }
?{customerId != null and customerId != '', and mso.customer_id = #{customerId}}
?{surfaceMethod != null and surfaceMethod != '', and msm.surface_method = #{surfaceMethod}}
""")
return list.list

@ -0,0 +1,69 @@
{
"properties" : { },
"id" : "78482de7c59040fe9939e6628c02ee0f",
"script" : null,
"groupId" : "753fe736c4d7438090c366180c352d95",
"name" : "挤压排产总数",
"createTime" : null,
"updateTime" : 1732611825930,
"lock" : null,
"createBy" : null,
"updateBy" : null,
"path" : "/count",
"description" : null,
"returnType" : null,
"mappingPath" : null,
"parameters" : [ {
"name" : "body",
"value" : null,
"description" : null,
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : null,
"error" : null,
"expression" : null,
"children" : null
} ]
}
================================
import '@/common/sql' as sql
String salesOrdeSelect = sql("salesOrder")
String scheduleNumber = body["scheduleNumber"];
String salesOrderCode = body["salesOrderCode"];
String orderNo = body["orderNo"];
String materialCode = body["materialCode"];
String profileModel = body["profileModel"];
String salesStatus = body["salesStatus"];
String extrusionDate = body['extrusionDate'];
String customerId = body['customerId'];
String surfaceMethod = body['surfaceMethod'];
return db.selectInt("""
select
count(1)
from
mini_extrusion_schedule_detail mesd
left join mini_extrusion_schedule mes on mes.schedule_number = mesd.schedule_number
left join sys_user su on su.user_id = mes.extrusion_team
left join mini_production_machines mpm on mpm.machine_code = mes.extrusion_machine
left join mini_sales_order_materials msm
on mesd.sales_order_code = msm.sales_order_code and mesd.material_code = msm.material_code and mesd.order_no = msm.order_no
left join mini_sales_orders mso on mso.document_number = msm.sales_order_code
left join sys_user su2 on su2.user_id = mso.salesperson
where 1=1
?{scheduleNumber != null and scheduleNumber != '', and mesd.schedule_number like concat('%', #{scheduleNumber}, '%')}
?{salesOrderCode != null and salesOrderCode != '', and msm.sales_order_code like concat('%', #{salesOrderCode}, '%')}
?{orderNo != null and orderNo != '', and msm.order_no like concat('%', #{orderNo}, '%')}
?{materialCode != null and materialCode != '', and msm.material_code like concat('%', #{materialCode}, '%')}
?{profileModel != null and profileModel != '', and msm.profile_model like concat('%', #{profileModel}, '%')}
?{salesStatus != null and salesStatus != '', and mso.status = #{salesStatus}}
?{extrusionDate!=null && extrusionDate!="", and date(mes.extrusion_date) = #{extrusionDate} }
?{customerId != null and customerId != '', and mso.customer_id = #{customerId}}
?{surfaceMethod != null and surfaceMethod != '', and msm.surface_method = #{surfaceMethod}}
""")

@ -0,0 +1,14 @@
{
"properties" : { },
"id" : "ac6602436d574b049dcf80eee3ff5d8d",
"name" : "订单跟踪",
"type" : "function",
"parentId" : "414d04bbdc2e4cb5a23145a0bfe0e649",
"path" : "orderTracking",
"createTime" : null,
"updateTime" : 1732601307816,
"createBy" : null,
"updateBy" : null,
"paths" : [ ],
"options" : [ ]
}

@ -0,0 +1,318 @@
{
"properties" : { },
"id" : "b9d2add17088436ea92dd36fd1462557",
"script" : null,
"groupId" : "ac6602436d574b049dcf80eee3ff5d8d",
"name" : "订单跟踪列表",
"createTime" : null,
"updateTime" : 1732609621796,
"lock" : null,
"createBy" : null,
"updateBy" : null,
"path" : "/list",
"description" : null,
"returnType" : null,
"mappingPath" : null,
"parameters" : [ {
"name" : "salesOrderList",
"value" : null,
"description" : null,
"required" : false,
"dataType" : "String",
"type" : "java.lang.Object",
"defaultValue" : null,
"validateType" : null,
"error" : null,
"expression" : null,
"children" : null
} ]
}
================================
String salesOrderCode = body['salesOrderCode'];
String orderNo = body['orderNo'];
String materialCode = body['materialCode'];
String profileModel = body['profileModel'];
String customerId = body['customerId'];
String surfaceMethod = body['surfaceMethod'];
println("订单跟踪列表")
println(body)
// ==============================
// 1.查询销售单明细
// ==============================
var sql = """
select
msom.sales_order_code,
msom.order_no,
msom.material_code,
msom.material_name,
msom.profile_model,
msom.specification,
msom.thickness,
msom.weight,
msom.order_length,
msom.order_total_quantity,
msom.surface_method,
msom.delivery_date,
msom.theoretical_weight,
msom.produced_pieces,
msom.produced_length
from mini_sales_order_materials msom
left join mini_sales_orders mso on mso.document_number = msom.sales_order_code
where 1=1
?{orderNo != null and orderNo != '', and msom.order_no like concat('%', #{orderNo}, '%')}
?{materialCode != null and materialCode != '', and msom.material_code like concat('%', #{materialCode}, '%')}
?{profileModel != null and profileModel != '', and msom.profile_model like concat('%', #{profileModel}, '%')}
?{customerId != null and customerId != '', and mso.customer_id = #{customerId}}
?{surfaceMethod != null and surfaceMethod != '', and msom.surface_method = #{surfaceMethod}}
?{salesOrderCode != null and salesOrderCode != '', and msom.sales_order_code = #{salesOrderCode}}
"""
Map pages = db.page(sql);
List salesOrderList = pages.list;
if (salesOrderList.size() == 0) {
return []
}
// ==============================
// 2.查询生产计划数据
// ==============================
var sql2 = """
select
sales_order_code,
order_no,
sum(planned_pieces) as planned_pieces
from mini_production_schedule
where 1=1 and (sales_order_code, order_no) in (
<foreach item='item' index='index' collection='salesOrderList' separator=','>
(#{item.salesOrderCode}, #{item.orderNo})
</foreach>
)
group by sales_order_code, order_no
"""
List productionScheduleList = db.select(sql2)
// ==============================
// 3.查询挤压排产数据
// ==============================
var sql3 = """
select
sales_order_code,
order_no,
group_concat(schedule_number order by schedule_number separator ', ') as schedule_number,
sum(production_length) as production_length,
sum(production_pieces) as production_pieces,
max(sawing_method) as sawing_method
from mini_extrusion_schedule_detail
where 1=1 and (sales_order_code, order_no) in (
<foreach item='item' index='index' collection='salesOrderList' separator=','>
(#{item.salesOrderCode}, #{item.orderNo})
</foreach>
)
group by sales_order_code, order_no
"""
List extrusionScheduleDetail = db.select(sql3)
// ==============================
// 4.查询报工数据
// ==============================
var sql4 = """
select
mpr.sales_order_code,
mpr.order_no,
mpr.current_process,
round((sum(mesd.production_length) * sum(production_number) * sum(production_weight)), 4) as actual_weight_mesd,
round((sum(msom.order_length) * sum(production_number) * sum(production_weight)), 4) as actual_weight_msom,
sum(production_number) as production_number,
max(production_weight) as production_weight
from mini_process_report mpr
left join mini_extrusion_schedule_detail mesd
on mpr.sales_order_code = mesd.sales_order_code and mpr.order_no = mesd.order_no
left join mini_sales_order_materials msom
on mpr.sales_order_code = msom.sales_order_code and mpr.order_no = msom.order_no
where 1=1 and (mpr.sales_order_code, mpr.order_no) in (
<foreach item='item' index='index' collection='salesOrderList' separator=','>
(#{item.salesOrderCode}, #{item.orderNo})
</foreach>
)
group by mpr.sales_order_code, mpr.order_no, mpr.current_process
"""
List processReportList = db.select(sql4)
// 处理数据
// actualWeightMesd 排产长度计算
// actualWeightMsom 订单长度计算
var processReportFinalList = []
var arr = ['jingqie','dk','bz']
processReportList.group(it => it.salesOrderCode + "_" + it.orderNo, // 根据api_group_id 分组
list => list.group(item => item.currentProcess,
obj => obj
)
).each((key, value) => {
var jsonObj = {}
value.each((key1, value1) => {
var val = value1[0];
jsonObj["salesOrderCode"] = val.salesOrderCode;
jsonObj["orderNo"] = val.orderNo;
if (arr.contains(key1)) {
jsonObj[key1 + "_actualWeight"] = val.actualWeightMsom;
} else {
jsonObj[key1 + "_actualWeight"] = val.actualWeightMesd;
}
jsonObj[key1 + "_productionNumber"] = val.productionNumber;
jsonObj[key1 + "_productionWeight"] = val.productionWeight;
})
processReportFinalList.push(jsonObj)
})
// ==============================
// 5.查询长料报废数据
// 挤压、精品、氧化上排、氧化下排工序
// ==============================
var sql5 = """
select
sales_order_code,
order_no,
sum(scrap_number) as long_scrap_number,
sum(scrap_weight) as long_scrap_weight
from mini_process_report mpr
where 1=1 and mpr.current_process in ('jiya','jinpin','yanghua1','yanghua2')
and (mpr.sales_order_code, mpr.order_no) in (
<foreach item='item' index='index' collection='salesOrderList' separator=','>
(#{item.salesOrderCode}, #{item.orderNo})
</foreach>
)
group by mpr.sales_order_code, mpr.order_no
"""
List processReportLongList = db.select(sql5)
// ==============================
// 6.查询短料报废数据
// 精切,打孔,包装工序
// ==============================
var sql6 = """
select
sales_order_code,
order_no,
sum(scrap_number) as shortage_scrap_number,
sum(scrap_weight) as shortage_scrap_weight
from mini_process_report mpr
where 1=1 and mpr.current_process in ('jingqie','dk','bz')
and (mpr.sales_order_code, mpr.order_no) in (
<foreach item='item' index='index' collection='salesOrderList' separator=','>
(#{item.salesOrderCode}, #{item.orderNo})
</foreach>
)
group by mpr.sales_order_code, mpr.order_no
"""
List processReportShortageList = db.select(sql6)
// ==============================
// 7.入库状况
// ==============================
var sql7 = """
select
mpr.sales_order_code,
mpr.order_no,
sum(mpr.receipt_quantity) as receipt_quantity,
sum(mpr.actual_weight) as actual_weight
from
mini_product_receipt mpr
where 1=1
and (mpr.sales_order_code, mpr.order_no) in (
<foreach item='item' index='index' collection='salesOrderList' separator=','>
(#{item.salesOrderCode}, #{item.orderNo})
</foreach>
)
group by mpr.sales_order_code, mpr.order_no
"""
List productReceiptList = db.select(sql7)
// ==============================
// 8.出库和库存数据
// ==============================
// (sum(mwp.existing_inventory) - sum(mssm.shipment_quantity)) as no_shipment_quantity,
// (sum(mwp.actual_weight) - sum(mssm.actual_weight)) as no_actual_weight,
var sql8 = """
select
mssm.sales_order_code,
mssm.order_no,
sum(mssm.shipment_quantity) as shipment_quantity,
sum(mssm.actual_weight) as shipment_actual_weight,
sum(mwp.existing_inventory) as no_shipment_quantity,
sum(mwp.actual_weight) as no_actual_weight,
round((sum(mwp.existing_inventory) + sum(mssm.shipment_quantity)), 4) as existing_inventory,
round((sum(mwp.actual_weight) + sum(mssm.actual_weight)), 4) as existing_actual_weight
from
mini_sales_shipment_materials mssm
left join mini_warehouse_product mwp on
mwp.order_no = mssm.order_no
and mwp.sales_order_code = mssm.sales_order_code
where 1=1
and (mssm.sales_order_code, mssm.order_no) in (
<foreach item='item' index='index' collection='salesOrderList' separator=','>
(#{item.salesOrderCode}, #{item.orderNo})
</foreach>
)
group by mssm.sales_order_code, mssm.order_no
"""
List salesShipmenList = db.select(sql8)
var result = select
a.*,
b.plannedPieces,
c.productionLength,
c.productionPieces,
c.sawingMethod,
ifnull(e.longScrapNumber, 0) longScrapNumber,
ifnull(e.longScrapWeight, 0) longScrapWeight,
ifnull(f.shortageScrapNumber, 0) shortageScrapNumber,
ifnull(f.shortageScrapWeight, 0) shortageScrapWeight,
ifnull(d.jiya_actualWeight, 0) jiya_actualWeight,
ifnull(d.jiya_productionNumber, 0) jiya_productionNumber,
ifnull(d.jiya_productionWeight, 0) jiya_productionWeight,
ifnull(d.jingpin_actualWeight, 0) jingpin_actualWeight,
ifnull(d.jingpin_productionNumber, 0) jingpin_productionNumber,
ifnull(d.jingpin_productionWeight, 0) jingpin_productionWeight,
ifnull(d.yanghau1_actualWeight, 0) yanghau1_actualWeight,
ifnull(d.yanghau1_productionNumber, 0) yanghau1_productionNumber,
ifnull(d.yanghau1_productionWeight, 0) yanghau1_productionWeight,
ifnull(d.yanghua2_actualWeight, 0) yanghua2_actualWeight,
ifnull(d.yanghua2_productionNumber, 0) yanghua2_productionNumber,
ifnull(d.yanghua2_productionWeight, 0) yanghua2_productionWeight,
ifnull(d.jingqie_actualWeight, 0) jingqie_actualWeight,
ifnull(d.jingqie_productionNumber, 0) jingqie_productionNumber,
ifnull(d.jingqie_productionWeight, 0) jingqie_productionWeight,
ifnull(d.dk_actualWeight, 0) dk_actualWeight,
ifnull(d.dk_productionNumber, 0) dk_productionNumber,
ifnull(d.dk_productionWeight, 0) dk_productionWeight,
ifnull(d.bz_actualWeight, 0) bz_actualWeight,
ifnull(d.bz_productionNumber, 0) bz_productionNumber,
ifnull(d.bz_productionWeight, 0) bz_productionWeight,
ifnull(g.receiptQuantity, 0) receiptQuantity,
ifnull(g.actualWeight, 0) actualWeight,
ifnull(h.shipmentQuantity, 0) shipmentQuantity,
ifnull(h.shipmentActualWeight, 0) shipmentActualWeight,
ifnull(h.noShipmentQuantity, 0) noShipmentQuantity,
ifnull(h.noActualWeight, 0) noActualWeight,
ifnull(h.existingInventory, 0) existingInventory,
ifnull(h.existingActualWeight, 0) existingActualWeight
from salesOrderList a
left join productionScheduleList b on a.salesOrderCode = b.salesOrderCode and a.orderNo = b.orderNo
left join extrusionScheduleDetail c on a.salesOrderCode = c.salesOrderCode and a.orderNo = c.orderNo
left join processReportFinalList d on a.salesOrderCode = d.salesOrderCode and a.orderNo = d.orderNo
left join processReportLongList e on a.salesOrderCode = e.salesOrderCode and a.orderNo = e.orderNo
left join processReportShortageList f on a.salesOrderCode = f.salesOrderCode and a.orderNo = f.orderNo
left join productReceiptList g on a.salesOrderCode = g.salesOrderCode and a.orderNo = g.orderNo
left join salesShipmenList h on a.salesOrderCode = h.salesOrderCode and a.orderNo = h.orderNo
return result

@ -0,0 +1,52 @@
{
"properties" : { },
"id" : "d96963a3d8d94fb2acb55a09d05266f9",
"script" : null,
"groupId" : "ac6602436d574b049dcf80eee3ff5d8d",
"name" : "订单跟踪总数",
"createTime" : null,
"updateTime" : 1732603321523,
"lock" : null,
"createBy" : null,
"updateBy" : null,
"path" : "/count",
"description" : null,
"returnType" : null,
"mappingPath" : null,
"parameters" : [ {
"name" : "body",
"value" : null,
"description" : null,
"required" : false,
"dataType" : "String",
"type" : "java.util.Map",
"defaultValue" : null,
"validateType" : null,
"error" : null,
"expression" : null,
"children" : null
} ]
}
================================
String salesOrderCode = body['salesOrderCode'];
String orderNo = body['orderNo'];
String materialCode = body['materialCode'];
String profileModel = body['profileModel'];
String customerId = body['customerId'];
String surfaceMethod = body['surfaceMethod'];
var sql = """
select
count(1)
from mini_sales_order_materials msom
left join mini_sales_orders mso on mso.document_number = msom.sales_order_code
where 1=1
?{orderNo != null and orderNo != '', and msom.order_no like concat('%', #{orderNo}, '%')}
?{materialCode != null and materialCode != '', and msom.material_code like concat('%', #{materialCode}, '%')}
?{profileModel != null and profileModel != '', and msom.profile_model like concat('%', #{profileModel}, '%')}
?{customerId != null and customerId != '', and mso.customer_id = #{customerId}}
?{surfaceMethod != null and surfaceMethod != '', and msom.surface_method = #{surfaceMethod}}
?{salesOrderCode != null and salesOrderCode != '', and msom.sales_order_code = #{salesOrderCode}}
"""
return db.selectInt(sql);
Loading…
Cancel
Save