入库部分和接口
This commit is contained in:
@@ -1,22 +1,11 @@
|
||||
package com.ruoyi.api.controller;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.api.domain.ReMaterialParam;
|
||||
import com.ruoyi.api.domain.RequestEnter;
|
||||
import com.ruoyi.api.domain.WmsJobRequest;
|
||||
import com.ruoyi.api.service.IToErpService;
|
||||
import com.ruoyi.api.service.IToWmsService;
|
||||
import com.ruoyi.bas.BasCustomer.domain.BasCustomer;
|
||||
import com.ruoyi.bas.BasProduct.domain.BasProduct;
|
||||
import com.ruoyi.bas.BasSupplier.domain.BasSupplier;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.log.domain.RequestLog;
|
||||
import com.ruoyi.log.service.IRequestLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import com.ruoyi.api.domain.DeliveryNoticeVo;
|
||||
|
||||
/**
|
||||
* 作业统计 Controller
|
||||
@@ -28,6 +17,14 @@ public class ToErpApiController {
|
||||
@Autowired
|
||||
private IToErpService toErpService;
|
||||
|
||||
/**
|
||||
* 接收入出库通知单
|
||||
*/
|
||||
@PostMapping("/receiveDeliveryNotice")
|
||||
public AjaxResult receiveDeliveryNotice(@RequestBody DeliveryNoticeVo deliveryNoticeVo) {
|
||||
return toErpService.receiveDeliveryNotice(deliveryNoticeVo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 回传其他出入库单
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ruoyi.api.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* 出入库通知单-子表接收对象
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class DeliveryNoticeItemVo {
|
||||
/** 行号 */
|
||||
private String lineNo;
|
||||
/** 存货编码 */
|
||||
private String inventoryCode;
|
||||
/** 存货名称 */
|
||||
private String inventoryName;
|
||||
/** 规格型号 */
|
||||
private String specModel;
|
||||
/** 层级关系 */
|
||||
private String levelRelation;
|
||||
/** 上层物料 */
|
||||
private String upperMaterial;
|
||||
/** 顶层物料 */
|
||||
private String topMaterial;
|
||||
/** 批次 */
|
||||
private String lotNo;
|
||||
/** 计量单位 */
|
||||
private String unit;
|
||||
/** 数量 */
|
||||
private String quantity;
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.ruoyi.api.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出入库通知单-主表接收对象
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class DeliveryNoticeVo {
|
||||
/** 合同号 */
|
||||
private String contractNo;
|
||||
/** 销售订单号 */
|
||||
private String salesOrderNo;
|
||||
/** 出库类型(AGV搬运/人工出库/到缓存区等) */
|
||||
private String outType;
|
||||
/** 是否按项目出(Y/N 或 1/0) */
|
||||
private String isProjectOut;
|
||||
/** 单据号 */
|
||||
private String billNo;
|
||||
/** 单据时间,格式:yyyy-MM-dd HH:mm:ss */
|
||||
private String billDate;
|
||||
/** 审核时间,格式:yyyy-MM-dd HH:mm:ss */
|
||||
private String approveDate;
|
||||
/** 单据类型(生产领料/生产退料/产品入库/采购入库等) */
|
||||
private String billType;
|
||||
/** 客商代号 */
|
||||
private String customerId;
|
||||
/** 客商名称 */
|
||||
private String customerName;
|
||||
/** 项目号 */
|
||||
private String projectNo;
|
||||
/** 制单人 */
|
||||
private String createMan;
|
||||
/** 审核人 */
|
||||
private String approveMan;
|
||||
/** 操作类型:1新增 2修改 3删除 */
|
||||
private String opType;
|
||||
/** 仓库编码 */
|
||||
private String warehouseId;
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
/** 子表明细列表 */
|
||||
private List<DeliveryNoticeItemVo> detailList;
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
package com.ruoyi.api.service;
|
||||
|
||||
import com.ruoyi.bas.BasCustomer.domain.BasCustomer;
|
||||
import com.ruoyi.api.domain.DeliveryNoticeVo;
|
||||
import com.ruoyi.bas.BasProduct.domain.BasProduct;
|
||||
import com.ruoyi.bas.BasSupplier.domain.BasSupplier;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 作业统计 Service 接口
|
||||
*/
|
||||
public interface IToErpService {
|
||||
|
||||
AjaxResult receiveDeliveryNotice(DeliveryNoticeVo deliveryNoticeVo);
|
||||
|
||||
|
||||
void callbackTransferBill();
|
||||
|
||||
|
||||
@@ -7,19 +7,33 @@ import com.ruoyi.api.service.IToErpService;
|
||||
import com.ruoyi.bas.BasProduct.domain.BasProduct;
|
||||
import com.ruoyi.bas.basJobId.service.IBasJobIdService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
import com.ruoyi.in.erp.domain.TransferBillCallback;
|
||||
import com.ruoyi.in.erp.service.ITransferBillCallbackService;
|
||||
import com.ruoyi.in.stockin.domain.InStockin;
|
||||
import com.ruoyi.in.stockin.service.IInStockinService;
|
||||
import com.ruoyi.in.stockindetail.domain.InStockinDetail;
|
||||
import com.ruoyi.in.stockindetail.service.IInStockinDetailService;
|
||||
import com.ruoyi.job.mydojob.service.IMydoJobService;
|
||||
import com.ruoyi.job.mydojobdetail.domain.MydoJobDetail;
|
||||
import com.ruoyi.job.mydojobdetail.service.IMydoJobDetailService;
|
||||
import com.ruoyi.log.domain.RequestLog;
|
||||
import com.ruoyi.log.service.IRequestLogService;
|
||||
import com.ruoyi.out.outStockout.domain.OutStockout;
|
||||
import com.ruoyi.out.outStockout.service.IOutStockoutService;
|
||||
import com.ruoyi.out.outStockoutDetail.domain.OutStockoutDetail;
|
||||
import com.ruoyi.out.outStockoutDetail.service.IOutStockoutDetailService;
|
||||
import com.ruoyi.out.outStockoutDetail.mapper.OutStockoutDetailMapper;
|
||||
import com.ruoyi.out.outStockout.mapper.OutStockoutMapper;
|
||||
import org.apache.pdfbox.pdmodel.interactive.viewerpreferences.PDViewerPreferences;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 作业统计 Service 实现
|
||||
@@ -40,12 +54,206 @@ public class ToErpServiceImpl implements IToErpService {
|
||||
@Autowired
|
||||
private IRequestLogService requestLogService;
|
||||
|
||||
@Autowired
|
||||
private IInStockinService inStockinService;
|
||||
@Autowired
|
||||
private IInStockinDetailService inStockinDetailService;
|
||||
|
||||
@Autowired
|
||||
private IOutStockoutService outStockoutService;
|
||||
|
||||
@Autowired
|
||||
private IOutStockoutDetailService outStockoutDetailService;
|
||||
|
||||
private static final String TO_ERP_URL = "http://192.168.1.100:8080/api/";
|
||||
|
||||
//todo 需要调试
|
||||
private static final String WORKSHOP_INBOUND_ORDER_URL = TO_ERP_URL+"TRANSACTION_DOC";
|
||||
//todo 需要调试
|
||||
private static final String OTHER_IN_OUTBOUND_ORDER_URL = TO_ERP_URL+"WIP_TRANSFER_DOC";
|
||||
/**
|
||||
* 处理送货通知单的业务逻辑
|
||||
* 根据单据类型和操作类型进行入库单或出库单的增删改操作
|
||||
*
|
||||
* @param deliveryNoticeVo 送货通知单数据对象,包含单据基本信息和明细列表
|
||||
* @return AjaxResult 操作结果,包含成功或错误信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult receiveDeliveryNotice(DeliveryNoticeVo deliveryNoticeVo) {
|
||||
|
||||
if (deliveryNoticeVo == null || deliveryNoticeVo.getDetailList() == null || deliveryNoticeVo.getDetailList().isEmpty()){
|
||||
return AjaxResult.error("单据或明细不能为空");
|
||||
}
|
||||
String billType = deliveryNoticeVo.getBillType();
|
||||
String opType = deliveryNoticeVo.getOpType();
|
||||
// String status = deliveryNoticeVo.getStatus();
|
||||
int type = 0;
|
||||
try { type = Integer.parseInt(billType); } catch (Exception ignored) {}
|
||||
|
||||
// 处理入库单相关操作(单据类型1-4)
|
||||
if (type >= 1 && type <= 4) {
|
||||
InStockin param = new InStockin();
|
||||
param.setStockinId(deliveryNoticeVo.getBillNo());
|
||||
List<InStockin> existList = inStockinService.selectInStockinListApi(param);
|
||||
InStockin exist = (existList != null && !existList.isEmpty()) ? existList.get(0) : null;
|
||||
|
||||
// 删除操作(操作类型3)
|
||||
if ("3".equals(opType)) {
|
||||
if (exist == null) {
|
||||
return AjaxResult.error("单据不存在");
|
||||
}
|
||||
if ("3".equals(exist.getStatus())) {
|
||||
return AjaxResult.error("单据已执行,禁止删除");
|
||||
}
|
||||
if (exist.getStockinGuid() != null) {
|
||||
inStockinDetailService.deleteInStockinDetailByStockinGuid(exist.getStockinGuid());
|
||||
inStockinService.deleteInStockinByStockinGuid(exist.getStockinGuid());
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
// 新增或修改操作(操作类型1或2)
|
||||
if ("2".equals(opType) || "1".equals(opType)) {
|
||||
if ("2".equals(opType) && exist == null) {
|
||||
return AjaxResult.error("单据不存在,无法修改");
|
||||
}
|
||||
if (exist != null && "3".equals(exist.getStatus()) && "2".equals(opType)) {
|
||||
return AjaxResult.error("单据已执行,禁止修改");
|
||||
}
|
||||
InStockin inStockin = exist != null ? exist : new InStockin();
|
||||
if (exist == null) {
|
||||
inStockin.setStockinGuid(UUID.randomUUID().toString());
|
||||
}
|
||||
inStockin.setStockinId(deliveryNoticeVo.getBillNo());
|
||||
inStockin.setInType(deliveryNoticeVo.getBillType());
|
||||
inStockin.setCreateDate(deliveryNoticeVo.getBillDate());
|
||||
inStockin.setCreateManId(deliveryNoticeVo.getCreateMan());
|
||||
inStockin.setStatus("1");
|
||||
inStockin.setWarehouseId(deliveryNoticeVo.getWarehouseId());
|
||||
// inStockin.setErpBill(deliveryNoticeVo.getBillNo());
|
||||
inStockin.setStockSource("1");
|
||||
inStockin.setDepartmentNo(deliveryNoticeVo.getProjectNo());//项目号
|
||||
inStockin.setSupplierNo(deliveryNoticeVo.getCustomerId());//供应商编码
|
||||
inStockin.setClassNo(deliveryNoticeVo.getCustomerName());//供应商名称
|
||||
inStockin.setSpare1(deliveryNoticeVo.getContractNo());//合同号
|
||||
inStockin.setSpare2(deliveryNoticeVo.getSalesOrderNo());//销售订单号
|
||||
inStockin.setSpare3(deliveryNoticeVo.getApproveDate());//审核时间
|
||||
inStockin.setSpare4(deliveryNoticeVo.getApproveMan());//审核人
|
||||
inStockin.setSpare5(deliveryNoticeVo.getRemark());
|
||||
if (exist == null) {
|
||||
inStockinService.insertInStockin(inStockin);
|
||||
} else {
|
||||
inStockinService.updateInStockin(inStockin);
|
||||
inStockinDetailService.deleteInStockinDetailByStockinGuid(inStockin.getStockinGuid());
|
||||
}
|
||||
List<DeliveryNoticeItemVo> items = deliveryNoticeVo.getDetailList();
|
||||
List<InStockinDetail> detailList = new ArrayList<>();
|
||||
int i = 1;
|
||||
for (DeliveryNoticeItemVo item : items) {
|
||||
InStockinDetail detail = new InStockinDetail();
|
||||
detail.setStockinGuid(inStockin.getStockinGuid());
|
||||
detail.setStockinDetailId(item.getLineNo());
|
||||
detail.setStockinId(inStockin.getStockinId());
|
||||
detail.setProductId(item.getInventoryCode());
|
||||
detail.setProductName(item.getInventoryName());
|
||||
detail.setSpec(item.getSpecModel());
|
||||
detail.setUnit(item.getUnit());
|
||||
detail.setQuantity(item.getQuantity());
|
||||
detail.setLotNo(item.getLotNo());
|
||||
detail.setStockStatus("0");
|
||||
detail.setAssignNum("0");
|
||||
detail.setScanNum("0");
|
||||
detailList.add(detail);
|
||||
i++;
|
||||
}
|
||||
inStockinDetailService.insertInStockinDetailList(detailList);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
// 处理出库单相关操作(单据类型5-7)
|
||||
else if (type >= 5 && type <= 7) {
|
||||
OutStockout param = new OutStockout();
|
||||
param.setStockoutId(deliveryNoticeVo.getBillNo());
|
||||
List<OutStockout> outList = outStockoutService.selectOutStockoutList(param);
|
||||
OutStockout exist = (outList != null && !outList.isEmpty()) ? outList.get(0) : null;
|
||||
|
||||
// 删除操作(操作类型3)
|
||||
if ("3".equals(opType)) {
|
||||
if (exist == null) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
if ("3".equals(exist.getStatus())) {
|
||||
return AjaxResult.error("单据已完成,禁止删除");
|
||||
}
|
||||
OutStockoutDetail q = new OutStockoutDetail();
|
||||
q.setStockoutId(deliveryNoticeVo.getBillNo());
|
||||
List<OutStockoutDetail> details = outStockoutDetailService.selectOutStockoutDetailList(q);
|
||||
if (details != null && !details.isEmpty()) {
|
||||
String[] ids = details.stream().map(OutStockoutDetail::getStockoutDetailId).toArray(String[]::new);
|
||||
outStockoutDetailService.deleteOutStockoutDetailByStockoutDetailIds(ids);
|
||||
}
|
||||
outStockoutService.deleteOutStockoutByStockoutGuid(exist.getStockoutGuid());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
// 新增或修改操作(操作类型1或2)
|
||||
if ("2".equals(opType) || "1".equals(opType)) {
|
||||
if ("2".equals(opType) && exist == null) {
|
||||
return AjaxResult.error("单据不存在,无法修改");
|
||||
}
|
||||
if (exist != null && "3".equals(exist.getStatus())) {
|
||||
return AjaxResult.error("单据已完成,禁止修改");
|
||||
}
|
||||
OutStockout out = exist != null ? exist : new OutStockout();
|
||||
if (exist == null) {
|
||||
out.setStockoutGuid(UUID.randomUUID().toString());
|
||||
}
|
||||
out.setStockoutId(deliveryNoticeVo.getBillNo());
|
||||
out.setOutType(deliveryNoticeVo.getOutType());
|
||||
out.setCreateDate(deliveryNoticeVo.getBillDate());
|
||||
out.setCreateManId(deliveryNoticeVo.getCreateMan());
|
||||
out.setStatus("1");
|
||||
out.setWarehouseId(deliveryNoticeVo.getWarehouseId());
|
||||
out.setStockoutSource("1");
|
||||
out.setDepartmentNo(deliveryNoticeVo.getProjectNo());
|
||||
out.setCustomerNo(deliveryNoticeVo.getCustomerId());
|
||||
if (exist == null) {
|
||||
outStockoutService.insertOutStockout(out);
|
||||
} else {
|
||||
outStockoutService.updateOutStockout(out);
|
||||
OutStockoutDetail q2 = new OutStockoutDetail();
|
||||
q2.setStockoutId(deliveryNoticeVo.getBillNo());
|
||||
List<OutStockoutDetail> oldDetails = outStockoutDetailService.selectOutStockoutDetailList(q2);
|
||||
if (oldDetails != null && !oldDetails.isEmpty()) {
|
||||
String[] ids = oldDetails.stream().map(OutStockoutDetail::getStockoutDetailId).toArray(String[]::new);
|
||||
outStockoutDetailService.deleteOutStockoutDetailByStockoutDetailIds(ids);
|
||||
}
|
||||
}
|
||||
int i = 1;
|
||||
for (DeliveryNoticeItemVo item : deliveryNoticeVo.getDetailList()) {
|
||||
OutStockoutDetail d = new OutStockoutDetail();
|
||||
String line = item.getLineNo() != null ? item.getLineNo() : String.valueOf(i);
|
||||
d.setStockoutDetailId(out.getStockoutId()+"-"+line);
|
||||
d.setStockoutGuid(out.getStockoutGuid());
|
||||
d.setStockoutId(out.getStockoutId());
|
||||
d.setProductId(item.getInventoryCode());
|
||||
d.setLotNo(item.getLotNo());
|
||||
try {
|
||||
d.setQuantity(new BigDecimal(item.getQuantity()));
|
||||
} catch (Exception e) {
|
||||
d.setQuantity(BigDecimal.ZERO);
|
||||
}
|
||||
outStockoutDetailService.insertOutStockoutDetail(d);
|
||||
i++;
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
return AjaxResult.error("不支持的单据类型或操作类型");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,6 +27,16 @@ public class InstockInVo {
|
||||
@NotNull
|
||||
private String erpBill;
|
||||
|
||||
private String departmentNo;
|
||||
|
||||
private String spare1;
|
||||
|
||||
private String spare2;
|
||||
|
||||
private String spare5;
|
||||
|
||||
private String classNo;
|
||||
|
||||
|
||||
private List<BasProduct> productVoList;
|
||||
|
||||
|
||||
@@ -100,14 +100,20 @@ public class InStockinServiceImpl implements IInStockinService
|
||||
inStockin.setStockinGuid(rkdId);
|
||||
inStockin.setStockinId(rkdId);
|
||||
inStockin.setCreateDate(DateUtil.formatDateTime(DateUtil.date()));
|
||||
inStockin.setCreateManId(Convert.toStr(SecurityUtils.getUserId()));
|
||||
inStockin.setDepartmentNo(Convert.toStr(SecurityUtils.getDeptId()));
|
||||
inStockin.setSpare3(DateUtil.formatDateTime(DateUtil.date()));
|
||||
inStockin.setCreateManId(Convert.toStr(SecurityUtils.getUsername()));
|
||||
inStockin.setSpare4(Convert.toStr(SecurityUtils.getUserId()));
|
||||
inStockin.setSupplierNo(inStockinVo.getSupplierId());
|
||||
inStockin.setErpBill(inStockinVo.getErpBill());
|
||||
inStockin.setInType(inStockinVo.getInType());
|
||||
inStockin.setWarehouseId(inStockinVo.getWarehouseId());
|
||||
inStockin.setDepartmentNo(inStockinVo.getDepartmentNo());
|
||||
inStockin.setSpare1(inStockinVo.getSpare1());
|
||||
inStockin.setSpare2(inStockinVo.getSpare2());
|
||||
inStockin.setSpare5(inStockinVo.getSpare5());
|
||||
inStockin.setClassNo(inStockinVo.getClassNo());
|
||||
inStockin.setStatus("1");
|
||||
inStockin.setStockSource("1");
|
||||
inStockin.setStockSource("0");
|
||||
inStockinMapper.insertInStockin(inStockin);
|
||||
for (int i = 1; i <= productVoList.size(); i++) {
|
||||
BasProduct basProduct = productVoList.get(i-1);
|
||||
|
||||
@@ -67,7 +67,7 @@ public interface MydoJobDetailMapper
|
||||
|
||||
List<MydoJobDetail> selectMydoJobDetailListByJobId(String jobId);
|
||||
|
||||
List<MydoJobDetail> selectMydoJobDetailListByExit(MydoJob mydoJob);
|
||||
List<MydoJobDetail> selectMydoJobDetailListByTrayCode(MydoJob mydoJob);
|
||||
|
||||
List<MydoJobDetail> selectPdMydoJobDetailListByExit(MydoJob mydoJob);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public interface IMydoJobDetailService
|
||||
|
||||
List<MydoJobDetail> selectMydoJobDetailListByJobId(String jobId);
|
||||
|
||||
List<MydoJobDetail> selectMydoJobDetailListByExit(MydoJob mydoJob);
|
||||
List<MydoJobDetail> selectMydoJobDetailListByTrayCode(MydoJob mydoJob);
|
||||
|
||||
List<MydoJobDetail> selectPdMydoJobDetailListByExit(MydoJob mydoJob);
|
||||
}
|
||||
|
||||
@@ -116,8 +116,8 @@ public class MydoJobDetailServiceImpl implements IMydoJobDetailService
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MydoJobDetail> selectMydoJobDetailListByExit(MydoJob mydoJob) {
|
||||
return mydoJobDetailMapper.selectMydoJobDetailListByExit(mydoJob);
|
||||
public List<MydoJobDetail> selectMydoJobDetailListByTrayCode(MydoJob mydoJob) {
|
||||
return mydoJobDetailMapper.selectMydoJobDetailListByTrayCode(mydoJob);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,8 +6,12 @@ import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.in.stockindetail.domain.InStockinDetail;
|
||||
import com.ruoyi.in.stockindetail.service.IInStockinDetailService;
|
||||
import com.ruoyi.pda.domain.TrayCodeMakeSure;
|
||||
import com.ruoyi.pda.domain.TrayCodeMsg;
|
||||
import com.ruoyi.pda.service.PdaService;
|
||||
import com.ruoyi.stock.stock.domain.BasStock;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -17,6 +21,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/pda")
|
||||
@Slf4j
|
||||
@@ -24,23 +30,79 @@ public class PdaController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private PdaService pdaService;
|
||||
@Autowired
|
||||
private IInStockinDetailService iInStockinDetailService;
|
||||
|
||||
/**
|
||||
* 查询是否有半满托盘
|
||||
*/
|
||||
@RequestMapping("/selectHasHalfTray")
|
||||
@ResponseBody
|
||||
public List<BasStock> selectHasHalfTray(String inStockinDetailId) {
|
||||
return pdaService.selectHasHalfTray(inStockinDetailId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过单据码查询物料详情
|
||||
*/
|
||||
@RequestMapping("/selectDetailById")
|
||||
@ResponseBody
|
||||
public AjaxResult selectDetailById(String inStockinDetailId) {
|
||||
InStockinDetail inStockinDetail = iInStockinDetailService.selectInStockinDetailByStockinDetailId(inStockinDetailId);
|
||||
return AjaxResult.success(inStockinDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 半盘出库
|
||||
*/
|
||||
|
||||
@RequestMapping("/halfTrayOut")
|
||||
@ResponseBody
|
||||
public AjaxResult halfTrayOut(String trayCode) {
|
||||
return pdaService.halfTrayOut(trayCode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过托盘码查询作业或trayMsg
|
||||
*/
|
||||
@RequestMapping("/selectMsgByTray")
|
||||
@ResponseBody
|
||||
public Object selectMsgByTray(@RequestBody TrayCodeMsg trayCodeMsg) {
|
||||
return pdaService.selectMsgByTray(trayCodeMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑盘
|
||||
*/
|
||||
@RequestMapping("/bindTray")
|
||||
@ResponseBody
|
||||
public AjaxResult bindTray(@RequestBody TrayCodeMsg trayCodeMsg) {
|
||||
return pdaService.bindTray(trayCodeMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认入库
|
||||
*/
|
||||
@RequestMapping("/confirmIn")
|
||||
@ResponseBody
|
||||
public AjaxResult confirmIn(String trayCode) {
|
||||
return pdaService.confirmIn(trayCode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 入库扫码生成作业
|
||||
*/
|
||||
|
||||
/**
|
||||
* 入库扫码生成作业
|
||||
*/
|
||||
@RequestMapping("/addInJob")
|
||||
@ResponseBody
|
||||
public AjaxResult addInJob(@RequestBody RequestEnter requestEnter) {
|
||||
return pdaService.addInJob(requestEnter);
|
||||
}
|
||||
|
||||
@RequestMapping("/selectDetailByTray")
|
||||
@ResponseBody
|
||||
public AjaxResult selectDetailByTray(@RequestBody TrayCodeMakeSure trayCodeMakeSure) {
|
||||
return pdaService.selectDetailByTray(trayCodeMakeSure);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/selectDetailByPDTray")
|
||||
@ResponseBody
|
||||
@@ -64,9 +126,9 @@ public class PdaController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 盘点出库确认
|
||||
*
|
||||
* @param trayCodeMakeSure 托盘信息
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,14 @@ import java.util.HashMap;
|
||||
|
||||
public interface PdaMapper {
|
||||
|
||||
void bindTray(HashMap<String, Object> map);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
void emptyTrayIn(HashMap<String, Object> map);
|
||||
|
||||
void emptyBoxIn(HashMap<String, Object> map);
|
||||
|
||||
@@ -6,16 +6,41 @@ import com.ruoyi.bas.container.domain.BasContainer;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.pda.domain.TrayCodeMakeSure;
|
||||
import com.ruoyi.pda.domain.TrayCodeMsg;
|
||||
import com.ruoyi.stock.stock.domain.BasStock;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public interface PdaService {
|
||||
|
||||
|
||||
/**
|
||||
* 查询是否有半满托盘
|
||||
* @param inStockinDetailId
|
||||
* @return
|
||||
*/
|
||||
List<BasStock> selectHasHalfTray(String inStockinDetailId);
|
||||
|
||||
AjaxResult halfTrayOut(String trayCode);
|
||||
|
||||
Object selectMsgByTray(TrayCodeMsg trayCodeMsg);
|
||||
|
||||
AjaxResult bindTray(TrayCodeMsg trayCodeMsg);
|
||||
|
||||
AjaxResult confirmIn(String trayCode);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public AjaxResult addInJob(RequestEnter requestEnter);
|
||||
|
||||
public AjaxResult selectDetailByTray(TrayCodeMakeSure trayCodeMakeSure);
|
||||
|
||||
|
||||
public AjaxResult selectDetailByPDTray(TrayCodeMakeSure trayCodeMakeSure);
|
||||
|
||||
AjaxResult outMakeSure(TrayCodeMakeSure trayCodeMakeSure);
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.ruoyi.check.commit.service.ICheckCommitRecordService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
|
||||
import com.ruoyi.in.stockindetail.domain.InStockinDetail;
|
||||
import com.ruoyi.in.stockindetail.service.IInStockinDetailService;
|
||||
import com.ruoyi.job.mydojob.domain.MydoJob;
|
||||
import com.ruoyi.job.mydojob.service.IMydoJobService;
|
||||
@@ -18,8 +19,12 @@ import com.ruoyi.job.mydojobdetail.domain.MydoJobDetail;
|
||||
import com.ruoyi.job.mydojobdetail.service.IMydoJobDetailService;
|
||||
import com.ruoyi.job.mydojobdetail.service.impl.MydoJobDetailServiceImpl;
|
||||
import com.ruoyi.pda.domain.TrayCodeMakeSure;
|
||||
import com.ruoyi.pda.domain.TrayCodeMsg;
|
||||
import com.ruoyi.pda.mapper.PdaMapper;
|
||||
import com.ruoyi.pda.trayMsg.domain.TrayMsg;
|
||||
import com.ruoyi.pda.trayMsg.service.ITrayMsgService;
|
||||
import com.ruoyi.stock.stock.domain.BasStock;
|
||||
import com.ruoyi.stock.stock.mapper.BasStockMapper;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -49,6 +54,68 @@ public class PdaServiceImp implements PdaService {
|
||||
private IMydoJobDetailService mydoJobDetailService;
|
||||
@Autowired
|
||||
private IToWcsService toWcsService;
|
||||
@Autowired
|
||||
private BasStockMapper basStockMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<BasStock> selectHasHalfTray(String inStockinDetailId) {
|
||||
InStockinDetail inStockinDetail = inStockinDetailService.selectInStockinDetailByStockinDetailId(inStockinDetailId);
|
||||
List<BasStock> hasHalfTray = basStockMapper.selectHasHalfTray(inStockinDetail);
|
||||
return hasHalfTray;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult halfTrayOut(String trayCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object selectMsgByTray(TrayCodeMsg trayCodeMsg) {
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
mydoJob.setTrayCode(trayCodeMsg.getTrayCode());
|
||||
//todo 半盘出库作业类型
|
||||
mydoJob.setInOrOut("");
|
||||
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailListByTrayCode(mydoJob);
|
||||
if(mydoJobDetails.size()==0){
|
||||
TrayMsg trayMsg = new TrayMsg();
|
||||
trayMsg.setTrayCode(trayCodeMsg.getTrayCode());
|
||||
List<TrayMsg> trayMsgList = trayMsgService.selectTrayMsgList(trayMsg);
|
||||
return trayMsgList;
|
||||
}else{
|
||||
return mydoJobDetails;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult bindTray(TrayCodeMsg trayCodeMsg) {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_tray_code", trayCodeMsg.getTrayCode());
|
||||
map.put("v_stockin_detail_id", trayCodeMsg.getStockinDetailId());
|
||||
map.put("v_quantity", Integer.valueOf(trayCodeMsg.getInQuantity()));
|
||||
pdaMapper.bindTray(map);
|
||||
if("10".equals(map.get("v_result").toString())){
|
||||
return AjaxResult.success();
|
||||
}else{
|
||||
return AjaxResult.error(map.get("v_resultmsg").toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult confirmIn(String trayCode) {
|
||||
//如果有出库作业,修改作业类型改为合盘入库类型
|
||||
//如果没有出库作业,正常生成入库作业
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@@ -70,19 +137,8 @@ public class PdaServiceImp implements PdaService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult selectDetailByTray(TrayCodeMakeSure trayCodeMakeSure) {
|
||||
String trayCode = trayCodeMakeSure.getTrayCode();
|
||||
String[] split = trayCode.split(" ");
|
||||
String productId = split[8].substring(10);
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
mydoJob.setExitId(trayCodeMakeSure.getExitId());
|
||||
mydoJob.setProductId(productId);
|
||||
mydoJob.setStatus("3");
|
||||
mydoJob.setInOrOut("21");
|
||||
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailListByExit(mydoJob);
|
||||
return AjaxResult.success(mydoJobDetails);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult selectDetailByPDTray(TrayCodeMakeSure trayCodeMakeSure) {
|
||||
@@ -104,12 +160,12 @@ public class PdaServiceImp implements PdaService {
|
||||
mydoJob.setProductId(productId);
|
||||
mydoJob.setStatus("3");
|
||||
mydoJob.setInOrOut("21");
|
||||
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailListByExit(mydoJob);
|
||||
if(mydoJobDetails.size()==0){
|
||||
return AjaxResult.error("该物料没有出库作业,请检查");
|
||||
}
|
||||
// List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailListByExit(mydoJob);
|
||||
// if(mydoJobDetails.size()==0){
|
||||
// return AjaxResult.error("该物料没有出库作业,请检查");
|
||||
// }
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_tray_code", mydoJobDetails.get(0).getTrayCode());
|
||||
// map.put("v_tray_code", mydoJobDetails.get(0).getTrayCode());
|
||||
pdaMapper.outMakeSure(map);
|
||||
String result = map.get("v_result").toString();
|
||||
if ("10".equals(result)) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.stock.stock.mapper;
|
||||
|
||||
import com.ruoyi.in.stockindetail.domain.InStockinDetail;
|
||||
import com.ruoyi.stock.stock.domain.BasStock;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -70,4 +71,6 @@ public interface BasStockMapper
|
||||
void resetPdRecord();
|
||||
|
||||
List<BasStock> getStockBySerial(String trayCode);
|
||||
|
||||
List<BasStock> selectHasHalfTray(InStockinDetail inStockinDetail);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ spring:
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:sqlserver://172.16.2.170:1433;databaseName=FT517-wms;encrypt=true;trustServerCertificate=true;
|
||||
url: jdbc:sqlserver://172.16.2.170:1433;databaseName=FT546-wms;encrypt=true;trustServerCertificate=true;
|
||||
username: sa
|
||||
password: Flrd0914.
|
||||
# 从库数据源
|
||||
|
||||
@@ -50,15 +50,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
is2.spare4,
|
||||
is2.spare3,
|
||||
is2.spare5,
|
||||
bw.warehouse_name,
|
||||
bs.supplier_name,
|
||||
sd.dept_name ,
|
||||
su.user_name
|
||||
bw.warehouse_name
|
||||
from in_stockin is2
|
||||
left join bas_warehouse bw on is2.warehouse_id = bw.warehouse_id
|
||||
left join bas_supplier bs on bs.supplier_no = is2.supplier_no
|
||||
left join sys_dept sd on is2.department_no = sd.dept_id
|
||||
left join sys_user su on su.user_id = is2.create_man_id
|
||||
-- left join bas_supplier bs on bs.supplier_no = is2.supplier_no
|
||||
-- left join sys_dept sd on is2.department_no = sd.dept_id
|
||||
-- left join sys_user su on su.user_id = is2.create_man_id
|
||||
</sql>
|
||||
|
||||
<select id="selectInStockinList" parameterType="InStockin" resultMap="InStockinResult">
|
||||
@@ -74,12 +71,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="finishDate != null and finishDate != ''"> and is2.create_date <= #{finishDate}</if>
|
||||
<if test="erpBill != null and erpBill != ''"> and is2.erp_bill = #{erpBill}</if>
|
||||
<if test="stockSource != null and stockSource != ''"> and is2.stock_source = #{stockSource}</if>
|
||||
<if test="departmentNo != null and departmentNo != ''"> and is2.department_no = #{departmentNo}</if>
|
||||
<if test="departmentNo != null and departmentNo != ''"> and is2.department_no like concat('%', #{departmentNo},'%')</if>
|
||||
<if test="customerNo != null and customerNo != ''"> and is2.customer_no = #{customerNo}</if>
|
||||
<if test="classNo != null and classNo != ''"> and is2.class_no = #{classNo}</if>
|
||||
<if test="supplierNo != null and supplierNo != ''"> and is2.supplier_no = #{supplierNo}</if>
|
||||
<if test="spare1 != null and spare1 != ''"> and is2.spare1 = #{spare1}</if>
|
||||
<if test="spare2 != null and spare2 != ''"> and is2.spare2 = #{spare2}</if>
|
||||
<if test="spare1 != null and spare1 != ''"> and is2.spare1 like concat('%', #{spare1},'%')</if>
|
||||
<if test="spare2 != null and spare2 != ''"> and is2.spare2 like concat('%', #{spare2},'%')</if>
|
||||
<if test="spare4 != null and spare4 != ''"> and is2.spare4 = #{spare4}</if>
|
||||
<if test="spare3 != null and spare3 != ''"> and is2.spare3 = #{spare3}</if>
|
||||
<if test="spare5 != null and spare5 != ''"> and is2.spare5 = #{spare5}</if>
|
||||
|
||||
@@ -326,7 +326,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
delete from mydo_job_detail where job_id = #{jobId}
|
||||
</delete>
|
||||
|
||||
<select id="selectMydoJobDetailListByExit" parameterType="MydoJob" resultMap="MydoJobDetailResult">
|
||||
<select id="selectMydoJobDetailListByTrayCode" parameterType="MydoJob" resultMap="MydoJobDetailResult">
|
||||
select mjd.job_detail_id,
|
||||
mjd.job_id,
|
||||
mjd.stock_id,
|
||||
@@ -368,10 +368,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from mydo_job_detail mjd
|
||||
left join bas_product bp on mjd.product_id = bp.product_id
|
||||
left join mydo_job mj on mjd.job_id = mj.job_id
|
||||
where mj.exit_id=#{exitId}
|
||||
where mj.tray_code=#{trayCode}
|
||||
and mj.status='3'
|
||||
and mj.execution_phase=2
|
||||
and mjd.product_id=#{productId}
|
||||
and mj.in_or_out=#{inOrOut}
|
||||
|
||||
</select>
|
||||
|
||||
@@ -3,6 +3,23 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.pda.mapper.PdaMapper">
|
||||
|
||||
<select id="bindTray" parameterType="java.util.Map" statementType="CALLABLE">
|
||||
{call proc_bind_tray(
|
||||
#{v_tray_code,mode=IN,jdbcType=VARCHAR},
|
||||
#{v_stockin_detail_id,mode=IN,jdbcType=VARCHAR},
|
||||
#{v_quantity,mode=IN,jdbcType=INTEGER},
|
||||
#{v_result,mode=OUT,jdbcType=INTEGER},
|
||||
#{v_resultmsg,mode=OUT,jdbcType=VARCHAR}
|
||||
)}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="outMakeSure" parameterType="java.util.Map" statementType="CALLABLE">
|
||||
{call proc_out_makesure(
|
||||
#{v_tray_code,mode=IN,jdbcType=VARCHAR},
|
||||
|
||||
@@ -248,4 +248,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="getStockBySerial" parameterType="String" resultMap="BasStockResult">
|
||||
select * from bas_stock where tray_code = #{trayCode}
|
||||
</select>
|
||||
|
||||
<select id="selectHasHalfTray" parameterType="InStockinDetail" resultMap="BasStockResult">
|
||||
select distinct bs.tray_code,bs.cargo_space_id from bas_stock bs left join bas_cargo_sapce bcs on bs.cargo_space_id=bcs.cargo_space_id where bs.spare4=#{spare4} and bs.product_id=#{productId} and bs.spare2=#{spare2} and bs.model=0 and bcs.status=2
|
||||
union
|
||||
select distinct bs.tray_code,bs.cargo_space_id from bas_stock bs left join bas_cargo_sapce bcs on bs.cargo_space_id=bcs.cargo_space_id where bs.spare4=#{spare4} and bs.spare2=#{spare2} and bs.model=0 and bcs.status=2
|
||||
UNION
|
||||
select distinct bs.tray_code,bs.cargo_space_id from bs left join bas_cargo_sapce bcs on bs.cargo_space_id=bcs.cargo_space_id where bs.spare4=#{spare4} and bs.model=0 and bcs.status=2
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user