Browse Source

工单信息导入更新

master
loujf 3 years ago
parent
commit
0db5d43168
  1. 85
      nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java
  2. 131
      nladmin-system/src/main/java/org/nl/acs/order/service/wql/QPRODUCESHIFTORDER02.wql

85
nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java

@ -5,25 +5,24 @@ import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device_driver.electric_fence.ElectricFenceDeviceDriver;
import org.nl.acs.device_driver.hailiang.hailiang_feeding_trunk.HaiLiangFeedingTrunkDeviceDriver; import org.nl.acs.device_driver.hailiang.hailiang_feeding_trunk.HaiLiangFeedingTrunkDeviceDriver;
import org.nl.acs.opc.Device; import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl; import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.opc.DeviceType; import org.nl.acs.opc.DeviceType;
import org.nl.acs.order.service.ProduceshiftorderService; import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.CustomerbaseDto;
import org.nl.acs.order.service.dto.ProduceshiftorderDto; import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.acs.order.service.dto.ProduceshiftorderdetailDto; import org.nl.acs.order.service.dto.ProduceshiftorderdetailDto;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.exception.BadRequestException; import org.nl.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil; import org.nl.modules.system.util.CodeUtil;
import org.nl.start.auto.initial.ApplicationAutoInitial; import org.nl.start.auto.initial.ApplicationAutoInitial;
import org.nl.utils.FileUtil;
import org.nl.utils.SecurityUtils; import org.nl.utils.SecurityUtils;
import org.nl.utils.SpringContextHolder; import org.nl.utils.SpringContextHolder;
import org.nl.wql.WQL; import org.nl.wql.WQL;
@ -32,18 +31,12 @@ import org.nl.wql.core.bean.WQLObject;
import org.nl.wql.util.WqlUtil; import org.nl.wql.util.WqlUtil;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @author wangs * @author wangs
@ -315,15 +308,83 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
wo.update(json); wo.update(json);
} }
@Override
public void device_pause() {
}
@Override @Override
public void download(List<ProduceshiftorderDto> dtos, HttpServletResponse response) throws IOException { public void clear() {
} }
@Override @Override
public void importExcel(String id) { public void order_pause(String id) {
}
@Override
public void order_force_complete(String id) {
}
@Override
public void detail_force_complete(String id) {
}
@Override
public void download(List<ProduceshiftorderDto> dtos, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (int i = 0; i < 1; i++) {
Map<String, Object> map = new LinkedHashMap<>();
ProduceshiftorderDto dto = dtos.get(i);
map.put("物料编码", "");
map.put("物料名称", "");
map.put("外径", "");
map.put("壁厚", "");
map.put("长度", "");
map.put("下料数量", "");
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
@Override
public void importExcel(String id) {
WQLObject orderTab = WQLObject.getWQLObject("acs_produceshiftorder");
JSONObject json = WQL.getWO("QPRODUCESHIFTORDER02").addParam("flag", "1").addParam("id", id).process().uniqueResult(0);
//根据路径获取表格里的记录
String path = json.getString("path");
List<Map<String, Object>> listMap = EasyExcel.read(path).sheet().doReadSync();
for (int i = 0; i < listMap.size(); i++) {
Map<String, Object> map = listMap.get(i);
String order_code = String.valueOf(map.get(0));
String order_status = String.valueOf(map.get(1));
String material_code = String.valueOf(map.get(2));
String material_name = String.valueOf(map.get(3));
String outer_diameter = String.valueOf(map.get(4));
String wall_thickness = String.valueOf(map.get(5));
String length = String.valueOf(map.get(6));
String qty = String.valueOf(map.get(7));
//月生产计划接口处理表数据
ProduceshiftorderDto dto = new ProduceshiftorderDto();
dto.setOrder_id(IdUtil.simpleUUID());
dto.setOrder_code(order_code);
dto.setOrder_status(order_status);
dto.setMaterial_uuid(IdUtil.simpleUUID());
dto.setMaterial_code(material_code);
dto.setMaterial_name(material_name);
dto.setOuter_diameter(outer_diameter);
dto.setWall_thickness(wall_thickness);
dto.setQty(qty);
dto.setLength(length);
orderTab.insert(JSONObject.parseObject(JSON.toJSONString(dto)));
}
} }
@Override @Override

131
nladmin-system/src/main/java/org/nl/acs/order/service/wql/QPRODUCESHIFTORDER02.wql

@ -0,0 +1,131 @@
[交易说明]
交易名: 月度计划分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.id TYPEAS s_string
输入.code TYPEAS s_string
输入.plan_org_code TYPEAS s_string
输入.weight_unit_name TYPEAS s_string
输入.product_type_name TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
QUERY
SELECT
*
FROM
tool_local_storage t
WHERE
t.storage_id = 输入.id
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT
*
FROM
sys_dept d
WHERE
d.code = 输入.code
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "3"
QUERY
SELECT
*
FROM
sys_dict_detail d
WHERE
d.name = 'product_mode'
OPTION 输入.product_type_name <> ""
d.label = 输入.product_type_name
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "4"
QUERY
SELECT
d.name AS label,
d.code AS value
FROM
sys_dept d
WHERE
d.code in(1001,1002,1003)
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "5"
QUERY
SELECT
*
FROM
md_pb_measureunit u
WHERE
u.is_delete = '0'
OPTION 输入.weight_unit_name <> ""
u.unit_name = 输入.weight_unit_name
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "6"
QUERY
SELECT
*
FROM
sys_dict_detail d
WHERE
d.name = 'product_mode'
OPTION 输入.product_type_name <> ""
d.value = 输入.product_type_name
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
Loading…
Cancel
Save