|
|
|
|
@@ -13,6 +13,8 @@ import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.nl.exception.BadRequestException;
|
|
|
|
|
import org.nl.modules.security.service.dto.JwtUserDto;
|
|
|
|
|
import org.nl.modules.system.service.UserService;
|
|
|
|
|
import org.nl.modules.system.service.dto.UserDto;
|
|
|
|
|
import org.nl.modules.system.util.CodeUtil;
|
|
|
|
|
import org.nl.utils.SecurityUtils;
|
|
|
|
|
import org.nl.wms.basedata.master.service.ClassstandardService;
|
|
|
|
|
@@ -22,6 +24,7 @@ import org.nl.wms.mps.service.dto.ProduceshiftorderDto;
|
|
|
|
|
import org.nl.wql.WQL;
|
|
|
|
|
import org.nl.wql.core.bean.WQLObject;
|
|
|
|
|
import org.nl.wql.util.WqlUtil;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -42,6 +45,9 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
|
|
|
|
|
private final ClassstandardService classstandardService;
|
|
|
|
|
private final WmsToAcsService wmsToAcsService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
UserService userService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
|
|
|
|
String produceorder_code = MapUtil.getStr(whereJson, "produceorder_code");
|
|
|
|
|
@@ -83,7 +89,24 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
|
|
|
|
|
if (StrUtil.isNotEmpty(sale_id)) {
|
|
|
|
|
map.put("sale_id", "%" + sale_id + "%");
|
|
|
|
|
}
|
|
|
|
|
WQLObject wo = WQLObject.getWQLObject("mps_bd_macoperaterecord");
|
|
|
|
|
JSONObject jsonObject = WQL.getWO("MPS_PRODUCEDURE001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ShiftOrder.update_time desc");
|
|
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray("content");
|
|
|
|
|
for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
|
|
JSONObject arrayJSONObject = jsonArray.getJSONObject(i);
|
|
|
|
|
String produceorder_id = arrayJSONObject.getString("produceorder_id");
|
|
|
|
|
JSONArray resultJSONArray = wo.query("produceorder_id = '" + produceorder_id + "'", "operatetime_start desc").getResultJSONArray(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(resultJSONArray)){
|
|
|
|
|
JSONObject resultJSONArrayJSONObject = resultJSONArray.getJSONObject(0);
|
|
|
|
|
String jockey_id = resultJSONArrayJSONObject.getString("jockey_id");
|
|
|
|
|
UserDto user = userService.findById(Long.valueOf(jockey_id));
|
|
|
|
|
String nick_name = "";
|
|
|
|
|
if (ObjectUtil.isNotEmpty(user)){
|
|
|
|
|
nick_name = user.getNickName();
|
|
|
|
|
}
|
|
|
|
|
arrayJSONObject.put("jockey_name",nick_name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return jsonObject;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -118,28 +141,31 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void create(ProduceshiftorderDto dto) {
|
|
|
|
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
|
|
|
|
String nickName = SecurityUtils.getNickName();
|
|
|
|
|
String now = DateUtil.now();
|
|
|
|
|
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
|
|
|
|
|
Long deptId = currentUser.getDeptId();
|
|
|
|
|
String newCode = CodeUtil.getNewCode("PDM_SHIFTORDER");
|
|
|
|
|
dto.setProduce_date(dto.getProduce_date().substring(0,10));
|
|
|
|
|
dto.setProduceorder_id(IdUtil.getSnowflake(1, 1).nextId());
|
|
|
|
|
dto.setProduceorder_code(newCode);
|
|
|
|
|
dto.setProducedeviceorder_code(newCode);
|
|
|
|
|
dto.setOrder_status("00");
|
|
|
|
|
dto.setCreate_id(currentUserId);
|
|
|
|
|
dto.setCreate_name(nickName);
|
|
|
|
|
dto.setUpdate_optid(currentUserId);
|
|
|
|
|
dto.setUpdate_optname(nickName);
|
|
|
|
|
dto.setUpdate_time(now);
|
|
|
|
|
dto.setCreate_time(now);
|
|
|
|
|
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
|
|
|
|
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
|
|
|
|
json.put("sysdeptid", deptId);
|
|
|
|
|
json.put("syscompanyid", deptId);
|
|
|
|
|
wo.insert(json);
|
|
|
|
|
Integer orderNum = dto.getOrderNum();
|
|
|
|
|
for (Integer i = 0; i < orderNum; i++) {
|
|
|
|
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
|
|
|
|
String nickName = SecurityUtils.getNickName();
|
|
|
|
|
String now = DateUtil.now();
|
|
|
|
|
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
|
|
|
|
|
Long deptId = currentUser.getDeptId();
|
|
|
|
|
String newCode = CodeUtil.getNewCode("PDM_SHIFTORDER");
|
|
|
|
|
dto.setProduce_date(dto.getProduce_date().substring(0,10));
|
|
|
|
|
dto.setProduceorder_id(IdUtil.getSnowflake(1, 1).nextId());
|
|
|
|
|
dto.setProduceorder_code(newCode);
|
|
|
|
|
dto.setProducedeviceorder_code(newCode);
|
|
|
|
|
dto.setOrder_status("00");
|
|
|
|
|
dto.setCreate_id(currentUserId);
|
|
|
|
|
dto.setCreate_name(nickName);
|
|
|
|
|
dto.setUpdate_optid(currentUserId);
|
|
|
|
|
dto.setUpdate_optname(nickName);
|
|
|
|
|
dto.setUpdate_time(now);
|
|
|
|
|
dto.setCreate_time(now);
|
|
|
|
|
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
|
|
|
|
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
|
|
|
|
json.put("sysdeptid", deptId);
|
|
|
|
|
json.put("syscompanyid", deptId);
|
|
|
|
|
wo.insert(json);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|