no message
parent
8fb698fce0
commit
38a3d0577b
|
|
@ -69,157 +69,6 @@ public class StudenController {
|
|||
|
||||
private final StudenService studenService;
|
||||
|
||||
//导入
|
||||
private final FileProperties properties;
|
||||
|
||||
|
||||
@PostMapping("/getOrderInfo")
|
||||
@Log("获取送货单信息")
|
||||
@ApiOperation("获取送货单信息")
|
||||
public ResponseEntity<Object> getOrderInfo(@RequestBody OrderInfo orderInfo){
|
||||
String resultJson = "";
|
||||
try {
|
||||
System.out.println("1111111");
|
||||
resultJson = studenService.getOrderJson(orderInfo);//获取送货单JSON
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
if (resultJson == null || resultJson.length() == 0) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "接口异常!", ""), HttpStatus.BAD_REQUEST);
|
||||
} else {
|
||||
try {
|
||||
|
||||
System.out.println("resultJson:"+resultJson);
|
||||
studenService.getOrderInfo(resultJson);//获取送货单
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", resultJson), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Log("导入点位")
|
||||
@PostMapping(value = "/import_studen")
|
||||
@ApiOperation("导入点位")
|
||||
@PreAuthorize("@el.check('studen:importStuden')")
|
||||
public ResponseEntity<Object> importPoint(@RequestParam("file") MultipartFile multipartFile) {
|
||||
|
||||
System.out.println("multipartFile:"+multipartFile);
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize());
|
||||
String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename());
|
||||
String type = FileUtil.getFileType(suffix);
|
||||
|
||||
File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator);
|
||||
|
||||
Dept dept = UserUtils.getDept();
|
||||
|
||||
System.out.println("dept:"+dept);
|
||||
|
||||
ExcelReader reader = ExcelUtil.getReader(file);
|
||||
int i = 0;
|
||||
int edit_len = 0;
|
||||
int new_len = 0;
|
||||
try {
|
||||
List<Map<String, Object>> readAll = reader.readAll();
|
||||
System.out.println("list:"+readAll);
|
||||
for (i = 0; i < readAll.size(); i++) {
|
||||
String code = readAll.get(i).get("代码").toString().trim();
|
||||
String name = readAll.get(i).get("名称").toString().trim();
|
||||
String enabled = readAll.get(i).get("是否启用").toString().trim();
|
||||
String creator = readAll.get(i).get("创建人").toString().trim();
|
||||
String modifier = readAll.get(i).get("修改人").toString().trim();
|
||||
Timestamp creationTime =Timestamp.valueOf(readAll.get(i).get("创建时间").toString().trim());
|
||||
Timestamp modificationTime =Timestamp.valueOf(readAll.get(i).get("修改时间").toString().trim());
|
||||
boolean flay = studenService.findBycode(code);
|
||||
System.out.println("flay"+flay);
|
||||
if(!flay){
|
||||
Studen stu = new Studen();
|
||||
stu.setCode(code);
|
||||
stu.setName(name);
|
||||
if (enabled.equals("true")) {
|
||||
stu.setEnabled(true);
|
||||
} else {
|
||||
stu.setEnabled(false);
|
||||
}
|
||||
stu.setCreator(creator);
|
||||
stu.setModifier(modifier);
|
||||
stu.setCreationTime(creationTime);
|
||||
stu.setModificationTime(modificationTime);
|
||||
studenService.create(stu);
|
||||
System.out.println("stu"+stu);
|
||||
new_len++;
|
||||
log.info("导入" + (i + 1) + "行");
|
||||
}else{
|
||||
log.info("第" + (i + 1) + "行已存在");
|
||||
edit_len++;
|
||||
new_len--;
|
||||
}
|
||||
|
||||
// if (area == null) {
|
||||
// ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(), "找不到库区" + areaCode);
|
||||
// return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
// }
|
||||
// Point point = pointService.getPoint(code, null, null, null);
|
||||
// if (point == null) {
|
||||
|
||||
// } else {
|
||||
// point.setCode(code);
|
||||
// point.setName(code);
|
||||
// String lx = "";
|
||||
// if (types.equals("缓存点")) {
|
||||
// lx = BaseStatus.STORAGE;
|
||||
//
|
||||
// } else if (types.equals("线边点位")) {
|
||||
// lx = BaseStatus.BOX;
|
||||
// }
|
||||
// point.setType(lx);
|
||||
// point.setArea(area);
|
||||
// point.setDept(dept);
|
||||
// point.setDescription(ccTYPE);
|
||||
// point.setPosX(x);
|
||||
// point.setPosY(y);
|
||||
// pointService.update(point);
|
||||
// edit_len++;
|
||||
// }
|
||||
|
||||
if(new_len<0){
|
||||
new_len=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
ApiError apiError = ApiError.errorJosn(HttpStatus.BAD_REQUEST.value(), "导入异常---第" + (i + 1) + "行:" + e.toString());
|
||||
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
}
|
||||
|
||||
|
||||
ApiError apiError = ApiError.errorJosn(HttpStatus.OK.value(), "导入成功:" + (i) + "行 新增(" + new_len + ")重复(" + edit_len + ")");
|
||||
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
|
|
@ -261,4 +110,4 @@ public class StudenController {
|
|||
studenService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,8 +88,4 @@ public interface StudenService {
|
|||
* @throws IOException /
|
||||
*/
|
||||
void download(List<StudenDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
String getOrderJson(OrderInfo orderInfo);
|
||||
|
||||
void getOrderInfo(String resultJson);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,153 +119,4 @@ public class StudenServiceImpl implements StudenService {
|
|||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOrderJson(OrderInfo orderInfo) {
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||
Map<String, Object> objMap = new LinkedHashMap<>();
|
||||
objMap.put("ifaceCode", orderInfo.getIfaceCode());//获取送货单信息
|
||||
objMap.put("sourceSystem", orderInfo.getSourceSystem());//来源系统
|
||||
objMap.put("params", orderInfo.getParams());
|
||||
jsonObject.putAll(objMap);
|
||||
return HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), this.getToKen());//返回ResponseJson*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getOrderInfo(String resultJson) {
|
||||
|
||||
if (StringUtils.isEmpty(resultJson)) {
|
||||
throw new RuntimeException("获取送货单接口失败!");
|
||||
}
|
||||
|
||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
||||
if (resulObject == null) {
|
||||
throw new RuntimeException("获取送货单接口返回数据为空!");
|
||||
}
|
||||
String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
||||
String msg = resulObject.getString("msg") == null ? "" : resulObject.getString("msg");
|
||||
//判断接口是否成功
|
||||
if (!"0".equals(code)) {
|
||||
throw new RuntimeException("获取送货单接口异常信息:" + msg);
|
||||
}
|
||||
|
||||
String data = resulObject.getString("data") == null ? "" : resulObject.getString("data");
|
||||
JSONObject dataObject = JSON.parseObject(data);
|
||||
if (dataObject == null) {
|
||||
throw new RuntimeException("获取送货单接口返回数据为空!");
|
||||
}
|
||||
JSONArray details = dataObject.getJSONArray("list");
|
||||
//判断是否有送货单数据
|
||||
if (details == null || details.size() == 0) {
|
||||
throw new RuntimeException("没有获取到送货单数据!");
|
||||
}
|
||||
|
||||
List<Order> ordersToCreate = new ArrayList<>();//新增订单集合
|
||||
List<Order> ordersToUpdate = new ArrayList<>();//更新订单集合
|
||||
//获取所有送货单条码号
|
||||
Set<String> barcodeNumbers = details.stream()
|
||||
.map(detail -> ((JSONObject) detail).getString("barcodeNumber"))
|
||||
.collect(Collectors.toSet());
|
||||
//获取已存在的订单
|
||||
Map<String, Order> existingOrders = orderService.findByBarcodeNumbers(barcodeNumbers);
|
||||
//循环处理每个送货单
|
||||
for (int i = 0; i < details.size(); i++) {
|
||||
JSONObject detail = details.getJSONObject(i);
|
||||
String barcodeNumber = detail.getString("barcodeNumber");
|
||||
//判断是否已存在订单
|
||||
if (existingOrders.containsKey(barcodeNumber)) {
|
||||
Order existingOrder = existingOrders.get(barcodeNumber);
|
||||
//更新订单信息
|
||||
ordersToUpdate.add(updateOrder(existingOrder, detail));
|
||||
} else {
|
||||
//新增订单
|
||||
ordersToCreate.add(createOrder(detail));
|
||||
}
|
||||
}
|
||||
//批量新增订单
|
||||
if (!ordersToCreate.isEmpty()) {
|
||||
orderService.batchCreateOrders(ordersToCreate);
|
||||
}
|
||||
//批量更新订单
|
||||
if (!ordersToUpdate.isEmpty()) {
|
||||
orderService.batchUpdateOrders(ordersToUpdate);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Order createOrder(JSONObject detail) {
|
||||
|
||||
String barcodeNumber = detail.getString("barcodeNumber");//送货单条码号
|
||||
String isCreatedLabel = detail.getString("isCreatedLabel");//是否已生成标签N
|
||||
String itemCode = detail.getString("itemCode");//物料编码
|
||||
String iqcResult = detail.getString("iqcResult");//检验结果(不合格:REJECT,合格:ACCEPT)
|
||||
String supplierCode = detail.getString("supplierCode");//供应商编码
|
||||
//String dispatchNumber=detail.getString("dispatchNumber");//文档没有该字段
|
||||
String receivedLocationName = detail.getString("receivedLocationName");//LMES货位名称
|
||||
String receivedInvCode = detail.getString("receivedInvCode");//LMES接收子库编码
|
||||
//Integer deliveryNotifyLineId = detail.getInteger("deliveryNotifyLineId");//送货通知单行ID
|
||||
String deliveryNumber = detail.getString("deliveryNumber");//送货单号
|
||||
String receivedAreaCode = detail.getString("receivedAreaCode");//LMES接收货区编码
|
||||
String supplierName = detail.getString("supplierName");//供应商名称
|
||||
String isIqcInspected = detail.getString("isIqcInspected");//Y-已检验N-未检验
|
||||
Double deliveryQty = detail.getDouble("deliveryQty") == null ? 0 : detail.getDouble("deliveryQty");//计划数量
|
||||
//String deliveryType=detail.getString("deliveryType");//文档没有该字段
|
||||
String receivedLocationCode = detail.getString("receivedLocationCode");//LMES货位编码
|
||||
String mlsUpdateTime = detail.getString("updateTime");//更新时间
|
||||
String receivedInvName = detail.getString("receivedInvName");//LMES接收子库名称
|
||||
Double receivedQty = detail.getDouble("receivedQty") == null ? 0 : detail.getDouble("receivedQty");//实际接收数量
|
||||
//Integer deliveryLineId = detail.getInteger("deliveryLineId");//送货单行ID
|
||||
String inInspector = detail.getString("inInspector");//检验员
|
||||
Integer deliveryHeaderId = detail.getInteger("deliveryHeaderId");//送货单头ID和003接口关联
|
||||
String receivedAreaName = detail.getString("receivedAreaName");//mls接收货区名称
|
||||
String deliveryStatus = detail.getString("deliveryStatus");//送货单状态
|
||||
|
||||
//创建
|
||||
Order newOrder = new Order(deliveryHeaderId, null, null,
|
||||
deliveryNumber, barcodeNumber, deliveryStatus, receivedInvCode, receivedInvName,
|
||||
receivedAreaCode, receivedAreaName, receivedLocationCode, receivedLocationName,
|
||||
itemCode, deliveryQty, inInspector, receivedQty, isIqcInspected, iqcResult, isCreatedLabel,
|
||||
supplierCode, supplierName, mlsUpdateTime == null ? null : DateUtil.parse(mlsUpdateTime).toTimestamp()
|
||||
);
|
||||
|
||||
return newOrder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Order updateOrder(Order order, JSONObject detail) {
|
||||
order.setReceivedQty(detail.getDouble("receivedQty") == null ? 0 : detail.getDouble("receivedQty"));
|
||||
order.setDeliveryStatus(detail.getString("deliveryStatus"));
|
||||
order.setMlsUpdateTime(detail.getString("updateTime") == null ? null : DateUtil.parse(detail.getString("updateTime")).toTimestamp());
|
||||
return order;
|
||||
}
|
||||
|
||||
public String getToKen() {
|
||||
String toKen = "";
|
||||
String mlsUser = "WMS";
|
||||
String mlsPwd = "EDlsFOvn3xaJm*EH";
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||
Map<String, Object> objMap = new LinkedHashMap<>();
|
||||
objMap.put("mlsUser", mlsUser);//快码代码
|
||||
objMap.put("mlsPwd", mlsPwd);//快码值
|
||||
jsonObject.putAll(objMap);
|
||||
String resultJson = HttpPostUtil.sendPostReq(UrlApi.extSignIn, jsonObject.toString());//返回ResponseJson*/
|
||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
||||
//判断接口是否成功
|
||||
if (resulObject == null) {
|
||||
throw new RuntimeException("获取toKen接口返回数据为空!");
|
||||
}
|
||||
|
||||
String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
||||
String msg = resulObject.getString("msg") == null ? "" : resulObject.getString("msg");
|
||||
|
||||
if ("0".equals(code)) {
|
||||
toKen = resulObject.getString("data") == null ? "" : resulObject.getString("data");
|
||||
return toKen;
|
||||
} else {
|
||||
throw new RuntimeException("MLS异常信息:" + msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@ public class KMReSController {
|
|||
}
|
||||
|
||||
agvTaskService.agvTaskCallback(agvTask, task, missionStatus);
|
||||
returnMo(task.getBillCode()); // 回传 MO 信息
|
||||
returnMo(task.getBillCode());// 回传MO信息
|
||||
|
||||
}
|
||||
|
||||
private void pickTask(String id, String containerCode, String missionStatus) throws Exception {
|
||||
|
|
@ -102,14 +103,13 @@ public class KMReSController {
|
|||
cancelAgvTasks(id);
|
||||
} else {
|
||||
AgvTask agvTask = agvTaskService.findByjobCode(id, containerCode);
|
||||
agvTaskService.agvTaskCallback(agvTask, missionStatus, containerCode);
|
||||
Task task = getFirstTask(agvTask.getId());
|
||||
|
||||
if (task == null) {
|
||||
throw new RuntimeException("任务不存在!");
|
||||
}
|
||||
|
||||
returnIssue(task); // 叫料结果回传
|
||||
returnIssue(task);// 叫料结果回传
|
||||
agvTaskService.agvTaskCallback(agvTask, missionStatus, containerCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,14 @@ import com.youchain.basicdata.repository.StockRepository;
|
|||
import com.youchain.basicdata.service.PointService;
|
||||
import com.youchain.basicdata.service.impl.BoxServiceImpl;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.inputJson.ReturnIssueInfo;
|
||||
import com.youchain.businessdata.inputJson.ReturnIssueInfoParams;
|
||||
import com.youchain.businessdata.inputJson.ReturnMoInfo;
|
||||
import com.youchain.businessdata.inputJson.ReturnMoParams;
|
||||
import com.youchain.businessdata.repository.AsnDetailRepository;
|
||||
import com.youchain.businessdata.repository.TaskRepository;
|
||||
import com.youchain.businessdata.service.*;
|
||||
import com.youchain.businessdata.service.dto.OrderDto;
|
||||
import com.youchain.modules.quartz.utils.TimeNumberUtils;
|
||||
import com.youchain.modules.system.service.DictService;
|
||||
import com.youchain.service.LogService;
|
||||
|
|
@ -43,6 +48,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
|
|
@ -71,12 +77,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
private final TaskService taskService;
|
||||
private final PointService pointService;
|
||||
private final AsnDetailRepository asnDetailRepository;
|
||||
private final StockRepository stockRepository;
|
||||
private final DictService dictService;
|
||||
private final EntityManager entityMapper;
|
||||
private final OrderService orderService;
|
||||
private final LogService logService;
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(AgvTaskQueryCriteria criteria, Pageable pageable) {
|
||||
|
|
@ -388,6 +389,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
inventory.setQuantity(task.getPlanQty());
|
||||
inventoryService.update(inventory);
|
||||
inventoryLogService.storeInventoryLog(BizStatus.RECEIVING_UP, BizStatus.ADD, null, task.getItemKey(), task.getSrcPoint(), task.getDstPoint(), task.getSrcStock(), task.getSrcStock(), task.getPlanQty(), task.getPlanQty(), BizStatus.ASN, ad.getId(), inventory.getId(), ad.getRemark());
|
||||
|
||||
}
|
||||
//任务完成
|
||||
agvTask.setStatus(BizStatus.FINISH);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ spring:
|
|||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: dev
|
||||
active: prod
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
|
|
@ -31,9 +31,10 @@ spring:
|
|||
#数据库索引
|
||||
database: ${REDIS_DB:0}
|
||||
host: ${REDIS_HOST:115.159.67.99}
|
||||
port: ${REDIS_PORT:6379}
|
||||
#password: ${REDIS_PWD:}
|
||||
password: ${REDIS_PWD:123456}
|
||||
#host: ${REDIS_HOST:127.0.0.1}
|
||||
#password: ${REDIS_PWD:}
|
||||
port: ${REDIS_PORT:6379}
|
||||
#连接超时时间
|
||||
timeout: 5000
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue