fix:工单同步相关逻辑
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package org.nl.common.aspect;
|
package org.nl.common.aspect;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
import org.aspectj.lang.annotation.Around;
|
import org.aspectj.lang.annotation.Around;
|
||||||
@@ -12,9 +14,12 @@ import org.nl.wms.system_manage.mock.service.dao.MockConfig;
|
|||||||
import org.springframework.aop.support.AopUtils;
|
import org.springframework.aop.support.AopUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.annotation.AnnotationUtils;
|
import org.springframework.core.annotation.AnnotationUtils;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
@Aspect
|
@Aspect
|
||||||
@@ -60,6 +65,27 @@ public class MockAspect {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Type genericReturnType = method.getGenericReturnType();
|
Type genericReturnType = method.getGenericReturnType();
|
||||||
|
if (returnType == ResponseEntity.class) {
|
||||||
|
// 先解析成 JSONObject
|
||||||
|
JSONObject jsonObject = JSON.parseObject(responseData);
|
||||||
|
Integer statusCode = jsonObject.getInteger("status");
|
||||||
|
Object body = jsonObject.get("body");
|
||||||
|
|
||||||
|
// 获取 ResponseEntity 的泛型参数(body 的类型)
|
||||||
|
Type bodyType = null;
|
||||||
|
if (genericReturnType instanceof ParameterizedType) {
|
||||||
|
ParameterizedType pt = (ParameterizedType) genericReturnType;
|
||||||
|
Type[] actualTypeArgs = pt.getActualTypeArguments();
|
||||||
|
if (actualTypeArgs.length > 0) {
|
||||||
|
bodyType = actualTypeArgs[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 解析 body
|
||||||
|
Object parsedBody = bodyType != null && body != null
|
||||||
|
? JSON.parseObject(body.toString(), bodyType)
|
||||||
|
: body;
|
||||||
|
return new ResponseEntity<>(parsedBody, HttpStatus.valueOf(statusCode));
|
||||||
|
}
|
||||||
return JSON.parseObject(responseData, genericReturnType);
|
return JSON.parseObject(responseData, genericReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.wms.basedata_manage.service;
|
package org.nl.wms.basedata_manage.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
@@ -59,8 +60,8 @@ public interface ISectattrService extends IService<Sectattr> {
|
|||||||
*/
|
*/
|
||||||
void deleteAll(String[] ids);
|
void deleteAll(String[] ids);
|
||||||
|
|
||||||
JSONObject getSect(Map whereJson);
|
JSONArray getSect(Map whereJson);
|
||||||
JSONObject getSectCode(Map whereJson);
|
JSONArray getSectCode(Map whereJson);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 改变启用状态
|
* 改变启用状态
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject getSect(Map whereJson) {
|
public JSONArray getSect(Map whereJson) {
|
||||||
JSONArray new_ja = new JSONArray();
|
JSONArray new_ja = new JSONArray();
|
||||||
|
|
||||||
String is_materialstore = (String) whereJson.get("is_materialstore");
|
String is_materialstore = (String) whereJson.get("is_materialstore");
|
||||||
@@ -215,16 +215,13 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
|||||||
}
|
}
|
||||||
new_ja.add(stor_cas);
|
new_ja.add(stor_cas);
|
||||||
}
|
}
|
||||||
JSONObject jo = new JSONObject();
|
return new_ja;
|
||||||
jo.put("content", new_ja);
|
|
||||||
return jo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject getSectCode(Map whereJson) {
|
public JSONArray getSectCode(Map whereJson) {
|
||||||
JSONArray new_ja = new JSONArray();
|
JSONArray new_ja = new JSONArray();
|
||||||
|
|
||||||
String is_materialstore = (String) whereJson.get("is_materialstore");
|
String is_materialstore = (String) whereJson.get("is_materialstore");
|
||||||
String is_virtualstore = (String) whereJson.get("is_virtualstore");
|
String is_virtualstore = (String) whereJson.get("is_virtualstore");
|
||||||
String is_semi_finished = (String) whereJson.get("is_semi_finished");
|
String is_semi_finished = (String) whereJson.get("is_semi_finished");
|
||||||
@@ -275,9 +272,7 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
|||||||
}
|
}
|
||||||
new_ja.add(stor_cas);
|
new_ja.add(stor_cas);
|
||||||
}
|
}
|
||||||
JSONObject jo = new JSONObject();
|
return new_ja;
|
||||||
jo.put("content", new_ja);
|
|
||||||
return jo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,15 +2,20 @@ package org.nl.wms.ext_manage.api;
|
|||||||
|
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.common.annotation.Mock;
|
||||||
import org.nl.common.exception.BadRequestException;
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.config.SpringContextHolder;
|
import org.nl.config.SpringContextHolder;
|
||||||
import org.nl.wms.ext_manage.enums.EXTConstant;
|
import org.nl.wms.ext_manage.enums.EXTConstant;
|
||||||
|
import org.nl.wms.ext_manage.mes.service.MesResponse;
|
||||||
|
import org.nl.wms.ext_manage.mes.service.dto.WorkOrderBomItem;
|
||||||
import org.nl.wms.ext_manage.util.AcsUtil;
|
import org.nl.wms.ext_manage.util.AcsUtil;
|
||||||
import org.nl.wms.pm_manage.demand.service.dao.PmDemand;
|
import org.nl.wms.pm_manage.demand.service.dao.PmDemand;
|
||||||
import org.nl.wms.system_manage.enums.SysParamConstant;
|
import org.nl.wms.system_manage.enums.SysParamConstant;
|
||||||
|
import org.nl.wms.system_manage.service.param.dao.Param;
|
||||||
import org.nl.wms.system_manage.service.param.impl.SysParamServiceImpl;
|
import org.nl.wms.system_manage.service.param.impl.SysParamServiceImpl;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;import org.nl.common.base.ResponseData;
|
import org.springframework.http.ResponseEntity;import org.nl.common.base.ResponseData;
|
||||||
@@ -54,11 +59,40 @@ public class MesApi {
|
|||||||
Integer respCode = result.getInteger("ResultCode");
|
Integer respCode = result.getInteger("ResultCode");
|
||||||
log.info("pmDemandCallback需求单回传参数:-------------------" + result.toString());
|
log.info("pmDemandCallback需求单回传参数:-------------------" + result.toString());
|
||||||
if (respCode == null || respCode != 0) {
|
if (respCode == null || respCode != 0) {
|
||||||
throw new BadRequestException("中鼎单据下推失败:" + result.getString("Message"));
|
throw new BadRequestException("MES单据下推失败:" + result.getString("Message"));
|
||||||
}
|
}
|
||||||
return ResponseData.build(result, HttpStatus.OK);
|
return new ResponseEntity(result, HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BadRequestException("中鼎单据下推失败:" + e.getMessage());
|
throw new BadRequestException("MES单据下推失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Mock(desc = "工单bom清单接口",enable = true)
|
||||||
|
public List<WorkOrderBomItem> workOrderMaterialList(String srcBillNo){
|
||||||
|
final Param param = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.MES_URL_BOM);
|
||||||
|
if (param ==null){
|
||||||
|
throw new BadRequestException("请传MES失败,未配置MES_URL地址");
|
||||||
|
}
|
||||||
|
String url = param.getValue();
|
||||||
|
try {
|
||||||
|
JSONObject requestParam = new JSONObject();
|
||||||
|
requestParam.put("orderCode",srcBillNo);
|
||||||
|
String resultMsg = HttpRequest.post(url)
|
||||||
|
.body(requestParam.toJSONString())
|
||||||
|
.execute().body();
|
||||||
|
JSONObject result = JSONObject.parseObject(resultMsg);
|
||||||
|
Integer respCode = result.getInteger("ResultCode");
|
||||||
|
if (respCode == null || respCode != 0) {
|
||||||
|
throw new BadRequestException("请传MES失败:" + result.getString("Message"));
|
||||||
|
}
|
||||||
|
final JSONArray jsonArray = result.getJSONArray("Result");
|
||||||
|
final List<WorkOrderBomItem> bomItems = jsonArray.toJavaList(WorkOrderBomItem.class);
|
||||||
|
result.put("Result",bomItems);
|
||||||
|
MesResponse<List<WorkOrderBomItem>> response = result.toJavaObject(MesResponse.class);
|
||||||
|
return response.getResult();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new BadRequestException("中鼎需求单下发失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package org.nl.wms.ext_manage.api.query;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MesInventoryQuery {
|
||||||
|
private String skuCode;
|
||||||
|
private List<String> houseCodeList;
|
||||||
|
// {
|
||||||
|
// "HouseCodeList":["6.001","6.002"],
|
||||||
|
// "SkuCode":"1234567"
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -2,9 +2,14 @@ package org.nl.wms.ext_manage.controller;
|
|||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaIgnore;
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.nl.common.base.ResponseData;
|
import org.nl.common.base.ResponseData;
|
||||||
import org.nl.common.exception.BadRequestException;
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.common.logging.annotation.Log;
|
import org.nl.common.logging.annotation.Log;
|
||||||
|
import org.nl.common.utils.MapOf;
|
||||||
|
import org.nl.wms.ext_manage.api.query.MesInventoryQuery;
|
||||||
|
import org.nl.wms.ext_manage.mes.mq.producer.WorkReportProducer;
|
||||||
|
import org.nl.wms.ext_manage.mes.service.dto.WorkReportParam;
|
||||||
import org.nl.wms.ext_manage.service.MesToWmsService;
|
import org.nl.wms.ext_manage.service.MesToWmsService;
|
||||||
import org.nl.wms.ext_manage.service.dto.MesTaskParams;
|
import org.nl.wms.ext_manage.service.dto.MesTaskParams;
|
||||||
import org.nl.wms.pm_manage.demand.service.IPmDemandService;
|
import org.nl.wms.pm_manage.demand.service.IPmDemandService;
|
||||||
@@ -12,6 +17,9 @@ import org.nl.wms.pm_manage.demand.service.dto.PmDemandParam;
|
|||||||
import org.nl.wms.pm_manage.pmreturn.service.IPmReturnService;
|
import org.nl.wms.pm_manage.pmreturn.service.IPmReturnService;
|
||||||
import org.nl.wms.pm_manage.pmreturn.service.dao.PmReturn;
|
import org.nl.wms.pm_manage.pmreturn.service.dao.PmReturn;
|
||||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnParam;
|
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnParam;
|
||||||
|
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
|
||||||
|
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryDto;
|
||||||
|
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryQuery;
|
||||||
import org.nl.wms.welding_manage.service.work_order.IWorkOrderService;
|
import org.nl.wms.welding_manage.service.work_order.IWorkOrderService;
|
||||||
import org.nl.wms.welding_manage.service.work_order.dto.WorkOrderDto;
|
import org.nl.wms.welding_manage.service.work_order.dto.WorkOrderDto;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -24,6 +32,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -43,6 +52,12 @@ public class MesToWmsController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IPmDemandService iPmDemandService;
|
private IPmDemandService iPmDemandService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStInventoryService iStInventoryService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WorkReportProducer workReportProducer;
|
||||||
|
|
||||||
@PostMapping("api/mes/lineLackMat")
|
@PostMapping("api/mes/lineLackMat")
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
public ResponseEntity task(@Valid @RequestBody MesTaskParams mesTaskParams){
|
public ResponseEntity task(@Valid @RequestBody MesTaskParams mesTaskParams){
|
||||||
@@ -57,6 +72,7 @@ public class MesToWmsController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("api/mes/subWorkOrder")
|
@PostMapping("api/mes/subWorkOrder")
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
|
@Log("工单同步")
|
||||||
public ResponseEntity subWorkOrder(@RequestBody List<WorkOrderDto.WorkOrderDataDto> dtos){
|
public ResponseEntity subWorkOrder(@RequestBody List<WorkOrderDto.WorkOrderDataDto> dtos){
|
||||||
for (WorkOrderDto.WorkOrderDataDto dto : dtos) {
|
for (WorkOrderDto.WorkOrderDataDto dto : dtos) {
|
||||||
iWorkOrderService.insert(dto);
|
iWorkOrderService.insert(dto);
|
||||||
@@ -66,6 +82,7 @@ public class MesToWmsController {
|
|||||||
|
|
||||||
@PostMapping("app/restful/api/v3/wms/mesRequisitionSync")
|
@PostMapping("app/restful/api/v3/wms/mesRequisitionSync")
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
|
@Log("需求单同步`")
|
||||||
public ResponseEntity mesRequisitionSync(@RequestBody List<PmDemandParam> params) {
|
public ResponseEntity mesRequisitionSync(@RequestBody List<PmDemandParam> params) {
|
||||||
iPmDemandService.batchCreate(params);
|
iPmDemandService.batchCreate(params);
|
||||||
return ResponseData.build();
|
return ResponseData.build();
|
||||||
@@ -90,4 +107,35 @@ public class MesToWmsController {
|
|||||||
}
|
}
|
||||||
return ResponseData.build();
|
return ResponseData.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存查询接口
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("app/restful/api/v3/wms/getInventoryList")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> getInventoryList( @RequestBody MesInventoryQuery param) {
|
||||||
|
if (StringUtils.isEmpty(param.getSkuCode())){
|
||||||
|
throw new BadRequestException("查询失败,物料编码不能为空");
|
||||||
|
}
|
||||||
|
StInventoryQuery query = new StInventoryQuery();
|
||||||
|
query.setSectCode(param.getHouseCodeList());
|
||||||
|
query.setMaterialCode(param.getSkuCode());
|
||||||
|
final List<StInventoryDto> stInventoryDtos = iStInventoryService.queryInventory(query);
|
||||||
|
List result = new ArrayList<>();
|
||||||
|
stInventoryDtos.forEach(a->{
|
||||||
|
result.add(MapOf.of("houseCode",a.getSectcode(),"skuCode",a.getMaterialCode(),"qty",a.getQty(),"batchNo",a.getPcsn()));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return ResponseData.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("app/restful/api/v3/wms/deductionOrderSync")
|
||||||
|
@Log("MES发起报功")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> deductionOrderSync(@RequestBody WorkReportParam workReportParam) {
|
||||||
|
// 2. 发送到MQ(立即返回)
|
||||||
|
workReportProducer.send(workReportParam);
|
||||||
|
return ResponseData.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,85 +0,0 @@
|
|||||||
package org.nl.wms.ext_manage.mes.controller;
|
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaIgnore;
|
|
||||||
import org.nl.common.base.ResponseData;
|
|
||||||
import org.nl.common.logging.annotation.Log;
|
|
||||||
import org.nl.wms.ext_manage.mes.mq.producer.WorkReportProducer;
|
|
||||||
import org.nl.wms.ext_manage.mes.service.dto.WorkReportParam;
|
|
||||||
import org.nl.wms.pm_manage.demand.service.IPmDemandService;
|
|
||||||
import org.nl.wms.pm_manage.demand.service.dto.DemandInventryDto;
|
|
||||||
import org.nl.wms.pm_manage.demand.service.dto.PmDemandDto;
|
|
||||||
import org.nl.wms.pm_manage.demand.service.dto.PmDemandParam;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;import org.nl.common.base.ResponseData;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/mes")
|
|
||||||
@SaIgnore
|
|
||||||
public class MesController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IPmDemandService pmDemandService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WorkReportProducer workReportProducer;
|
|
||||||
|
|
||||||
@PostMapping("/report")
|
|
||||||
@Log("报工回传")
|
|
||||||
public ResponseEntity<Object> report(@RequestBody WorkReportParam workReportParam) {
|
|
||||||
// 2. 发送到MQ(立即返回)
|
|
||||||
workReportProducer.send(workReportParam);
|
|
||||||
return ResponseData.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping
|
|
||||||
@Log("新增需求单")
|
|
||||||
public ResponseEntity<Object> create(@Valid @RequestBody PmDemandParam param) {
|
|
||||||
pmDemandService.create(param);
|
|
||||||
return ResponseData.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping
|
|
||||||
@Log("修改需求单")
|
|
||||||
public ResponseEntity<Object> update(@Valid @RequestBody PmDemandDto param) {
|
|
||||||
pmDemandService.update(param);
|
|
||||||
return ResponseData.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping
|
|
||||||
@Log("删除需求单")
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
|
||||||
List<String> idList = Arrays.asList(ids);
|
|
||||||
pmDemandService.deleteByIds(idList);
|
|
||||||
return ResponseData.build();
|
|
||||||
}
|
|
||||||
@GetMapping("/queryInventory")
|
|
||||||
@Log("根据需求单查询所有库存信息")
|
|
||||||
public ResponseEntity<List<DemandInventryDto>> queryInventory(String skuCode) {
|
|
||||||
return ResponseData.build(pmDemandService.queryInventory(skuCode), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/allocate")
|
|
||||||
@Log("库存分配")
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public ResponseEntity<Object> allocateInventory(@RequestBody PmDemandDto demand) {
|
|
||||||
pmDemandService.allocateInventory(demand.getId(), demand.getInventoryDis());
|
|
||||||
return ResponseData.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/push")
|
|
||||||
@Log("需求单下发")
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public ResponseEntity<Object> push(@RequestBody List<PmDemandDto> pmDemandDtos) {
|
|
||||||
pmDemandService.pushDemand(pmDemandDtos);
|
|
||||||
return ResponseData.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package org.nl.wms.ext_manage.mes.mq.consumer;
|
package org.nl.wms.ext_manage.mes.mq.consumer;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.rabbitmq.client.Channel;
|
import com.rabbitmq.client.Channel;
|
||||||
import org.nl.wms.ext_manage.mes.service.MesApiService;
|
import org.nl.wms.ext_manage.mes.service.MesReportService;
|
||||||
import org.nl.wms.ext_manage.mes.service.dto.WorkReportParam;
|
import org.nl.wms.ext_manage.mes.service.dto.WorkReportParam;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
||||||
import org.springframework.amqp.support.AmqpHeaders;
|
import org.springframework.amqp.support.AmqpHeaders;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.messaging.handler.annotation.Header;
|
import org.springframework.messaging.handler.annotation.Header;
|
||||||
@@ -14,12 +14,12 @@ import org.springframework.stereotype.Component;
|
|||||||
public class WorkReportConsumer {
|
public class WorkReportConsumer {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
MesApiService mesApiService;
|
MesReportService mesReportService;
|
||||||
|
|
||||||
@RabbitListener(queues = "Mes.workReport.Queue")
|
@RabbitListener(queues = "Mes.workReport.Queue")
|
||||||
public void consume(WorkReportParam param, Channel channel,
|
public void consume(String param, Channel channel,
|
||||||
@Header(AmqpHeaders.DELIVERY_TAG) long tag) {
|
@Header(AmqpHeaders.DELIVERY_TAG) long tag) {
|
||||||
System.out.println("======WorkReportConsumer======"+tag);
|
System.out.println("======WorkReportConsumer======"+tag);
|
||||||
mesApiService.workReportReturn(param);
|
mesReportService.workReportReturn(JSONObject.parseObject(param,WorkReportParam.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package org.nl.wms.ext_manage.mes.mq.producer;
|
package org.nl.wms.ext_manage.mes.mq.producer;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.nl.wms.ext_manage.mes.service.dto.WorkReportParam;
|
import org.nl.wms.ext_manage.mes.service.dto.WorkReportParam;
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -11,6 +13,6 @@ public class WorkReportProducer {
|
|||||||
private RabbitTemplate rabbitTemplate;
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
public void send(WorkReportParam param) {
|
public void send(WorkReportParam param) {
|
||||||
rabbitTemplate.convertAndSend("Mes", "workReport", param);
|
rabbitTemplate.convertAndSend("Mes", "workReport", JSON.toJSONString(param));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
package org.nl.wms.ext_manage.mes.service;
|
|
||||||
|
|
||||||
import org.nl.wms.ext_manage.mes.service.dto.WorkOrderBomItem;
|
|
||||||
import org.nl.wms.ext_manage.mes.service.dto.WorkReportParam;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface MesApiService {
|
|
||||||
|
|
||||||
List<WorkOrderBomItem> workOrderMaterialList(String workOrder);
|
|
||||||
|
|
||||||
void workReportReturn(WorkReportParam workReportParam);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package org.nl.wms.ext_manage.mes.service;
|
||||||
|
|
||||||
|
import org.nl.wms.ext_manage.mes.service.dto.WorkReportParam;
|
||||||
|
|
||||||
|
public interface MesReportService {
|
||||||
|
|
||||||
|
void workReportReturn(WorkReportParam workReportParam);
|
||||||
|
}
|
||||||
@@ -12,107 +12,89 @@ public class WorkReportParam implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* ID
|
* ID
|
||||||
*/
|
*/
|
||||||
@JsonProperty("Id")
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工单编码
|
* 工单编码
|
||||||
*/
|
*/
|
||||||
@JsonProperty("WorkOrderCode")
|
|
||||||
private String workOrderCode;
|
private String workOrderCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跟踪号/班组
|
* 跟踪号/班组
|
||||||
*/
|
*/
|
||||||
@JsonProperty("TrackNo")
|
|
||||||
private String trackNo;
|
private String trackNo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车间
|
* 车间
|
||||||
*/
|
*/
|
||||||
@JsonProperty("Workshop")
|
|
||||||
private String workshop;
|
private String workshop;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工作区域
|
* 工作区域
|
||||||
*/
|
*/
|
||||||
@JsonProperty("WorkArea")
|
|
||||||
private String workArea;
|
private String workArea;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 序列号/控制码
|
* 序列号/控制码
|
||||||
*/
|
*/
|
||||||
@JsonProperty("Sn")
|
|
||||||
private String sn;
|
private String sn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报工数量
|
* 报工数量
|
||||||
*/
|
*/
|
||||||
@JsonProperty("ReportedQty")
|
|
||||||
private BigDecimal reportedQty;
|
private BigDecimal reportedQty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态码
|
* 状态码
|
||||||
*/
|
*/
|
||||||
@JsonProperty("StatusCode")
|
|
||||||
private String statusCode;
|
private String statusCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求时间
|
* 请求时间
|
||||||
*/
|
*/
|
||||||
@JsonProperty("RequestTime")
|
|
||||||
private String requestTime;
|
private String requestTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
@JsonProperty("CreatedBy")
|
|
||||||
private String createdBy;
|
private String createdBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@JsonProperty("CreatedOn")
|
|
||||||
private String createdOn;
|
private String createdOn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单编码
|
* 订单编码
|
||||||
*/
|
*/
|
||||||
@JsonProperty("OrderCode")
|
|
||||||
private String orderCode;
|
private String orderCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组织编号
|
* 组织编号
|
||||||
*/
|
*/
|
||||||
@JsonProperty("OrgNo")
|
|
||||||
private String orgNo;
|
private String orgNo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门编号
|
* 部门编号
|
||||||
*/
|
*/
|
||||||
@JsonProperty("DeptNo")
|
|
||||||
private String deptNo;
|
private String deptNo;
|
||||||
/**
|
/**
|
||||||
* 业务时间
|
* 业务时间
|
||||||
*/
|
*/
|
||||||
@JsonProperty("BizTime")
|
|
||||||
private String bizTime;
|
private String bizTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 源单据编号
|
* 源单据编号
|
||||||
*/
|
*/
|
||||||
@JsonProperty("SrcBillNo")
|
|
||||||
private String srcBillNo;
|
private String srcBillNo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 源单据ID
|
* 源单据ID
|
||||||
*/
|
*/
|
||||||
@JsonProperty("SrcBillId")
|
|
||||||
private String srcBillId;
|
private String srcBillId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 响应方
|
* 响应方
|
||||||
*/
|
*/
|
||||||
@JsonProperty("ResponseBy")
|
|
||||||
private String responseBy;
|
private String responseBy;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,93 +0,0 @@
|
|||||||
package org.nl.wms.ext_manage.mes.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.http.HttpRequest;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.nl.common.annotation.Mock;
|
|
||||||
import org.nl.common.exception.BadRequestException;
|
|
||||||
import org.nl.config.SpringContextHolder;
|
|
||||||
import org.nl.wms.basedata_manage.service.ISectattrService;
|
|
||||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
|
||||||
import org.nl.wms.basedata_manage.service.dao.Sectattr;
|
|
||||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
|
||||||
import org.nl.wms.ext_manage.mes.service.MesApiService;
|
|
||||||
import org.nl.wms.ext_manage.mes.service.MesResponse;
|
|
||||||
import org.nl.wms.ext_manage.mes.service.dto.WorkOrderBomItem;
|
|
||||||
import org.nl.wms.ext_manage.mes.service.dto.WorkReportParam;
|
|
||||||
import org.nl.wms.pda_manage.ios_manage.service.PdaIosOutService;
|
|
||||||
import org.nl.wms.pda_manage.outBound.dto.LineSideDto;
|
|
||||||
import org.nl.wms.system_manage.enums.SysParamConstant;
|
|
||||||
import org.nl.wms.system_manage.service.param.dao.Param;
|
|
||||||
import org.nl.wms.system_manage.service.param.impl.SysParamServiceImpl;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class MesApiServiceImpl implements MesApiService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PdaIosOutService pdaIosOutService;
|
|
||||||
@Autowired
|
|
||||||
private IStructattrService iStructattrService;
|
|
||||||
@Autowired
|
|
||||||
private MesApiService mesApiService;
|
|
||||||
@Override
|
|
||||||
@Mock(desc = "工单bom清单接口",enable = true)
|
|
||||||
public List<WorkOrderBomItem> workOrderMaterialList(String workOrder){
|
|
||||||
final Param param = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.MES_URL);
|
|
||||||
if (param ==null){
|
|
||||||
throw new BadRequestException("请传MES失败,未配置MES_URL地址");
|
|
||||||
}
|
|
||||||
String url = param.getValue();
|
|
||||||
try {
|
|
||||||
JSONObject requestParam = new JSONObject();
|
|
||||||
requestParam.put("OrderCode",workOrder);
|
|
||||||
String resultMsg = HttpRequest.post(url)
|
|
||||||
.body(requestParam.toJSONString())
|
|
||||||
.execute().body();
|
|
||||||
JSONObject result = JSONObject.parseObject(resultMsg);
|
|
||||||
MesResponse<List<WorkOrderBomItem>> response = result.toJavaObject(MesResponse.class);
|
|
||||||
if (!response.isSuccess()){
|
|
||||||
throw new BadRequestException("请求MES API失败"+result.getString("Message"));
|
|
||||||
}
|
|
||||||
return response.getResult();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BadRequestException("中鼎需求单下发失败:" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void workReportReturn(WorkReportParam workReportParam) {
|
|
||||||
String workOrderCode = workReportParam.getWorkOrderCode();
|
|
||||||
BigDecimal qty = workReportParam.getReportedQty();
|
|
||||||
if (StringUtils.isEmpty(workOrderCode)||qty == null){
|
|
||||||
throw new BadRequestException("工单报工同步失败,请求参数为空");
|
|
||||||
}
|
|
||||||
List<WorkOrderBomItem> workOrderBomItems = mesApiService.workOrderMaterialList(workOrderCode);
|
|
||||||
//TODO: 查询哪些是大件哪些是小件
|
|
||||||
//workAreag根据功能做区域查看对于的库区,工作区域与库区编码一直
|
|
||||||
final Structattr one = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
|
|
||||||
.eq(Structattr::getSect_code, workReportParam.getWorkArea()));
|
|
||||||
if (one == null){
|
|
||||||
throw new BadRequestException("当前工作区域对应的库区不存在");
|
|
||||||
}
|
|
||||||
Map<String, BigDecimal> map = workOrderBomItems.stream()
|
|
||||||
.collect(Collectors.toMap(
|
|
||||||
WorkOrderBomItem::getMaterialCode,
|
|
||||||
workOrderBomItem -> workOrderBomItem.getBomQty().multiply(qty)
|
|
||||||
));
|
|
||||||
final LineSideDto sideDto = new LineSideDto();
|
|
||||||
sideDto.setWorkOrder(workReportParam.getWorkOrderCode());
|
|
||||||
sideDto.setStorageVehicleCode(one.getStoragevehicle_code());
|
|
||||||
sideDto.setOutMaterials(map);
|
|
||||||
pdaIosOutService.directConfirm(sideDto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package org.nl.wms.ext_manage.mes.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.nl.common.exception.BadRequestException;
|
||||||
|
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||||
|
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||||
|
import org.nl.wms.ext_manage.api.MesApi;
|
||||||
|
import org.nl.wms.ext_manage.mes.service.MesReportService;
|
||||||
|
import org.nl.wms.ext_manage.mes.service.dto.WorkOrderBomItem;
|
||||||
|
import org.nl.wms.ext_manage.mes.service.dto.WorkReportParam;
|
||||||
|
import org.nl.wms.ext_manage.service.WmsToZDWmdService;
|
||||||
|
import org.nl.wms.pda_manage.ios_manage.service.PdaIosOutService;
|
||||||
|
import org.nl.wms.pda_manage.outBound.dto.LineSideDto;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class MesReportServiceImpl implements MesReportService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PdaIosOutService pdaIosOutService;
|
||||||
|
@Autowired
|
||||||
|
private IStructattrService iStructattrService;
|
||||||
|
@Autowired
|
||||||
|
private MesApi mesApi;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void workReportReturn(WorkReportParam workReportParam) {
|
||||||
|
String SrcBillNo = workReportParam.getSrcBillNo();
|
||||||
|
BigDecimal qty = workReportParam.getReportedQty();
|
||||||
|
if (StringUtils.isEmpty(SrcBillNo)||qty == null){
|
||||||
|
throw new BadRequestException("报工倒扣同步失败,ERP源单号不存在为空");
|
||||||
|
}
|
||||||
|
List<WorkOrderBomItem> workOrderBomItems = mesApi.workOrderMaterialList(SrcBillNo);
|
||||||
|
//TODO: 查询哪些是大件哪些是小件
|
||||||
|
//workAreag根据功能做区域查看对于的库区,工作区域与库区编码一直
|
||||||
|
final String sectCode = WmsToZDWmdService.ZD_LOS_MAPPING.get(workReportParam.getWorkArea());
|
||||||
|
if (sectCode == null){
|
||||||
|
throw new BadRequestException("当前工作区域"+workReportParam.getWorkArea()+"未配置库区映射");
|
||||||
|
}
|
||||||
|
final Structattr one = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
|
||||||
|
.eq(Structattr::getSect_code, sectCode));
|
||||||
|
if (one == null){
|
||||||
|
throw new BadRequestException("当前仓库"+sectCode+"不存在");
|
||||||
|
}
|
||||||
|
Map<String, BigDecimal> map = workOrderBomItems.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
WorkOrderBomItem::getMaterialCode,
|
||||||
|
workOrderBomItem -> workOrderBomItem.getBomQty().multiply(qty)
|
||||||
|
));
|
||||||
|
final LineSideDto sideDto = new LineSideDto();
|
||||||
|
sideDto.setWorkOrder(workReportParam.getWorkOrderCode());
|
||||||
|
sideDto.setStorageVehicleCode(one.getStoragevehicle_code());
|
||||||
|
sideDto.setOutMaterials(map);
|
||||||
|
pdaIosOutService.directConfirm(sideDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,7 +20,15 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public interface WmsToZDWmdService {
|
public interface WmsToZDWmdService {
|
||||||
|
|
||||||
public static Map<String,String> ZD_LOS_MAPPING = MapOf.of("EP2","6.002");
|
public static Map<String,String> ZD_LOS_MAPPING = MapOf.of(
|
||||||
|
"EP2","6.002"
|
||||||
|
,"E501", "6.007",
|
||||||
|
"E502", "6.007",
|
||||||
|
"E503", "6.007",
|
||||||
|
"E504", "6.007",
|
||||||
|
"E505", "6.007",
|
||||||
|
"E506", "6.007",
|
||||||
|
"E507", "6.007");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产领料需求单下发
|
* 生产领料需求单下发
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class WmsToZDWmdServiceImpl implements WmsToZDWmdService {
|
|||||||
if (respCode == null || respCode != 0) {
|
if (respCode == null || respCode != 0) {
|
||||||
throw new BadRequestException("中鼎库存查询失败:" + result.getString("respMsg"));
|
throw new BadRequestException("中鼎库存查询失败:" + result.getString("respMsg"));
|
||||||
}
|
}
|
||||||
return ResponseData.build(result, HttpStatus.OK);
|
return new ResponseEntity(result, HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BadRequestException("中鼎需求单下发失败:" + e.getMessage());
|
throw new BadRequestException("中鼎需求单下发失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ public class WmsToZDWmdServiceImpl implements WmsToZDWmdService {
|
|||||||
throw new BadRequestException("中鼎单据下推失败:" + result.getString("respMsg"));
|
throw new BadRequestException("中鼎单据下推失败:" + result.getString("respMsg"));
|
||||||
}
|
}
|
||||||
log.info("syncPurchaseReceiving采购入库单下发输出参数:-------------------" + result.toString());
|
log.info("syncPurchaseReceiving采购入库单下发输出参数:-------------------" + result.toString());
|
||||||
return ResponseData.build(result, HttpStatus.OK);
|
return new ResponseEntity(result, HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BadRequestException("中鼎单据下推失败:" + e.getMessage());
|
throw new BadRequestException("中鼎单据下推失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ public class WmsToZDWmdServiceImpl implements WmsToZDWmdService {
|
|||||||
throw new BadRequestException("中鼎库存查询失败:" + result.getString("respMsg"));
|
throw new BadRequestException("中鼎库存查询失败:" + result.getString("respMsg"));
|
||||||
}
|
}
|
||||||
inventorys = result.getJSONArray("data").toJavaList(ZDInventory.class);
|
inventorys = result.getJSONArray("data").toJavaList(ZDInventory.class);
|
||||||
return ResponseData.build(inventorys, HttpStatus.OK);
|
return new ResponseEntity(inventorys, HttpStatus.OK);
|
||||||
} catch (BadRequestException e) {
|
} catch (BadRequestException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public interface PdaIosOutService {
|
|||||||
*
|
*
|
||||||
* @return PdaResponse
|
* @return PdaResponse
|
||||||
*/
|
*/
|
||||||
PdaResponse<List<IOStorInvDis>> selectSectOutDis(String sectCode);
|
List<OutBoundDis> selectSectOutDis(String sectCode);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Mock
|
@Mock
|
||||||
public PdaResponse selectSectOutDis(String sectCode) {
|
public List<OutBoundDis> selectSectOutDis(String sectCode) {
|
||||||
if (StringUtils.isEmpty(sectCode)){
|
if (StringUtils.isEmpty(sectCode)){
|
||||||
throw new BadRequestException("查询手工出后配送失败,请求参数sect为空");
|
throw new BadRequestException("查询手工出后配送失败,请求参数sect为空");
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
|||||||
.isNull(IOStorInvDis::getTask_id)
|
.isNull(IOStorInvDis::getTask_id)
|
||||||
);
|
);
|
||||||
// .eq(IOStorInvDis::getHand_type, Boolean.getBoolean(IOSEnum.HAND_TYPE.code("手动搬运")))
|
// .eq(IOStorInvDis::getHand_type, Boolean.getBoolean(IOSEnum.HAND_TYPE.code("手动搬运")))
|
||||||
final ArrayList<OutBoundDis> result = new ArrayList<>();
|
final List<OutBoundDis> result = new ArrayList<>();
|
||||||
for (IOStorInvDis source : invDis) {
|
for (IOStorInvDis source : invDis) {
|
||||||
OutBoundDis target = new OutBoundDis();
|
OutBoundDis target = new OutBoundDis();
|
||||||
// 字段映射(注意下划线命名转驼峰命名)
|
// 字段映射(注意下划线命名转驼峰命名)
|
||||||
@@ -174,7 +174,8 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
|||||||
target.setHandType(source.getHand_type());
|
target.setHandType(source.getHand_type());
|
||||||
result.add(target);
|
result.add(target);
|
||||||
}
|
}
|
||||||
return PdaResponse.requestParamOk(result);
|
//PdaResponse.requestParamOk(result)
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -218,9 +219,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
|||||||
.eq(GroupPlate::getStoragevehicle_code, param.getStorageVehicleCode())
|
.eq(GroupPlate::getStoragevehicle_code, param.getStorageVehicleCode())
|
||||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||||
.in(GroupPlate::getMaterial_code, param.getOutMaterials().keySet()));
|
.in(GroupPlate::getMaterial_code, param.getOutMaterials().keySet()));
|
||||||
if (groupInventory.size()!=param.getOutMaterials().size()){
|
//没库存的话WMS不扣,EAS扣
|
||||||
throw new BadRequestException("库存扣减失败,库存不匹配");
|
|
||||||
}
|
|
||||||
Map<String, BigDecimal> groupInventoryMap = groupInventory.stream()
|
Map<String, BigDecimal> groupInventoryMap = groupInventory.stream()
|
||||||
.collect(Collectors.toMap(
|
.collect(Collectors.toMap(
|
||||||
GroupPlate::getMaterial_code,
|
GroupPlate::getMaterial_code,
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class PdaIosOutController {
|
|||||||
"value", sectattr.getSect_code()
|
"value", sectattr.getSect_code()
|
||||||
))
|
))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
return ResponseData.build(PdaResponse.requestParamOk(flatWH), HttpStatus.OK);
|
return ResponseData.build(flatWH, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getOutBoundDtl")
|
@GetMapping("/getOutBoundDtl")
|
||||||
|
|||||||
@@ -19,63 +19,48 @@ import java.math.BigDecimal;
|
|||||||
public class PmDemandParam {
|
public class PmDemandParam {
|
||||||
|
|
||||||
@NotBlank(message = "单据唯一ID不能为空")
|
@NotBlank(message = "单据唯一ID不能为空")
|
||||||
@JsonProperty(value = "Id")
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@NotBlank(message = "操作人不能为空")
|
@NotBlank(message = "操作人不能为空")
|
||||||
@JsonProperty(value = "Creator")
|
|
||||||
private String creator;
|
private String creator;
|
||||||
|
|
||||||
@NotBlank(message = "需求日期不能为空")
|
@NotBlank(message = "需求日期不能为空")
|
||||||
@JsonProperty(value = "CreateTime")
|
|
||||||
private String createTime;
|
private String createTime;
|
||||||
|
|
||||||
@NotNull(message = "优先级不能为空")
|
@NotNull(message = "优先级不能为空")
|
||||||
@JsonProperty(value = "Priority")
|
|
||||||
private Integer priority;
|
private Integer priority;
|
||||||
|
|
||||||
@JsonProperty(value = "Status")
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
@NotBlank(message = "工单编号不能为空")
|
@NotBlank(message = "工单编号不能为空")
|
||||||
@JsonProperty(value = "WorkOrder")
|
|
||||||
private String workOrder;
|
private String workOrder;
|
||||||
|
|
||||||
@NotBlank(message = "物料编码不能为空")
|
@NotBlank(message = "物料编码不能为空")
|
||||||
@JsonProperty(value = "SkuCode")
|
|
||||||
private String skuCode;
|
private String skuCode;
|
||||||
|
|
||||||
@NotBlank(message = "物料名称不能为空")
|
@NotBlank(message = "物料名称不能为空")
|
||||||
@JsonProperty(value = "SkuName")
|
|
||||||
private String skuName;
|
private String skuName;
|
||||||
|
|
||||||
@NotNull(message = "数量不能为空")
|
@NotNull(message = "数量不能为空")
|
||||||
@DecimalMin(value = "0", inclusive = false, message = "数量必须大于0")
|
@DecimalMin(value = "0", inclusive = false, message = "数量必须大于0")
|
||||||
@JsonProperty(value = "Qty")
|
|
||||||
private BigDecimal qty;
|
private BigDecimal qty;
|
||||||
|
|
||||||
private BigDecimal ssignQty;
|
private BigDecimal ssignQty;
|
||||||
|
|
||||||
@NotBlank(message = "单位不能为空")
|
@NotBlank(message = "单位不能为空")
|
||||||
@JsonProperty(value = "Unit")
|
|
||||||
private String unit;
|
private String unit;
|
||||||
|
|
||||||
@NotBlank(message = "目标库存地点不能为空")
|
@NotBlank(message = "目标库存地点不能为空")
|
||||||
@JsonProperty(value = "TargetArea")
|
|
||||||
private String targetArea;
|
private String targetArea;
|
||||||
|
|
||||||
@NotBlank(message = "产线不能为空")
|
@NotBlank(message = "产线不能为空")
|
||||||
@JsonProperty(value = "ProductionLine")
|
|
||||||
private String productionLine;
|
private String productionLine;
|
||||||
@NotBlank(message = "目标库存地点不能为空")
|
@NotBlank(message = "目标库存地点不能为空")
|
||||||
@JsonProperty(value = "TargetHouseCode")
|
|
||||||
private String targetHouseCode;
|
private String targetHouseCode;
|
||||||
|
|
||||||
@NotBlank(message = "产线不能为空")
|
@NotBlank(message = "产线不能为空")
|
||||||
@JsonProperty(value = "CarrierType")
|
|
||||||
private String carrierType;
|
private String carrierType;
|
||||||
|
|
||||||
@JsonProperty(value = "Sn")
|
|
||||||
private String sn;
|
private String sn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,6 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|||||||
for (StInventoryDto dto : inventoryDtos) {
|
for (StInventoryDto dto : inventoryDtos) {
|
||||||
DemandInventryDto demandDto = new DemandInventryDto();
|
DemandInventryDto demandDto = new DemandInventryDto();
|
||||||
demandDto.setSkuCode(dto.getMaterialCode());
|
demandDto.setSkuCode(dto.getMaterialCode());
|
||||||
demandDto.setSkuName(dto.getMaterialName());
|
|
||||||
demandDto.setQty(dto.getQty());
|
demandDto.setQty(dto.getQty());
|
||||||
demandDto.setHouseCode(dto.getStorCode());
|
demandDto.setHouseCode(dto.getStorCode());
|
||||||
demandDto.setHouseName(dto.getStorName());
|
demandDto.setHouseName(dto.getStorName());
|
||||||
@@ -263,7 +262,8 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|||||||
detailRow.put("qty", demand.getQty());
|
detailRow.put("qty", demand.getQty());
|
||||||
detailRow.put("source_bill_code", demand.getId());
|
detailRow.put("source_bill_code", demand.getId());
|
||||||
//走调拨回传
|
//走调拨回传
|
||||||
detailRow.put("source_bill_type", "DealLLDBBillPmDeamndCallBack");
|
detailRow.put("callback_strategy", "DealLLDBBillPmDeamndCallBack");
|
||||||
|
detailRow.put("source_bill_type", "需求单");
|
||||||
detailRow.put("source_billdtl_id", demand.getId());
|
detailRow.put("source_billdtl_id", demand.getId());
|
||||||
detailRow.put("remark", "关联工单:" + demand.getWorkOrder());
|
detailRow.put("remark", "关联工单:" + demand.getWorkOrder());
|
||||||
detailRow.put("load_port", demand.getTargetArea());
|
detailRow.put("load_port", demand.getTargetArea());
|
||||||
|
|||||||
@@ -12,65 +12,49 @@ import java.math.BigDecimal;
|
|||||||
public class PmReturnParam {
|
public class PmReturnParam {
|
||||||
|
|
||||||
@NotBlank(message = "单据唯一ID不能为空")
|
@NotBlank(message = "单据唯一ID不能为空")
|
||||||
@JsonProperty(value = "id")
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@NotBlank(message = "退料单号不能为空")
|
@NotBlank(message = "退料单号不能为空")
|
||||||
@JsonProperty(value = "orderCode")
|
|
||||||
private String orderCode;
|
private String orderCode;
|
||||||
|
|
||||||
@NotBlank(message = "序号不能为空")
|
@NotBlank(message = "序号不能为空")
|
||||||
@JsonProperty(value = "serialNo")
|
|
||||||
private String serialNo;
|
private String serialNo;
|
||||||
|
|
||||||
@NotBlank(message = "物料编码不能为空")
|
@NotBlank(message = "物料编码不能为空")
|
||||||
@JsonProperty(value = "skuCode")
|
|
||||||
private String skuCode;
|
private String skuCode;
|
||||||
|
|
||||||
@NotBlank(message = "物料名称不能为空")
|
@NotBlank(message = "物料名称不能为空")
|
||||||
@JsonProperty(value = "skuName")
|
|
||||||
private String skuName;
|
private String skuName;
|
||||||
|
|
||||||
@NotNull(message = "数量不能为空")
|
@NotNull(message = "数量不能为空")
|
||||||
@DecimalMin(value = "0", inclusive = false, message = "数量必须大于0")
|
@DecimalMin(value = "0", inclusive = false, message = "数量必须大于0")
|
||||||
@JsonProperty(value = "qty")
|
|
||||||
private BigDecimal qty;
|
private BigDecimal qty;
|
||||||
|
|
||||||
@JsonProperty(value = "assignQty")
|
|
||||||
private BigDecimal assignQty;
|
private BigDecimal assignQty;
|
||||||
|
|
||||||
@NotBlank(message = "单位不能为空")
|
@NotBlank(message = "单位不能为空")
|
||||||
@JsonProperty(value = "unit")
|
|
||||||
private String unit;
|
private String unit;
|
||||||
|
|
||||||
@NotBlank(message = "线边库位不能为空")
|
@NotBlank(message = "线边库位不能为空")
|
||||||
@JsonProperty(value = "targetArea")
|
|
||||||
private String targetArea;
|
private String targetArea;
|
||||||
|
|
||||||
@NotBlank(message = "容器编号不能为空")
|
@NotBlank(message = "容器编号不能为空")
|
||||||
@JsonProperty(value = "containerCode")
|
|
||||||
private String containerCode;
|
private String containerCode;
|
||||||
|
|
||||||
@NotNull(message = "配送方式不能为空")
|
@NotNull(message = "配送方式不能为空")
|
||||||
@JsonProperty(value = "deliveryMethod")
|
|
||||||
private Integer deliveryMethod;
|
private Integer deliveryMethod;
|
||||||
|
|
||||||
@NotBlank(message = "操作人工号不能为空")
|
@NotBlank(message = "操作人工号不能为空")
|
||||||
@JsonProperty(value = "creator")
|
|
||||||
private String creator;
|
private String creator;
|
||||||
|
|
||||||
@NotBlank(message = "操作时间不能为空")
|
@NotBlank(message = "操作时间不能为空")
|
||||||
@JsonProperty(value = "createTime")
|
|
||||||
private String createTime;
|
private String createTime;
|
||||||
|
|
||||||
@NotBlank(message = "来源仓别不能为空")
|
@NotBlank(message = "来源仓别不能为空")
|
||||||
@JsonProperty(value = "sourceHouseCode")
|
|
||||||
private String sourceHouseCode;
|
private String sourceHouseCode;
|
||||||
|
|
||||||
@NotNull(message = "状态不能为空")
|
@NotNull(message = "状态不能为空")
|
||||||
@JsonProperty(value = "status")
|
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@JsonProperty(value = "updateName")
|
|
||||||
private String updateName;
|
private String updateName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,5 +114,13 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
|
|||||||
*/
|
*/
|
||||||
List<SchBasePoint> selectIdlePoint(List<String> regions);
|
List<SchBasePoint> selectIdlePoint(List<String> regions);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询点位区域映射仓库:用于点位库存的操作
|
||||||
|
* @param pointCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getPointRegionMapperSect(String pointCode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,4 +49,15 @@ public interface SchBasePointMapper extends BaseMapper<SchBasePoint> {
|
|||||||
* @return IPage<SchBasePoint>
|
* @return IPage<SchBasePoint>
|
||||||
*/
|
*/
|
||||||
IPage<SchBasePoint> selectPageLeftJoin(IPage<SchBasePoint> pages, SchBasePointQuery whereJson);
|
IPage<SchBasePoint> selectPageLeftJoin(IPage<SchBasePoint> pages, SchBasePointQuery whereJson);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询点位映射仓库,对应region里根据type
|
||||||
|
* @param pointCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Select("SELECT point_type_explain FROM sch_base_region " +
|
||||||
|
"INNER JOIN sch_base_point ON sch_base_region.region_code = sch_base_point.region_code " +
|
||||||
|
"WHERE sch_base_point.point_code = #{pointCode}")
|
||||||
|
String getPointRegionMapperSect(String pointCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -261,4 +261,12 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
|||||||
public List<SchBasePoint> selectIdlePoint(List<String> regions) {
|
public List<SchBasePoint> selectIdlePoint(List<String> regions) {
|
||||||
return this.baseMapper.selectIdlePoint(regions);
|
return this.baseMapper.selectIdlePoint(regions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPointRegionMapperSect(String pointCode) {
|
||||||
|
if (StringUtils.isEmpty(pointCode)){
|
||||||
|
throw new BadRequestException("查询点位失败,请求参数不能为空");
|
||||||
|
}
|
||||||
|
return this.baseMapper.getPointRegionMapperSect(pointCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class SysParamConstant {
|
|||||||
/**
|
/**
|
||||||
* MES URL
|
* MES URL
|
||||||
*/
|
*/
|
||||||
public final static String MES_URL = "mes_url";
|
public final static String MES_URL_BOM = "MES_URL_BOM";
|
||||||
public final static String MES_URL_DEMAND_CALL = "MES_URL_DEMAND_CALL";
|
public final static String MES_URL_DEMAND_CALL = "MES_URL_DEMAND_CALL";
|
||||||
/**
|
/**
|
||||||
* 打印机ip
|
* 打印机ip
|
||||||
|
|||||||
@@ -43,9 +43,7 @@ public enum IOSEnum {
|
|||||||
, "移入锁", "3", "移出锁", "4", "其他锁","9"
|
, "移入锁", "3", "移出锁", "4", "其他锁","9"
|
||||||
)),
|
)),
|
||||||
//库区类型
|
//库区类型
|
||||||
ST_SECT_TYPE(MapOf.of("主存区", "00", "暂存区", "10", "平库", "90"
|
ST_SECT_TYPE(MapOf.of("主存区", "00", "暂存区", "01", "平库", "09")),
|
||||||
, "移入锁", "3", "移出锁", "4", "其他锁","9"
|
|
||||||
)),
|
|
||||||
// 点位状态
|
// 点位状态
|
||||||
POINT_STATUS(MapOf.of("无货", "1", "有货", "2" )),
|
POINT_STATUS(MapOf.of("无货", "1", "有货", "2" )),
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
source_bill_type,
|
source_bill_type,
|
||||||
source_load_port,
|
source_load_port,
|
||||||
source_billdtl_id,
|
source_billdtl_id,
|
||||||
|
callback_strategy,
|
||||||
plan_qty,
|
plan_qty,
|
||||||
remark,
|
remark,
|
||||||
assign_qty,
|
assign_qty,
|
||||||
@@ -36,6 +37,7 @@
|
|||||||
#{item.source_bill_type},
|
#{item.source_bill_type},
|
||||||
#{item.source_load_port},
|
#{item.source_load_port},
|
||||||
#{item.source_billdtl_id},
|
#{item.source_billdtl_id},
|
||||||
|
#{item.callback_strategy},
|
||||||
#{item.plan_qty},
|
#{item.plan_qty},
|
||||||
#{item.remark},
|
#{item.remark},
|
||||||
#{item.assign_qty},
|
#{item.assign_qty},
|
||||||
|
|||||||
@@ -331,6 +331,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
|||||||
detail.setSource_bill_code(row.getString("source_bill_code"));
|
detail.setSource_bill_code(row.getString("source_bill_code"));
|
||||||
detail.setSource_bill_type(row.getString("source_bill_type"));
|
detail.setSource_bill_type(row.getString("source_bill_type"));
|
||||||
detail.setSource_billdtl_id(row.getString("source_billdtl_id"));
|
detail.setSource_billdtl_id(row.getString("source_billdtl_id"));
|
||||||
|
detail.setCallback_strategy(row.getString("callback_strategy"));
|
||||||
detail.setPlan_qty(planQty);
|
detail.setPlan_qty(planQty);
|
||||||
detail.setSource_load_port(row.getString("load_port"));
|
detail.setSource_load_port(row.getString("load_port"));
|
||||||
detail.setRemark(row.getString("remark"));
|
detail.setRemark(row.getString("remark"));
|
||||||
@@ -1086,6 +1087,10 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
|||||||
.set(IOStorInvDtl::getReal_qty, BigDecimal.ZERO)
|
.set(IOStorInvDtl::getReal_qty, BigDecimal.ZERO)
|
||||||
.in(IOStorInvDtl::getIostorinvdtl_id, dtlSet)
|
.in(IOStorInvDtl::getIostorinvdtl_id, dtlSet)
|
||||||
);
|
);
|
||||||
|
List<IOStorInvDtl> ioStorInvDtls = ioStorInvDtlMapper.selectBatchIds(dtlSet);
|
||||||
|
for (IOStorInvDtl ioStorInvDtl : ioStorInvDtls) {
|
||||||
|
callbackStrategyPublish.callbackStrategy(ioStorInvDtl.getCallback_strategy(),ioStorInvDtl);
|
||||||
|
}
|
||||||
//TODO:添加单据更新
|
//TODO:添加单据更新
|
||||||
//更新主表状态
|
//更新主表状态
|
||||||
ioStorInvMapper.update(ioStorInv, new LambdaUpdateWrapper<>(IOStorInv.class)
|
ioStorInvMapper.update(ioStorInv, new LambdaUpdateWrapper<>(IOStorInv.class)
|
||||||
@@ -1166,15 +1171,13 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
|||||||
List<AddInvParam> addInvParams = new ArrayList<>();
|
List<AddInvParam> addInvParams = new ArrayList<>();
|
||||||
for (IOStorInvDis invDis : disList) {
|
for (IOStorInvDis invDis : disList) {
|
||||||
if (invDis.getTask_id() == null && !StringUtils.isEmpty(invDis.getPoint_code())){
|
if (invDis.getTask_id() == null && !StringUtils.isEmpty(invDis.getPoint_code())){
|
||||||
final SchBasePoint one = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
|
String sectCode = iSchBasePointService.getPointRegionMapperSect(invDis.getPoint_code());
|
||||||
.eq(SchBasePoint::getPoint_code, invDis.getPoint_code()));
|
if (sectCode ==null){
|
||||||
if (one ==null){
|
|
||||||
throw new BadRequestException("明细完成失败,当前点位未配置所属库区");
|
throw new BadRequestException("明细完成失败,当前点位未配置所属库区");
|
||||||
}
|
}
|
||||||
String regionCode = one.getRegion_code();
|
|
||||||
//更新库存,查询托盘
|
//更新库存,查询托盘
|
||||||
final Structattr targetAttr = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
|
final Structattr targetAttr = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
|
||||||
.eq(Structattr::getSect_code, regionCode));
|
.eq(Structattr::getSect_code, sectCode));
|
||||||
if (targetAttr ==null ||StringUtils.isEmpty(targetAttr.getStoragevehicle_code())){
|
if (targetAttr ==null ||StringUtils.isEmpty(targetAttr.getStoragevehicle_code())){
|
||||||
throw new BadRequestException("明细完成失败,当前调拨目标区域不存在"+invDis.getPoint_code());
|
throw new BadRequestException("明细完成失败,当前调拨目标区域不存在"+invDis.getPoint_code());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
<mapper namespace="org.nl.wms.warehouse_manage.inventory.dao.mapper.StInventoryMapper">
|
<mapper namespace="org.nl.wms.warehouse_manage.inventory.dao.mapper.StInventoryMapper">
|
||||||
<select id="queryInventory" resultType="org.nl.wms.warehouse_manage.inventory.dto.StInventoryDto">
|
<select id="queryInventory" resultType="org.nl.wms.warehouse_manage.inventory.dto.StInventoryDto">
|
||||||
SELECT
|
SELECT
|
||||||
s.stor_id as storId,
|
|
||||||
s.stor_code as storCode,
|
s.stor_code as storCode,
|
||||||
|
s.sect_code as sectCode,
|
||||||
|
g.pcsn as pcsn,
|
||||||
s.stor_name as storName,
|
s.stor_name as storName,
|
||||||
g.material_code as materialCode,
|
g.material_code as materialCode,
|
||||||
SUM(g.frozen_qty) AS frozenQty, -- 可用库存
|
SUM(g.frozen_qty) AS frozenQty, -- 可用库存
|
||||||
@@ -14,8 +15,14 @@
|
|||||||
ON g.storagevehicle_code = s.storagevehicle_code
|
ON g.storagevehicle_code = s.storagevehicle_code
|
||||||
WHERE g.material_code = #{query.materialCode}
|
WHERE g.material_code = #{query.materialCode}
|
||||||
AND g.status = '02' -- 排除已移除/已禁用的组盘记录
|
AND g.status = '02' -- 排除已移除/已禁用的组盘记录
|
||||||
AND s.is_used = 1 -- 只统计启用的仓位
|
AND s.is_used = 1 -- 只统计启用的仓位
|
||||||
GROUP BY s.stor_id, s.stor_code, s.stor_name, g.material_code
|
<if test="query.sectCode != null and query.sectCode.size() > 0">
|
||||||
|
AND sect_code IN
|
||||||
|
<foreach collection="query.sectCode" item="sect" open="(" separator="," close=")">
|
||||||
|
#{sect}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
GROUP BY s.stor_code,s.stor_name,s.sect_code,g.pcsn, g.material_code
|
||||||
ORDER BY s.stor_code;
|
ORDER BY s.stor_code;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import lombok.NoArgsConstructor;
|
|||||||
import org.nl.common.domain.query.BaseQuery;
|
import org.nl.common.domain.query.BaseQuery;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -15,4 +16,5 @@ import java.math.BigDecimal;
|
|||||||
public class StInventoryQuery extends BaseQuery {
|
public class StInventoryQuery extends BaseQuery {
|
||||||
private String materialCode;
|
private String materialCode;
|
||||||
private String storCode;
|
private String storCode;
|
||||||
|
private List<String> sectCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,56 +53,58 @@ public class DealLLDBBillPmDeamndCallBack implements CallbackStrategy {
|
|||||||
if (one == null){
|
if (one == null){
|
||||||
throw new BadRequestException("需求单不存在");
|
throw new BadRequestException("需求单不存在");
|
||||||
}
|
}
|
||||||
|
if (one.getStatus().equals(DemandStatus.FINISH.getValue())){
|
||||||
|
return;
|
||||||
|
}
|
||||||
final SchBaseRegion region = iSchBaseRegionService.getOne(new LambdaQueryWrapper<SchBaseRegion>()
|
final SchBaseRegion region = iSchBaseRegionService.getOne(new LambdaQueryWrapper<SchBaseRegion>()
|
||||||
.eq(SchBaseRegion::getRegion_code, one.getProduction_line())
|
.eq(SchBaseRegion::getRegion_code, one.getProduction_line())
|
||||||
.select(SchBaseRegion::getPoint_type_explain));
|
.select(SchBaseRegion::getPoint_type_explain));
|
||||||
if (region==null){
|
if (region==null){
|
||||||
throw new BadRequestException("当前产线未配置对应仓库编码getPoint_type_explain");
|
throw new BadRequestException("当前产线未配置对应仓库编码getPoint_type_explain");
|
||||||
}
|
}
|
||||||
final String now = DateUtil.now();
|
if (one.getAssign_qty().intValue()>=one.getQty().intValue()){
|
||||||
JSONObject callbackData = new JSONObject();
|
one.setAssign_qty(param.getAssign_qty());
|
||||||
callbackData.put("method", "DealLLDBBill");
|
one.setStatus(DemandStatus.FINISH.getValue());
|
||||||
callbackData.put("type", "WMS");
|
this.iPmDemandService.updateById(one);
|
||||||
// 组装data节点
|
final String now = DateUtil.now();
|
||||||
JSONObject data = new JSONObject();
|
JSONObject callbackData = new JSONObject();
|
||||||
data.put("issueStorageOrgUnitNo", "01.09.14"); // 业务状态,可根据实际业务逻辑设置
|
callbackData.put("method", "DealLLDBBill");
|
||||||
data.put("bizTypeNo", 311); // 业务日期
|
callbackData.put("type", "WMS");
|
||||||
data.put("receiptStorageOrgUnitNo", "01.09.14"); // 创建人编号,从当前登录用户获取
|
// 组装data节点
|
||||||
data.put("billNo", param.getIostorinv_id()); // 使用工单编号作为MES单号
|
JSONObject data = new JSONObject();
|
||||||
// 组装明细列表
|
data.put("issueStorageOrgUnitNo", "01.09.14"); // 业务状态,可根据实际业务逻辑设置
|
||||||
JSONArray entrys = new JSONArray();
|
data.put("bizTypeNo", "331"); // 业务日期
|
||||||
final List<IOStorInvDisDto> disSet = ioStorInvDisMapper.queryOutBillDisDtl(MapOf.of("iostorinvdtl_id", param.getIostorinvdtl_id()));
|
data.put("receiptStorageOrgUnitNo", "01.09.14"); // 创建人编号,从当前登录用户获取
|
||||||
for (IOStorInvDisDto ioStorInvDisDto : disSet) {
|
data.put("billNo", param.getIostorinv_id()); // 使用工单编号作为MES单号
|
||||||
JSONObject entry = new JSONObject();
|
// 组装明细列表
|
||||||
entry.put("unitNo", "PCS"); // 序号
|
JSONArray entrys = new JSONArray();
|
||||||
entry.put("qty", ioStorInvDisDto.getPlan_qty()); // 数量
|
final List<IOStorInvDisDto> disSet = ioStorInvDisMapper.queryOutBillDisDtl(MapOf.of("iostorinvdtl_id", param.getIostorinvdtl_id()));
|
||||||
entry.put("materialNo", ioStorInvDisDto.getMaterial_code()); // 来源单据标识
|
for (IOStorInvDisDto ioStorInvDisDto : disSet) {
|
||||||
entry.put("issueWarehouseNo", region.getPoint_type_explain());
|
JSONObject entry = new JSONObject();
|
||||||
entry.put("receiptWarehouseNo", ioStorInvDisDto.getSect_code());
|
entry.put("unitNo", "PCS"); // 序号
|
||||||
entrys.add(entry);
|
entry.put("qty", ioStorInvDisDto.getPlan_qty()); // 数量
|
||||||
|
entry.put("materialNo", ioStorInvDisDto.getMaterial_code()); // 来源单据标识
|
||||||
|
entry.put("issueWarehouseNo", ioStorInvDisDto.getSect_code());
|
||||||
|
entry.put("receiptWarehouseNo", region.getPoint_type_explain());
|
||||||
|
entrys.add(entry);
|
||||||
|
}
|
||||||
|
data.put("entrys", entrys);
|
||||||
|
callbackData.put("data", data);
|
||||||
|
PmStockReturn stockReturn = new PmStockReturn();
|
||||||
|
stockReturn.setRequest_Id(param.getIostorinv_id());
|
||||||
|
stockReturn.setRequest_type(IOSEnum.BILL_TYPE.code("库存调拨"));
|
||||||
|
stockReturn.setStatus(StockReturnStatusEnum.TODO.getCode()); // 0-处理中
|
||||||
|
stockReturn.setCreate_time(now);
|
||||||
|
stockReturn.setRequest_data(callbackData.toString());
|
||||||
|
//回传MES
|
||||||
|
mesApi.pmDemandCallback(Arrays.asList(new MesApi.PmDemandCall(
|
||||||
|
one.getId()
|
||||||
|
,one.getId()
|
||||||
|
,now,one.getTarget_area()
|
||||||
|
,1
|
||||||
|
,disSet.get(0).getStoragevehicle_code(),
|
||||||
|
param.getAssign_qty().toString())));
|
||||||
|
iPmStockReturnService.save(stockReturn);
|
||||||
}
|
}
|
||||||
data.put("entrys", entrys);
|
|
||||||
callbackData.put("data", data);
|
|
||||||
PmStockReturn stockReturn = new PmStockReturn();
|
|
||||||
stockReturn.setRequest_Id(one.getId());
|
|
||||||
stockReturn.setRequest_type(IOSEnum.BILL_TYPE.code("库存调拨"));
|
|
||||||
stockReturn.setStatus(StockReturnStatusEnum.TODO.getCode()); // 0-处理中
|
|
||||||
stockReturn.setCreate_time(now);
|
|
||||||
stockReturn.setRequest_data(callbackData.toString());
|
|
||||||
|
|
||||||
//回传MES
|
|
||||||
mesApi.pmDemandCallback(Arrays.asList(new MesApi.PmDemandCall(
|
|
||||||
param.getIostorinv_id(),one.getId()
|
|
||||||
,now,one.getTarget_area()
|
|
||||||
,1
|
|
||||||
,disSet.get(0).getStoragevehicle_code(),
|
|
||||||
param.getAssign_qty().toString())));
|
|
||||||
|
|
||||||
iPmStockReturnService.save(stockReturn);
|
|
||||||
one.setAssign_qty(param.getAssign_qty());
|
|
||||||
one.setStatus(DemandStatus.FINISH.getValue());
|
|
||||||
this.iPmDemandService.updateById(one);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,6 @@
|
|||||||
<span class="role-span">{{ $t('Role.title_right') }}</span>
|
<span class="role-span">{{ $t('Role.title_right') }}</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-button
|
<el-button
|
||||||
v-permission="['admin','roles:edit']"
|
|
||||||
:disabled="!showButton"
|
:disabled="!showButton"
|
||||||
:loading="menuLoading"
|
:loading="menuLoading"
|
||||||
icon="el-icon-check"
|
icon="el-icon-check"
|
||||||
@@ -195,7 +194,7 @@ export default {
|
|||||||
|
|
||||||
const _this = this
|
const _this = this
|
||||||
crudMenu.getMenusByRole(param).then(res => {
|
crudMenu.getMenusByRole(param).then(res => {
|
||||||
_this.menus = res
|
_this.menus = res.data
|
||||||
|
|
||||||
// 初始化默认选中的key
|
// 初始化默认选中的key
|
||||||
_this.menuIds = []
|
_this.menuIds = []
|
||||||
@@ -230,7 +229,8 @@ export default {
|
|||||||
},
|
},
|
||||||
menuChange(menu) {
|
menuChange(menu) {
|
||||||
// 获取该节点的所有子节点,id 包含自身
|
// 获取该节点的所有子节点,id 包含自身
|
||||||
getChild(menu.menu_id).then(childIds => {
|
getChild(menu.menu_id).then(res => {
|
||||||
|
let childIds = res.data
|
||||||
// 判断是否在 menuIds 中,如果存在则删除,否则添加
|
// 判断是否在 menuIds 中,如果存在则删除,否则添加
|
||||||
if (this.menuIds.indexOf(menu.menu_id) !== -1) {
|
if (this.menuIds.indexOf(menu.menu_id) !== -1) {
|
||||||
for (let i = 0; i < childIds.length; i++) {
|
for (let i = 0; i < childIds.length; i++) {
|
||||||
|
|||||||
@@ -436,9 +436,11 @@ export default {
|
|||||||
allDiv() {
|
allDiv() {
|
||||||
this.loadingAlldiv = true
|
this.loadingAlldiv = true
|
||||||
checkoutbill.allDiv(this.mstrow).then(res => {
|
checkoutbill.allDiv(this.mstrow).then(res => {
|
||||||
this.crud.notify('分配成功!', CRUD.NOTIFICATION_TYPE.INFO)
|
if(res.code === 200) {
|
||||||
this.queryTableDtl()
|
this.crud.notify('分配成功!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
this.loadingAlldiv = false
|
this.queryTableDtl()
|
||||||
|
this.loadingAlldiv = false
|
||||||
|
}
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.loadingAlldiv = false
|
this.loadingAlldiv = false
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user