fix:工单同步相关逻辑
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package org.nl.common.aspect;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
@Aspect
|
||||
@@ -60,6 +65,27 @@ public class MockAspect {
|
||||
return null;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.basedata_manage.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@@ -59,8 +60,8 @@ public interface ISectattrService extends IService<Sectattr> {
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
JSONObject getSect(Map whereJson);
|
||||
JSONObject getSectCode(Map whereJson);
|
||||
JSONArray getSect(Map whereJson);
|
||||
JSONArray getSectCode(Map whereJson);
|
||||
|
||||
/**
|
||||
* 改变启用状态
|
||||
|
||||
@@ -161,7 +161,7 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getSect(Map whereJson) {
|
||||
public JSONArray getSect(Map whereJson) {
|
||||
JSONArray new_ja = new JSONArray();
|
||||
|
||||
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);
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("content", new_ja);
|
||||
return jo;
|
||||
return new_ja;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject getSectCode(Map whereJson) {
|
||||
public JSONArray getSectCode(Map whereJson) {
|
||||
JSONArray new_ja = new JSONArray();
|
||||
|
||||
String is_materialstore = (String) whereJson.get("is_materialstore");
|
||||
String is_virtualstore = (String) whereJson.get("is_virtualstore");
|
||||
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);
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("content", new_ja);
|
||||
return jo;
|
||||
return new_ja;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,15 +2,20 @@ package org.nl.wms.ext_manage.api;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.annotation.Mock;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
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.pm_manage.demand.service.dao.PmDemand;
|
||||
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.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;import org.nl.common.base.ResponseData;
|
||||
@@ -54,11 +59,40 @@ public class MesApi {
|
||||
Integer respCode = result.getInteger("ResultCode");
|
||||
log.info("pmDemandCallback需求单回传参数:-------------------" + result.toString());
|
||||
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) {
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.base.ResponseData;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
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.dto.MesTaskParams;
|
||||
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.dao.PmReturn;
|
||||
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.dto.WorkOrderDto;
|
||||
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 javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -43,6 +52,12 @@ public class MesToWmsController {
|
||||
@Autowired
|
||||
private IPmDemandService iPmDemandService;
|
||||
|
||||
@Autowired
|
||||
private IStInventoryService iStInventoryService;
|
||||
|
||||
@Autowired
|
||||
private WorkReportProducer workReportProducer;
|
||||
|
||||
@PostMapping("api/mes/lineLackMat")
|
||||
@SaIgnore
|
||||
public ResponseEntity task(@Valid @RequestBody MesTaskParams mesTaskParams){
|
||||
@@ -57,6 +72,7 @@ public class MesToWmsController {
|
||||
*/
|
||||
@PostMapping("api/mes/subWorkOrder")
|
||||
@SaIgnore
|
||||
@Log("工单同步")
|
||||
public ResponseEntity subWorkOrder(@RequestBody List<WorkOrderDto.WorkOrderDataDto> dtos){
|
||||
for (WorkOrderDto.WorkOrderDataDto dto : dtos) {
|
||||
iWorkOrderService.insert(dto);
|
||||
@@ -66,6 +82,7 @@ public class MesToWmsController {
|
||||
|
||||
@PostMapping("app/restful/api/v3/wms/mesRequisitionSync")
|
||||
@SaIgnore
|
||||
@Log("需求单同步`")
|
||||
public ResponseEntity mesRequisitionSync(@RequestBody List<PmDemandParam> params) {
|
||||
iPmDemandService.batchCreate(params);
|
||||
return ResponseData.build();
|
||||
@@ -90,4 +107,35 @@ public class MesToWmsController {
|
||||
}
|
||||
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;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.amqp.support.AmqpHeaders;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.messaging.handler.annotation.Header;
|
||||
@@ -14,12 +14,12 @@ import org.springframework.stereotype.Component;
|
||||
public class WorkReportConsumer {
|
||||
|
||||
@Autowired
|
||||
MesApiService mesApiService;
|
||||
MesReportService mesReportService;
|
||||
|
||||
@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) {
|
||||
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;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.ext_manage.mes.service.dto.WorkReportParam;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -11,6 +13,6 @@ public class WorkReportProducer {
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
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
|
||||
*/
|
||||
@JsonProperty("Id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 工单编码
|
||||
*/
|
||||
@JsonProperty("WorkOrderCode")
|
||||
private String workOrderCode;
|
||||
|
||||
/**
|
||||
* 跟踪号/班组
|
||||
*/
|
||||
@JsonProperty("TrackNo")
|
||||
private String trackNo;
|
||||
|
||||
/**
|
||||
* 车间
|
||||
*/
|
||||
@JsonProperty("Workshop")
|
||||
private String workshop;
|
||||
|
||||
/**
|
||||
* 工作区域
|
||||
*/
|
||||
@JsonProperty("WorkArea")
|
||||
private String workArea;
|
||||
|
||||
/**
|
||||
* 序列号/控制码
|
||||
*/
|
||||
@JsonProperty("Sn")
|
||||
private String sn;
|
||||
|
||||
/**
|
||||
* 报工数量
|
||||
*/
|
||||
@JsonProperty("ReportedQty")
|
||||
private BigDecimal reportedQty;
|
||||
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
@JsonProperty("StatusCode")
|
||||
private String statusCode;
|
||||
|
||||
/**
|
||||
* 请求时间
|
||||
*/
|
||||
@JsonProperty("RequestTime")
|
||||
private String requestTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@JsonProperty("CreatedBy")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonProperty("CreatedOn")
|
||||
private String createdOn;
|
||||
|
||||
/**
|
||||
* 订单编码
|
||||
*/
|
||||
@JsonProperty("OrderCode")
|
||||
private String orderCode;
|
||||
|
||||
/**
|
||||
* 组织编号
|
||||
*/
|
||||
@JsonProperty("OrgNo")
|
||||
private String orgNo;
|
||||
|
||||
/**
|
||||
* 部门编号
|
||||
*/
|
||||
@JsonProperty("DeptNo")
|
||||
private String deptNo;
|
||||
/**
|
||||
* 业务时间
|
||||
*/
|
||||
@JsonProperty("BizTime")
|
||||
private String bizTime;
|
||||
|
||||
/**
|
||||
* 源单据编号
|
||||
*/
|
||||
@JsonProperty("SrcBillNo")
|
||||
private String srcBillNo;
|
||||
|
||||
/**
|
||||
* 源单据ID
|
||||
*/
|
||||
@JsonProperty("SrcBillId")
|
||||
private String srcBillId;
|
||||
|
||||
/**
|
||||
* 响应方
|
||||
*/
|
||||
@JsonProperty("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 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) {
|
||||
throw new BadRequestException("中鼎库存查询失败:" + result.getString("respMsg"));
|
||||
}
|
||||
return ResponseData.build(result, HttpStatus.OK);
|
||||
return new ResponseEntity(result, HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("中鼎需求单下发失败:" + e.getMessage());
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public class WmsToZDWmdServiceImpl implements WmsToZDWmdService {
|
||||
throw new BadRequestException("中鼎单据下推失败:" + result.getString("respMsg"));
|
||||
}
|
||||
log.info("syncPurchaseReceiving采购入库单下发输出参数:-------------------" + result.toString());
|
||||
return ResponseData.build(result, HttpStatus.OK);
|
||||
return new ResponseEntity(result, HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("中鼎单据下推失败:" + e.getMessage());
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public class WmsToZDWmdServiceImpl implements WmsToZDWmdService {
|
||||
throw new BadRequestException("中鼎库存查询失败:" + result.getString("respMsg"));
|
||||
}
|
||||
inventorys = result.getJSONArray("data").toJavaList(ZDInventory.class);
|
||||
return ResponseData.build(inventorys, HttpStatus.OK);
|
||||
return new ResponseEntity(inventorys, HttpStatus.OK);
|
||||
} catch (BadRequestException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -23,7 +23,7 @@ public interface PdaIosOutService {
|
||||
*
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse<List<IOStorInvDis>> selectSectOutDis(String sectCode);
|
||||
List<OutBoundDis> selectSectOutDis(String sectCode);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -149,7 +149,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
|
||||
@Override
|
||||
@Mock
|
||||
public PdaResponse selectSectOutDis(String sectCode) {
|
||||
public List<OutBoundDis> selectSectOutDis(String sectCode) {
|
||||
if (StringUtils.isEmpty(sectCode)){
|
||||
throw new BadRequestException("查询手工出后配送失败,请求参数sect为空");
|
||||
}
|
||||
@@ -159,7 +159,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
.isNull(IOStorInvDis::getTask_id)
|
||||
);
|
||||
// .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) {
|
||||
OutBoundDis target = new OutBoundDis();
|
||||
// 字段映射(注意下划线命名转驼峰命名)
|
||||
@@ -174,7 +174,8 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
target.setHandType(source.getHand_type());
|
||||
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::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
.in(GroupPlate::getMaterial_code, param.getOutMaterials().keySet()));
|
||||
if (groupInventory.size()!=param.getOutMaterials().size()){
|
||||
throw new BadRequestException("库存扣减失败,库存不匹配");
|
||||
}
|
||||
//没库存的话WMS不扣,EAS扣
|
||||
Map<String, BigDecimal> groupInventoryMap = groupInventory.stream()
|
||||
.collect(Collectors.toMap(
|
||||
GroupPlate::getMaterial_code,
|
||||
|
||||
@@ -57,7 +57,7 @@ public class PdaIosOutController {
|
||||
"value", sectattr.getSect_code()
|
||||
))
|
||||
.collect(Collectors.toList());
|
||||
return ResponseData.build(PdaResponse.requestParamOk(flatWH), HttpStatus.OK);
|
||||
return ResponseData.build(flatWH, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getOutBoundDtl")
|
||||
|
||||
@@ -19,63 +19,48 @@ import java.math.BigDecimal;
|
||||
public class PmDemandParam {
|
||||
|
||||
@NotBlank(message = "单据唯一ID不能为空")
|
||||
@JsonProperty(value = "Id")
|
||||
private String id;
|
||||
|
||||
@NotBlank(message = "操作人不能为空")
|
||||
@JsonProperty(value = "Creator")
|
||||
private String creator;
|
||||
|
||||
@NotBlank(message = "需求日期不能为空")
|
||||
@JsonProperty(value = "CreateTime")
|
||||
private String createTime;
|
||||
|
||||
@NotNull(message = "优先级不能为空")
|
||||
@JsonProperty(value = "Priority")
|
||||
private Integer priority;
|
||||
|
||||
@JsonProperty(value = "Status")
|
||||
private String status;
|
||||
|
||||
@NotBlank(message = "工单编号不能为空")
|
||||
@JsonProperty(value = "WorkOrder")
|
||||
private String workOrder;
|
||||
|
||||
@NotBlank(message = "物料编码不能为空")
|
||||
@JsonProperty(value = "SkuCode")
|
||||
private String skuCode;
|
||||
|
||||
@NotBlank(message = "物料名称不能为空")
|
||||
@JsonProperty(value = "SkuName")
|
||||
private String skuName;
|
||||
|
||||
@NotNull(message = "数量不能为空")
|
||||
@DecimalMin(value = "0", inclusive = false, message = "数量必须大于0")
|
||||
@JsonProperty(value = "Qty")
|
||||
private BigDecimal qty;
|
||||
|
||||
private BigDecimal ssignQty;
|
||||
|
||||
@NotBlank(message = "单位不能为空")
|
||||
@JsonProperty(value = "Unit")
|
||||
private String unit;
|
||||
|
||||
@NotBlank(message = "目标库存地点不能为空")
|
||||
@JsonProperty(value = "TargetArea")
|
||||
private String targetArea;
|
||||
|
||||
@NotBlank(message = "产线不能为空")
|
||||
@JsonProperty(value = "ProductionLine")
|
||||
private String productionLine;
|
||||
@NotBlank(message = "目标库存地点不能为空")
|
||||
@JsonProperty(value = "TargetHouseCode")
|
||||
private String targetHouseCode;
|
||||
|
||||
@NotBlank(message = "产线不能为空")
|
||||
@JsonProperty(value = "CarrierType")
|
||||
private String carrierType;
|
||||
|
||||
@JsonProperty(value = "Sn")
|
||||
private String sn;
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,6 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
||||
for (StInventoryDto dto : inventoryDtos) {
|
||||
DemandInventryDto demandDto = new DemandInventryDto();
|
||||
demandDto.setSkuCode(dto.getMaterialCode());
|
||||
demandDto.setSkuName(dto.getMaterialName());
|
||||
demandDto.setQty(dto.getQty());
|
||||
demandDto.setHouseCode(dto.getStorCode());
|
||||
demandDto.setHouseName(dto.getStorName());
|
||||
@@ -263,7 +262,8 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
||||
detailRow.put("qty", demand.getQty());
|
||||
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("remark", "关联工单:" + demand.getWorkOrder());
|
||||
detailRow.put("load_port", demand.getTargetArea());
|
||||
|
||||
@@ -12,65 +12,49 @@ import java.math.BigDecimal;
|
||||
public class PmReturnParam {
|
||||
|
||||
@NotBlank(message = "单据唯一ID不能为空")
|
||||
@JsonProperty(value = "id")
|
||||
private String id;
|
||||
|
||||
@NotBlank(message = "退料单号不能为空")
|
||||
@JsonProperty(value = "orderCode")
|
||||
private String orderCode;
|
||||
|
||||
@NotBlank(message = "序号不能为空")
|
||||
@JsonProperty(value = "serialNo")
|
||||
private String serialNo;
|
||||
|
||||
@NotBlank(message = "物料编码不能为空")
|
||||
@JsonProperty(value = "skuCode")
|
||||
private String skuCode;
|
||||
|
||||
@NotBlank(message = "物料名称不能为空")
|
||||
@JsonProperty(value = "skuName")
|
||||
private String skuName;
|
||||
|
||||
@NotNull(message = "数量不能为空")
|
||||
@DecimalMin(value = "0", inclusive = false, message = "数量必须大于0")
|
||||
@JsonProperty(value = "qty")
|
||||
private BigDecimal qty;
|
||||
|
||||
@JsonProperty(value = "assignQty")
|
||||
private BigDecimal assignQty;
|
||||
|
||||
@NotBlank(message = "单位不能为空")
|
||||
@JsonProperty(value = "unit")
|
||||
private String unit;
|
||||
|
||||
@NotBlank(message = "线边库位不能为空")
|
||||
@JsonProperty(value = "targetArea")
|
||||
private String targetArea;
|
||||
|
||||
@NotBlank(message = "容器编号不能为空")
|
||||
@JsonProperty(value = "containerCode")
|
||||
private String containerCode;
|
||||
|
||||
@NotNull(message = "配送方式不能为空")
|
||||
@JsonProperty(value = "deliveryMethod")
|
||||
private Integer deliveryMethod;
|
||||
|
||||
@NotBlank(message = "操作人工号不能为空")
|
||||
@JsonProperty(value = "creator")
|
||||
private String creator;
|
||||
|
||||
@NotBlank(message = "操作时间不能为空")
|
||||
@JsonProperty(value = "createTime")
|
||||
private String createTime;
|
||||
|
||||
@NotBlank(message = "来源仓别不能为空")
|
||||
@JsonProperty(value = "sourceHouseCode")
|
||||
private String sourceHouseCode;
|
||||
|
||||
@NotNull(message = "状态不能为空")
|
||||
@JsonProperty(value = "status")
|
||||
private Integer status;
|
||||
|
||||
@JsonProperty(value = "updateName")
|
||||
private String updateName;
|
||||
}
|
||||
|
||||
@@ -114,5 +114,13 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
|
||||
*/
|
||||
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>
|
||||
*/
|
||||
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) {
|
||||
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
|
||||
*/
|
||||
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";
|
||||
/**
|
||||
* 打印机ip
|
||||
|
||||
@@ -43,9 +43,7 @@ public enum IOSEnum {
|
||||
, "移入锁", "3", "移出锁", "4", "其他锁","9"
|
||||
)),
|
||||
//库区类型
|
||||
ST_SECT_TYPE(MapOf.of("主存区", "00", "暂存区", "10", "平库", "90"
|
||||
, "移入锁", "3", "移出锁", "4", "其他锁","9"
|
||||
)),
|
||||
ST_SECT_TYPE(MapOf.of("主存区", "00", "暂存区", "01", "平库", "09")),
|
||||
// 点位状态
|
||||
POINT_STATUS(MapOf.of("无货", "1", "有货", "2" )),
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
source_bill_type,
|
||||
source_load_port,
|
||||
source_billdtl_id,
|
||||
callback_strategy,
|
||||
plan_qty,
|
||||
remark,
|
||||
assign_qty,
|
||||
@@ -36,6 +37,7 @@
|
||||
#{item.source_bill_type},
|
||||
#{item.source_load_port},
|
||||
#{item.source_billdtl_id},
|
||||
#{item.callback_strategy},
|
||||
#{item.plan_qty},
|
||||
#{item.remark},
|
||||
#{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_type(row.getString("source_bill_type"));
|
||||
detail.setSource_billdtl_id(row.getString("source_billdtl_id"));
|
||||
detail.setCallback_strategy(row.getString("callback_strategy"));
|
||||
detail.setPlan_qty(planQty);
|
||||
detail.setSource_load_port(row.getString("load_port"));
|
||||
detail.setRemark(row.getString("remark"));
|
||||
@@ -1086,6 +1087,10 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
.set(IOStorInvDtl::getReal_qty, BigDecimal.ZERO)
|
||||
.in(IOStorInvDtl::getIostorinvdtl_id, dtlSet)
|
||||
);
|
||||
List<IOStorInvDtl> ioStorInvDtls = ioStorInvDtlMapper.selectBatchIds(dtlSet);
|
||||
for (IOStorInvDtl ioStorInvDtl : ioStorInvDtls) {
|
||||
callbackStrategyPublish.callbackStrategy(ioStorInvDtl.getCallback_strategy(),ioStorInvDtl);
|
||||
}
|
||||
//TODO:添加单据更新
|
||||
//更新主表状态
|
||||
ioStorInvMapper.update(ioStorInv, new LambdaUpdateWrapper<>(IOStorInv.class)
|
||||
@@ -1166,15 +1171,13 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
List<AddInvParam> addInvParams = new ArrayList<>();
|
||||
for (IOStorInvDis invDis : disList) {
|
||||
if (invDis.getTask_id() == null && !StringUtils.isEmpty(invDis.getPoint_code())){
|
||||
final SchBasePoint one = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getPoint_code, invDis.getPoint_code()));
|
||||
if (one ==null){
|
||||
String sectCode = iSchBasePointService.getPointRegionMapperSect(invDis.getPoint_code());
|
||||
if (sectCode ==null){
|
||||
throw new BadRequestException("明细完成失败,当前点位未配置所属库区");
|
||||
}
|
||||
String regionCode = one.getRegion_code();
|
||||
//更新库存,查询托盘
|
||||
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())){
|
||||
throw new BadRequestException("明细完成失败,当前调拨目标区域不存在"+invDis.getPoint_code());
|
||||
}
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
<mapper namespace="org.nl.wms.warehouse_manage.inventory.dao.mapper.StInventoryMapper">
|
||||
<select id="queryInventory" resultType="org.nl.wms.warehouse_manage.inventory.dto.StInventoryDto">
|
||||
SELECT
|
||||
s.stor_id as storId,
|
||||
s.stor_code as storCode,
|
||||
s.sect_code as sectCode,
|
||||
g.pcsn as pcsn,
|
||||
s.stor_name as storName,
|
||||
g.material_code as materialCode,
|
||||
SUM(g.frozen_qty) AS frozenQty, -- 可用库存
|
||||
@@ -15,7 +16,13 @@
|
||||
WHERE g.material_code = #{query.materialCode}
|
||||
AND g.status = '02' -- 排除已移除/已禁用的组盘记录
|
||||
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;
|
||||
</select>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import lombok.NoArgsConstructor;
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@@ -15,4 +16,5 @@ import java.math.BigDecimal;
|
||||
public class StInventoryQuery extends BaseQuery {
|
||||
private String materialCode;
|
||||
private String storCode;
|
||||
private List<String> sectCode;
|
||||
}
|
||||
|
||||
@@ -53,13 +53,19 @@ public class DealLLDBBillPmDeamndCallBack implements CallbackStrategy {
|
||||
if (one == null){
|
||||
throw new BadRequestException("需求单不存在");
|
||||
}
|
||||
|
||||
if (one.getStatus().equals(DemandStatus.FINISH.getValue())){
|
||||
return;
|
||||
}
|
||||
final SchBaseRegion region = iSchBaseRegionService.getOne(new LambdaQueryWrapper<SchBaseRegion>()
|
||||
.eq(SchBaseRegion::getRegion_code, one.getProduction_line())
|
||||
.select(SchBaseRegion::getPoint_type_explain));
|
||||
if (region==null){
|
||||
throw new BadRequestException("当前产线未配置对应仓库编码getPoint_type_explain");
|
||||
}
|
||||
if (one.getAssign_qty().intValue()>=one.getQty().intValue()){
|
||||
one.setAssign_qty(param.getAssign_qty());
|
||||
one.setStatus(DemandStatus.FINISH.getValue());
|
||||
this.iPmDemandService.updateById(one);
|
||||
final String now = DateUtil.now();
|
||||
JSONObject callbackData = new JSONObject();
|
||||
callbackData.put("method", "DealLLDBBill");
|
||||
@@ -67,7 +73,7 @@ public class DealLLDBBillPmDeamndCallBack implements CallbackStrategy {
|
||||
// 组装data节点
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("issueStorageOrgUnitNo", "01.09.14"); // 业务状态,可根据实际业务逻辑设置
|
||||
data.put("bizTypeNo", 311); // 业务日期
|
||||
data.put("bizTypeNo", "331"); // 业务日期
|
||||
data.put("receiptStorageOrgUnitNo", "01.09.14"); // 创建人编号,从当前登录用户获取
|
||||
data.put("billNo", param.getIostorinv_id()); // 使用工单编号作为MES单号
|
||||
// 组装明细列表
|
||||
@@ -78,31 +84,27 @@ public class DealLLDBBillPmDeamndCallBack implements CallbackStrategy {
|
||||
entry.put("unitNo", "PCS"); // 序号
|
||||
entry.put("qty", ioStorInvDisDto.getPlan_qty()); // 数量
|
||||
entry.put("materialNo", ioStorInvDisDto.getMaterial_code()); // 来源单据标识
|
||||
entry.put("issueWarehouseNo", region.getPoint_type_explain());
|
||||
entry.put("receiptWarehouseNo", ioStorInvDisDto.getSect_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(one.getId());
|
||||
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(
|
||||
param.getIostorinv_id(),one.getId()
|
||||
one.getId()
|
||||
,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>
|
||||
</el-tooltip>
|
||||
<el-button
|
||||
v-permission="['admin','roles:edit']"
|
||||
:disabled="!showButton"
|
||||
:loading="menuLoading"
|
||||
icon="el-icon-check"
|
||||
@@ -195,7 +194,7 @@ export default {
|
||||
|
||||
const _this = this
|
||||
crudMenu.getMenusByRole(param).then(res => {
|
||||
_this.menus = res
|
||||
_this.menus = res.data
|
||||
|
||||
// 初始化默认选中的key
|
||||
_this.menuIds = []
|
||||
@@ -230,7 +229,8 @@ export default {
|
||||
},
|
||||
menuChange(menu) {
|
||||
// 获取该节点的所有子节点,id 包含自身
|
||||
getChild(menu.menu_id).then(childIds => {
|
||||
getChild(menu.menu_id).then(res => {
|
||||
let childIds = res.data
|
||||
// 判断是否在 menuIds 中,如果存在则删除,否则添加
|
||||
if (this.menuIds.indexOf(menu.menu_id) !== -1) {
|
||||
for (let i = 0; i < childIds.length; i++) {
|
||||
|
||||
@@ -436,9 +436,11 @@ export default {
|
||||
allDiv() {
|
||||
this.loadingAlldiv = true
|
||||
checkoutbill.allDiv(this.mstrow).then(res => {
|
||||
if(res.code === 200) {
|
||||
this.crud.notify('分配成功!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
this.queryTableDtl()
|
||||
this.loadingAlldiv = false
|
||||
}
|
||||
}).catch(() => {
|
||||
this.loadingAlldiv = false
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user