收货单增加存储SAP回来的物料凭证

This commit is contained in:
彭枝刚 2024-12-04 14:34:31 +08:00
parent 41c44a9578
commit 312a7a56ac
5 changed files with 70 additions and 73 deletions

View File

@ -2,12 +2,10 @@ package com.foreverwin.mom.wms.api.feign;
import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mom.common.core.util.R;
import com.foreverwin.mom.common.security.annotation.Inner;
import com.foreverwin.mom.wms.entity.DocumentDetailed;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import java.util.List;
@ -24,7 +22,7 @@ public interface RemotePoService {
R<JSONObject> dealPoDataLogic(@RequestBody JSONObject messageObj);
@PostMapping("/po-order/api/saveDocumentData")
R<String> saveDocumentData(@RequestBody List<DocumentDetailed> zwDocumentDetailList) throws Exception;
R saveDocumentData(@RequestBody List<DocumentDetailed> zwDocumentDetailList);
@PostMapping("/po-order/api/cancelDocumentNo")
R cancelDocumentNo(@RequestBody DocumentDetailed documentDetailed);

View File

@ -301,6 +301,9 @@ public class DocumentDetailed extends Model<DocumentDetailed> {
@TableField(exist = false)
private String storagLocation;
@TableField(exist = false)
private String materialDocument;
/**

View File

@ -1,33 +1,26 @@
package com.foreverwin.mom.wms.controller;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.foreverwin.mom.common.core.util.R;
import com.foreverwin.mom.common.security.annotation.Inner;
import com.foreverwin.mom.wms.entity.DocumentDetailed;
import io.swagger.annotations.ApiOperation;
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
import com.foreverwin.iep.common.base.FrontPage;
import com.foreverwin.mom.common.core.util.R;
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
import com.foreverwin.mom.common.log.annotation.SysLog;
import com.foreverwin.mom.wms.entity.DocumentDetailed;
import com.foreverwin.mom.wms.entity.PoOrder;
import com.foreverwin.mom.wms.service.PoOrderDetailService;
import com.foreverwin.mom.wms.service.PoOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import org.springframework.web.bind.annotation.*;
/**
* DN单主表
*
@ -40,20 +33,20 @@ import org.springframework.web.bind.annotation.*;
@Api(value = "po-order", tags = "PO单管理")
public class PoOrderController {
private final PoOrderService poOrderService;
private final PoOrderDetailService poOrderDetailService;
private final PoOrderService poOrderService;
private final PoOrderDetailService poOrderDetailService;
@ApiOperation(value = "收货登记-同步采购订单", notes = "收货登记-同步采购订单")
@PostMapping("/api/dealPoDataLogic" )
@SysLog("收货登记-同步采购订单" )
@ApiOperation(value = "收货登记-同步采购订单", notes = "收货登记-同步采购订单")
@PostMapping("/api/dealPoDataLogic")
@SysLog("收货登记-同步采购订单")
public R<JSONObject> dealPoDataLogic(@RequestBody JSONObject messageObj) {
return R.ok(poOrderService.dealPoDataLogic(messageObj));
}
@ApiOperation(value = "收货登记-采购单查询明细", notes = "收货登记-采购单查询明细")
@GetMapping("/getDetailByPo/{po}" )
@SysLog("收货登记-采购单查询明细" )
public R getDetailByPo(@PathVariable("po" ) String po) {
@ApiOperation(value = "收货登记-采购单查询明细", notes = "收货登记-采购单查询明细")
@GetMapping("/getDetailByPo/{po}")
@SysLog("收货登记-采购单查询明细")
public R getDetailByPo(@PathVariable("po") String po) {
return R.ok(poOrderDetailService.findPoOrderDetailListByPo(po));
}
@ -64,72 +57,74 @@ public class PoOrderController {
return R.ok(poOrderService.findPoOrderDataByPo(page, zwPoOrder));
}
@ApiOperation(value = "采购登记-获取物料", notes = "采购登记-获取物料")
@ApiOperation(value = "采购登记-获取物料", notes = "采购登记-获取物料")
@SysLog("采购登记-获取物料")
@PostMapping("/api/saveDocumentData")
public R saveDocumentData(@RequestBody List<DocumentDetailed> zwDocumentDetailList) throws Exception{
return R.ok(poOrderService.saveDocumentData(zwDocumentDetailList));
public R saveDocumentData(@RequestBody List<DocumentDetailed> zwDocumentDetailList) {
poOrderService.saveDocumentData(zwDocumentDetailList);
return R.ok();
}
@ApiOperation(value = "采购登记-冲销", notes = "采购登记-冲销")
@SysLog("采购登记-冲销")
@PostMapping("/api/cancelDocumentNo")
public R cancelDocumentNo(@RequestBody DocumentDetailed documentDetailed){
poOrderService.cancelDocumentNo(documentDetailed);
return R.ok();
}
@ApiOperation(value = "采购登记-冲销", notes = "采购登记-冲销")
@SysLog("采购登记-冲销")
@PostMapping("/api/cancelDocumentNo")
public R cancelDocumentNo(@RequestBody DocumentDetailed documentDetailed) {
poOrderService.cancelDocumentNo(documentDetailed);
return R.ok();
}
@ApiOperation(value = "收货登记-查看收货到明细", notes = "收货登记-查看收货到明细")
@ApiOperation(value = "收货登记-查看收货到明细", notes = "收货登记-查看收货到明细")
@SysLog("收货登记-查看收货到明细")
@GetMapping("/findDocumentDetailDataByDocumentNo")
public R findDocumentDetailDataByDocumentNo(String documentNo) {
return R.ok(poOrderService.findDocumentDetailDataByDocumentNo(documentNo));
}
/**
/**
* 分页查询
* @param page 分页对象
*
* @param page 分页对象
* @param zwPoOrder 仓库模块采购订单主表
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/poPage" )
@GetMapping("/poPage")
public R getZwPoOrderPage(Page page, PoOrder zwPoOrder) {
return R.ok(poOrderService.page(page, Wrappers.query(zwPoOrder)));
}
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page")
public R getDnOrderPage(FrontPage page, PoOrder poOrder) {
String site = TenantContextHolder.getTenantId();
LambdaQueryWrapper<PoOrder> queryWrapper = Wrappers.lambdaQuery(PoOrder.class);
String searchText = page.getSearchText();
queryWrapper.setEntity(poOrder).eq(PoOrder::getSite, site).eq(PoOrder::getState, "available").in(PoOrder::getBusinessType, Arrays.asList("1", "2", "4"))
.and(StrUtil.isNotBlank(searchText), o -> o
.like(PoOrder::getPo, searchText).or()
.like(PoOrder::getPurchaser, searchText).or()
.like(PoOrder::getCustomerNo, searchText)
.like(PoOrder::getBusinessType, searchText))
.orderByDesc(PoOrder::getPo);
return R.ok(poOrderService.page(page, queryWrapper));
}
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page")
public R getDnOrderPage(FrontPage page, PoOrder poOrder) {
String site = TenantContextHolder.getTenantId();
LambdaQueryWrapper<PoOrder> queryWrapper = Wrappers.lambdaQuery(PoOrder.class);
String searchText = page.getSearchText();
queryWrapper.setEntity(poOrder).eq(PoOrder::getSite, site).eq(PoOrder::getState, "available").in(PoOrder::getBusinessType, Arrays.asList("1", "2", "4"))
.and(StrUtil.isNotBlank(searchText), o -> o
.like(PoOrder::getPo, searchText).or()
.like(PoOrder::getPurchaser, searchText).or()
.like(PoOrder::getCustomerNo, searchText)
.like(PoOrder::getBusinessType, searchText))
.orderByDesc(PoOrder::getPo);
return R.ok(poOrderService.page(page, queryWrapper));
}
/**
* 查询PO单明细
*
* @return
*/
@ApiOperation(value = "查询明细", notes = "查询明细")
@GetMapping("/selectPoDetail")
public R selectPoDetail(String poNumber) {
String site = TenantContextHolder.getTenantId();
return R.ok(poOrderService.selectPoDetail(site, poNumber));
}
/**
* 查询PO单明细
*
* @return
*/
@ApiOperation(value = "查询明细", notes = "查询明细")
@GetMapping("/selectPoDetail")
public R selectPoDetail(String poNumber) {
String site = TenantContextHolder.getTenantId();
return R.ok(poOrderService.selectPoDetail(site, poNumber));
}
@ApiOperation(value = "查询PO单关联的单据明细", notes = "查询PO单关联的单据明细")
@GetMapping("/selectPoWithDocumentDetail")
public R selectPoWithDocumentDetail(String documentNo) {
String site = TenantContextHolder.getTenantId();
return R.ok(poOrderService.selectPoWithDocumentDetail(site, documentNo));
}
@ApiOperation(value = "查询PO单关联的单据明细", notes = "查询PO单关联的单据明细")
@GetMapping("/selectPoWithDocumentDetail")
public R selectPoWithDocumentDetail(String documentNo) {
String site = TenantContextHolder.getTenantId();
return R.ok(poOrderService.selectPoWithDocumentDetail(site, documentNo));
}
}

View File

@ -24,7 +24,7 @@ public interface PoOrderService extends IService<PoOrder> {
@Transactional
void cancelDocumentNo(DocumentDetailed documentDetailed);
String saveDocumentData(List<DocumentDetailed> zwDocumentDetailList) throws Exception;
void saveDocumentData(List<DocumentDetailed> zwDocumentDetailList);
JSONObject dealPoDataLogic(JSONObject messageObj);

View File

@ -148,7 +148,7 @@ public class PoOrderServiceImpl extends ServiceImpl<PoOrderMapper, PoOrder> impl
// NLV 已使用 Snow
@Override
@Transactional
public String saveDocumentData(List<DocumentDetailed> zwDocumentDetailList) throws Exception {
public void saveDocumentData(List<DocumentDetailed> zwDocumentDetailList) {
String site = TenantContextHolder.getTenantId();
// 先创建单据号
Map map = new HashMap();
@ -161,8 +161,10 @@ public class PoOrderServiceImpl extends ServiceImpl<PoOrderMapper, PoOrder> impl
zwDocument.setDocumentNo(documentNo);
zwDocument.setHandle(Document.genHandle(zwDocument.getSite(), zwDocument.getDocumentNo()));
String po = zwDocumentDetailList.get(0).getExternalNo();
String materialDocument = zwDocumentDetailList.get(0).getMaterialDocument();
zwDocument.setExternalDocumentNo(po);
zwDocument.setState("SUBMIT");
zwDocument.setMaterialDocument(materialDocument);
zwDocument.setCreateDate(LocalDateTime.now());
zwDocument.setCreateUser(SecurityUtils.getUserName());
documentMapper.insert(zwDocument);
@ -207,7 +209,6 @@ public class PoOrderServiceImpl extends ServiceImpl<PoOrderMapper, PoOrder> impl
}
// 收入库存
saveWmsInventory(site, newDocumentList, documentNo);
return documentNo;
}
// NLV 已使用 Snow