入库相关接口开发2.0
This commit is contained in:
@@ -43,13 +43,13 @@ public class PcdeDetailController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部库位明细列表
|
||||
* 获取未被入库单据使用的库位列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('information:pcdedetail:list')")
|
||||
@GetMapping("/getAll")
|
||||
public AjaxResult getAll()
|
||||
{
|
||||
List<PcdeDetail> list = pcdeDetailService.selectPcdeDetailList(new PcdeDetail());
|
||||
List<PcdeDetail> list = pcdeDetailService.getAllPcde();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,4 +66,11 @@ public interface IPcdeDetailService
|
||||
* @return
|
||||
*/
|
||||
String importPcdeDetail(List<PcdeDetail> list, String operName);
|
||||
|
||||
/**
|
||||
* 获取未被入库单据使用的库位列表
|
||||
* @return
|
||||
*/
|
||||
List<PcdeDetail> getAllPcde();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zg.project.information.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.zg.common.exception.ServiceException;
|
||||
@@ -183,4 +184,23 @@ public class PcdeDetailServiceImpl implements IPcdeDetailService
|
||||
return "恭喜您,数据已全部导入成功!共 " + successNum + " 条。";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取未被入库单据使用的库位列表
|
||||
*/
|
||||
@Override
|
||||
public List<PcdeDetail> getAllPcde() {
|
||||
// 查询所有库位
|
||||
List<PcdeDetail> pcdeList = pcdeDetailMapper.selectPcdeDetailList(new PcdeDetail());
|
||||
|
||||
// 查询已被使用过的库位码(pcode)
|
||||
List<String> usedPcodeList = rkInfoMapper.selectUsedPcodes();
|
||||
|
||||
// 过滤掉已使用的
|
||||
List<PcdeDetail> availableList = pcdeList.stream()
|
||||
.filter(p -> !usedPcodeList.contains(p.getLocationCode()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return availableList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zg.project.wisdom.controller;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zg.project.wisdom.domain.dto.PcRkInfoBatchDTO;
|
||||
import com.zg.project.wisdom.domain.dto.RkInfoBatchDTO;
|
||||
import com.zg.project.wisdom.service.IGysJhService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -31,7 +32,7 @@ import com.zg.framework.web.page.TableDataInfo;
|
||||
* @date 2025-05-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wisdom/stock")
|
||||
@RequestMapping("/pc/wisdom/stock")
|
||||
public class RkInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
@@ -75,10 +76,10 @@ public class RkInfoController extends BaseController
|
||||
/**
|
||||
* 新增库存单据主
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
@PreAuthorize("@ss.hasPermi('wisdom:stock:add')")
|
||||
@Log(title = "库存单据主", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public AjaxResult batchAdd(@RequestBody RkInfoBatchDTO dto) {
|
||||
public AjaxResult batchAdd(@RequestBody PcRkInfoBatchDTO dto) {
|
||||
return toAjax(rkInfoService.batchInsert(dto));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.zg.project.wisdom.controller.app;
|
||||
|
||||
import com.zg.common.utils.poi.ExcelUtil;
|
||||
import com.zg.framework.aspectj.lang.annotation.Log;
|
||||
import com.zg.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.zg.framework.web.controller.BaseController;
|
||||
import com.zg.framework.web.domain.AjaxResult;
|
||||
import com.zg.framework.web.page.TableDataInfo;
|
||||
import com.zg.project.wisdom.domain.RkInfo;
|
||||
import com.zg.project.wisdom.domain.dto.RkInfoBatchDTO;
|
||||
import com.zg.project.wisdom.service.IRkInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库存单据主Controller
|
||||
*
|
||||
* @author zg
|
||||
* @date 2025-05-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wisdom/stock")
|
||||
public class AppRkInfoController extends BaseController {
|
||||
@Autowired
|
||||
private IRkInfoService rkInfoService;
|
||||
|
||||
/**
|
||||
* 查询库存单据主列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wisdom:stock:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RkInfo rkInfo)
|
||||
{
|
||||
startPage();
|
||||
List<RkInfo> list = rkInfoService.selectRkInfoList(rkInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出库存单据主列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wisdom:stock:export')")
|
||||
@Log(title = "库存单据主", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RkInfo rkInfo)
|
||||
{
|
||||
List<RkInfo> list = rkInfoService.selectRkInfoList(rkInfo);
|
||||
ExcelUtil<RkInfo> util = new ExcelUtil<RkInfo>(RkInfo.class);
|
||||
util.exportExcel(response, list, "库存单据主数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取库存单据主详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wisdom:stock:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rkInfoService.selectRkInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增库存单据主
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wisdom:stock:add')")
|
||||
@Log(title = "库存单据主", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public AjaxResult batchAdd(@RequestBody RkInfoBatchDTO dto) {
|
||||
return toAjax(rkInfoService.batchInsertApp(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库存单据主
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wisdom:stock:edit')")
|
||||
@Log(title = "库存单据主", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RkInfo rkInfo)
|
||||
{
|
||||
return toAjax(rkInfoService.updateRkInfo(rkInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库存单据主
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wisdom:stock:remove')")
|
||||
@Log(title = "库存单据主", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(rkInfoService.deleteRkInfoByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -121,6 +121,10 @@ public class RkInfo extends BaseEntity
|
||||
@Excel(name = "库位码")
|
||||
private String pcode;
|
||||
|
||||
/** 库位主键ID */
|
||||
@Excel(name = "库位主键ID")
|
||||
private String pcodeId;
|
||||
|
||||
/** 托盘码 */
|
||||
@Excel(name = "托盘码")
|
||||
private String trayCode;
|
||||
@@ -384,6 +388,14 @@ public class RkInfo extends BaseEntity
|
||||
return pcode;
|
||||
}
|
||||
|
||||
public void setPcodeId(String pcodeId) {
|
||||
this.pcodeId = pcodeId;
|
||||
}
|
||||
|
||||
public String getPcodeId() {
|
||||
return pcodeId;
|
||||
}
|
||||
|
||||
public void setTrayCode(String trayCode)
|
||||
{
|
||||
this.trayCode = trayCode;
|
||||
@@ -441,6 +453,7 @@ public class RkInfo extends BaseEntity
|
||||
.append("dw", getDw())
|
||||
.append("realQty", getRealQty())
|
||||
.append("pcode", getPcode())
|
||||
.append("pcodeId", getPcodeId())
|
||||
.append("trayCode", getTrayCode())
|
||||
.append("entityId", getEntityId())
|
||||
.append("createBy", getCreateBy())
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.zg.project.wisdom.domain.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* PC端 - 入库请求 DTO
|
||||
*/
|
||||
public class PcRkInfoBatchDTO {
|
||||
|
||||
/** 入库类型 */
|
||||
private String rkType;
|
||||
|
||||
/** 物资类型 */
|
||||
private String wlType;
|
||||
|
||||
/** 理货员 */
|
||||
private String lihuoY;
|
||||
|
||||
/** 所属仓库 */
|
||||
private String cangku;
|
||||
|
||||
/** 入库记录列表(每条为完整入库项) */
|
||||
private List<PcRkInfoItemDTO> rkList;
|
||||
|
||||
public String getRkType() {
|
||||
return rkType;
|
||||
}
|
||||
|
||||
public void setRkType(String rkType) {
|
||||
this.rkType = rkType;
|
||||
}
|
||||
|
||||
public String getWlType() {
|
||||
return wlType;
|
||||
}
|
||||
|
||||
public void setWlType(String wlType) {
|
||||
this.wlType = wlType;
|
||||
}
|
||||
|
||||
public String getLihuoY() {
|
||||
return lihuoY;
|
||||
}
|
||||
|
||||
public void setLihuoY(String lihuoY) {
|
||||
this.lihuoY = lihuoY;
|
||||
}
|
||||
|
||||
public String getCangku() {
|
||||
return cangku;
|
||||
}
|
||||
|
||||
public void setCangku(String cangku) {
|
||||
this.cangku = cangku;
|
||||
}
|
||||
|
||||
public List<PcRkInfoItemDTO> getRkList() {
|
||||
return rkList;
|
||||
}
|
||||
|
||||
public void setRkList(List<PcRkInfoItemDTO> rkList) {
|
||||
this.rkList = rkList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
package com.zg.project.wisdom.domain.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* PC端 - 入库明细 DTO(字段驼峰命名规范)
|
||||
*/
|
||||
public class PcRkInfoItemDTO {
|
||||
|
||||
/** 县局 */
|
||||
private String xj;
|
||||
|
||||
/** 供应计划主键ID */
|
||||
private Long gysJhId;
|
||||
|
||||
/** 本地物料号 */
|
||||
private String wlNo;
|
||||
|
||||
/** 项目描述 */
|
||||
private String xmMs;
|
||||
|
||||
/** 项目号 */
|
||||
private String xmNo;
|
||||
|
||||
/** SAP物料号 */
|
||||
private String sapWlNo;
|
||||
|
||||
/** SAP物料描述 */
|
||||
private String sapWlMs;
|
||||
|
||||
/** 供应商编码 */
|
||||
private String gysNo;
|
||||
|
||||
/** 供应商名称 */
|
||||
private String gysMc;
|
||||
|
||||
/** SAP订单编号 */
|
||||
private String sapNo;
|
||||
|
||||
/** 计划交货数量 */
|
||||
private Long jhQty;
|
||||
|
||||
/** 合同数量 */
|
||||
private Long htQty;
|
||||
|
||||
/** 计量单位 */
|
||||
private String dw;
|
||||
|
||||
/** 计划交货金额 */
|
||||
private BigDecimal jhAmt;
|
||||
|
||||
/** 合同单价 */
|
||||
private BigDecimal htDj;
|
||||
|
||||
/** 实际入库数量 */
|
||||
private Long realQty;
|
||||
|
||||
/** 库位码 */
|
||||
private String pcode;
|
||||
|
||||
/** 库位主键ID */
|
||||
private String pcodeId;
|
||||
|
||||
/** 托盘码 */
|
||||
private String trayCode;
|
||||
|
||||
/** 实物 ID */
|
||||
private String entityId;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
// ======= Getter / Setter =======
|
||||
|
||||
public String getXj() {
|
||||
return xj;
|
||||
}
|
||||
|
||||
public void setXj(String xj) {
|
||||
this.xj = xj;
|
||||
}
|
||||
|
||||
public Long getGysJhId() {
|
||||
return gysJhId;
|
||||
}
|
||||
|
||||
public void setGysJhId(Long gysJhId) {
|
||||
this.gysJhId = gysJhId;
|
||||
}
|
||||
|
||||
public String getWlNo() {
|
||||
return wlNo;
|
||||
}
|
||||
|
||||
public void setWlNo(String wlNo) {
|
||||
this.wlNo = wlNo;
|
||||
}
|
||||
|
||||
public String getXmMs() {
|
||||
return xmMs;
|
||||
}
|
||||
|
||||
public void setXmMs(String xmMs) {
|
||||
this.xmMs = xmMs;
|
||||
}
|
||||
|
||||
public String getXmNo() {
|
||||
return xmNo;
|
||||
}
|
||||
|
||||
public void setXmNo(String xmNo) {
|
||||
this.xmNo = xmNo;
|
||||
}
|
||||
|
||||
public String getSapWlNo() {
|
||||
return sapWlNo;
|
||||
}
|
||||
|
||||
public void setSapWlNo(String sapWlNo) {
|
||||
this.sapWlNo = sapWlNo;
|
||||
}
|
||||
|
||||
public String getSapWlMs() {
|
||||
return sapWlMs;
|
||||
}
|
||||
|
||||
public void setSapWlMs(String sapWlMs) {
|
||||
this.sapWlMs = sapWlMs;
|
||||
}
|
||||
|
||||
public String getGysNo() {
|
||||
return gysNo;
|
||||
}
|
||||
|
||||
public void setGysNo(String gysNo) {
|
||||
this.gysNo = gysNo;
|
||||
}
|
||||
|
||||
public String getGysMc() {
|
||||
return gysMc;
|
||||
}
|
||||
|
||||
public void setGysMc(String gysMc) {
|
||||
this.gysMc = gysMc;
|
||||
}
|
||||
|
||||
public String getSapNo() {
|
||||
return sapNo;
|
||||
}
|
||||
|
||||
public void setSapNo(String sapNo) {
|
||||
this.sapNo = sapNo;
|
||||
}
|
||||
|
||||
public Long getJhQty() {
|
||||
return jhQty;
|
||||
}
|
||||
|
||||
public void setJhQty(Long jhQty) {
|
||||
this.jhQty = jhQty;
|
||||
}
|
||||
|
||||
public Long getHtQty() {
|
||||
return htQty;
|
||||
}
|
||||
|
||||
public void setHtQty(Long htQty) {
|
||||
this.htQty = htQty;
|
||||
}
|
||||
|
||||
public String getDw() {
|
||||
return dw;
|
||||
}
|
||||
|
||||
public void setDw(String dw) {
|
||||
this.dw = dw;
|
||||
}
|
||||
|
||||
public BigDecimal getJhAmt() {
|
||||
return jhAmt;
|
||||
}
|
||||
|
||||
public void setJhAmt(BigDecimal jhAmt) {
|
||||
this.jhAmt = jhAmt;
|
||||
}
|
||||
|
||||
public BigDecimal getHtDj() {
|
||||
return htDj;
|
||||
}
|
||||
|
||||
public void setHtDj(BigDecimal htDj) {
|
||||
this.htDj = htDj;
|
||||
}
|
||||
|
||||
public Long getRealQty() {
|
||||
return realQty;
|
||||
}
|
||||
|
||||
public void setRealQty(Long realQty) {
|
||||
this.realQty = realQty;
|
||||
}
|
||||
|
||||
public String getPcode() {
|
||||
return pcode;
|
||||
}
|
||||
|
||||
public void setPcode(String pcode) {
|
||||
this.pcode = pcode;
|
||||
}
|
||||
|
||||
public String getPcodeId() {
|
||||
return pcodeId;
|
||||
}
|
||||
|
||||
public void setPcodeId(String pcodeId) {
|
||||
this.pcodeId = pcodeId;
|
||||
}
|
||||
|
||||
public String getTrayCode() {
|
||||
return trayCode;
|
||||
}
|
||||
|
||||
public void setTrayCode(String trayCode) {
|
||||
this.trayCode = trayCode;
|
||||
}
|
||||
|
||||
public String getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
public void setEntityId(String entityId) {
|
||||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,6 @@ public class RkInfoBatchDTO {
|
||||
/** 入库物料列表 */
|
||||
private List<RkInfoItemDTO> rkList;
|
||||
|
||||
// Getters and Setters
|
||||
public String getRkType() {
|
||||
return rkType;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,66 @@
|
||||
package com.zg.project.wisdom.domain.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* APP端 - 入库明细 DTO
|
||||
*/
|
||||
public class RkInfoItemDTO {
|
||||
|
||||
/** 物料号 */
|
||||
/** 供应计划主键ID */
|
||||
private Long gysJhId;
|
||||
|
||||
/** SAP物料号(数据库字段 wl_no) */
|
||||
private String wlNo;
|
||||
|
||||
/** SAP物料描述(数据库字段 wl_ms) */
|
||||
private String wlMs;
|
||||
|
||||
/** 项目号(数据库字段 xm_no) */
|
||||
private String xmNo;
|
||||
|
||||
/** 项目描述 */
|
||||
private String xmMs;
|
||||
|
||||
/** 扫码记录列表 */
|
||||
/** 县局 */
|
||||
private String xj;
|
||||
|
||||
/** 供应商编码 */
|
||||
private String gysNo;
|
||||
|
||||
/** 供应商名称 */
|
||||
private String gysMc;
|
||||
|
||||
/** SAP订单编号 */
|
||||
private String sapNo;
|
||||
|
||||
/** 计划交货数量 */
|
||||
private Long jhQty;
|
||||
|
||||
/** 合同数量 */
|
||||
private Long htQty;
|
||||
|
||||
/** 计量单位 */
|
||||
private String dw;
|
||||
|
||||
/** 计划交货金额 */
|
||||
private BigDecimal jhAmt;
|
||||
|
||||
/** 合同单价 */
|
||||
private BigDecimal htDj;
|
||||
|
||||
/** 实物扫码记录列表 */
|
||||
private List<RkInfoScanDTO> scanList;
|
||||
|
||||
// Getters and Setters
|
||||
public Long getGysJhId() {
|
||||
return gysJhId;
|
||||
}
|
||||
|
||||
public void setGysJhId(Long gysJhId) {
|
||||
this.gysJhId = gysJhId;
|
||||
}
|
||||
|
||||
public String getWlNo() {
|
||||
return wlNo;
|
||||
}
|
||||
@@ -22,6 +69,22 @@ public class RkInfoItemDTO {
|
||||
this.wlNo = wlNo;
|
||||
}
|
||||
|
||||
public String getWlMs() {
|
||||
return wlMs;
|
||||
}
|
||||
|
||||
public void setWlMs(String wlMs) {
|
||||
this.wlMs = wlMs;
|
||||
}
|
||||
|
||||
public String getXmNo() {
|
||||
return xmNo;
|
||||
}
|
||||
|
||||
public void setXmNo(String xmNo) {
|
||||
this.xmNo = xmNo;
|
||||
}
|
||||
|
||||
public String getXmMs() {
|
||||
return xmMs;
|
||||
}
|
||||
@@ -30,6 +93,78 @@ public class RkInfoItemDTO {
|
||||
this.xmMs = xmMs;
|
||||
}
|
||||
|
||||
public String getXj() {
|
||||
return xj;
|
||||
}
|
||||
|
||||
public void setXj(String xj) {
|
||||
this.xj = xj;
|
||||
}
|
||||
|
||||
public String getGysNo() {
|
||||
return gysNo;
|
||||
}
|
||||
|
||||
public void setGysNo(String gysNo) {
|
||||
this.gysNo = gysNo;
|
||||
}
|
||||
|
||||
public String getGysMc() {
|
||||
return gysMc;
|
||||
}
|
||||
|
||||
public void setGysMc(String gysMc) {
|
||||
this.gysMc = gysMc;
|
||||
}
|
||||
|
||||
public String getSapNo() {
|
||||
return sapNo;
|
||||
}
|
||||
|
||||
public void setSapNo(String sapNo) {
|
||||
this.sapNo = sapNo;
|
||||
}
|
||||
|
||||
public Long getJhQty() {
|
||||
return jhQty;
|
||||
}
|
||||
|
||||
public void setJhQty(Long jhQty) {
|
||||
this.jhQty = jhQty;
|
||||
}
|
||||
|
||||
public Long getHtQty() {
|
||||
return htQty;
|
||||
}
|
||||
|
||||
public void setHtQty(Long htQty) {
|
||||
this.htQty = htQty;
|
||||
}
|
||||
|
||||
public String getDw() {
|
||||
return dw;
|
||||
}
|
||||
|
||||
public void setDw(String dw) {
|
||||
this.dw = dw;
|
||||
}
|
||||
|
||||
public BigDecimal getJhAmt() {
|
||||
return jhAmt;
|
||||
}
|
||||
|
||||
public void setJhAmt(BigDecimal jhAmt) {
|
||||
this.jhAmt = jhAmt;
|
||||
}
|
||||
|
||||
public BigDecimal getHtDj() {
|
||||
return htDj;
|
||||
}
|
||||
|
||||
public void setHtDj(BigDecimal htDj) {
|
||||
this.htDj = htDj;
|
||||
}
|
||||
|
||||
public List<RkInfoScanDTO> getScanList() {
|
||||
return scanList;
|
||||
}
|
||||
|
||||
@@ -5,19 +5,21 @@ public class RkInfoScanDTO {
|
||||
/** 库位码 */
|
||||
private String pcode;
|
||||
|
||||
/** 库位主键ID */
|
||||
private String pcodeId;
|
||||
|
||||
/** 托盘码 */
|
||||
private String trayCode;
|
||||
|
||||
/** 实际入库数量 */
|
||||
/** 实际数量 */
|
||||
private Long realQty;
|
||||
|
||||
/** 实物ID */
|
||||
/** 实物 ID */
|
||||
private String entityId;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
// Getters and Setters
|
||||
public String getPcode() {
|
||||
return pcode;
|
||||
}
|
||||
@@ -26,6 +28,14 @@ public class RkInfoScanDTO {
|
||||
this.pcode = pcode;
|
||||
}
|
||||
|
||||
public String getPcodeId() {
|
||||
return pcodeId;
|
||||
}
|
||||
|
||||
public void setPcodeId(String pcodeId) {
|
||||
this.pcodeId = pcodeId;
|
||||
}
|
||||
|
||||
public String getTrayCode() {
|
||||
return trayCode;
|
||||
}
|
||||
|
||||
@@ -65,4 +65,10 @@ public interface GysJhMapper
|
||||
* @return
|
||||
*/
|
||||
List<GysJh> getBySapNo(String sapNo);
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
* @param gysJhId
|
||||
*/
|
||||
void updateStatusById(Long gysJhId);
|
||||
}
|
||||
|
||||
@@ -66,4 +66,11 @@ public interface RkInfoMapper
|
||||
* @return
|
||||
*/
|
||||
int countRkInfoByLocationCode(@Param("locationCode") String locationCode);
|
||||
|
||||
/**
|
||||
* 查询已使用库位
|
||||
* @return
|
||||
*/
|
||||
List<String> selectUsedPcodes();
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zg.project.wisdom.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.zg.project.wisdom.domain.RkInfo;
|
||||
import com.zg.project.wisdom.domain.dto.PcRkInfoBatchDTO;
|
||||
import com.zg.project.wisdom.domain.dto.RkInfoBatchDTO;
|
||||
|
||||
/**
|
||||
@@ -54,9 +55,16 @@ public interface IRkInfoService
|
||||
public int deleteRkInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 新增入库单据
|
||||
* PC新增入库单据
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
int batchInsert(RkInfoBatchDTO dto);
|
||||
int batchInsert(PcRkInfoBatchDTO dto);
|
||||
|
||||
/**
|
||||
* APP新增入库单据
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
int batchInsertApp(RkInfoBatchDTO dto);
|
||||
}
|
||||
|
||||
@@ -3,19 +3,23 @@ package com.zg.project.wisdom.service.impl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.zg.common.exception.ServiceException;
|
||||
import com.zg.common.utils.DateUtils;
|
||||
import com.zg.common.utils.SecurityUtils;
|
||||
import com.zg.project.wisdom.domain.GysJh;
|
||||
import com.zg.project.wisdom.domain.dto.RkInfoBatchDTO;
|
||||
import com.zg.project.wisdom.domain.dto.RkInfoItemDTO;
|
||||
import com.zg.project.wisdom.domain.dto.RkInfoScanDTO;
|
||||
import com.zg.project.wisdom.domain.dto.*;
|
||||
import com.zg.project.wisdom.mapper.GysJhMapper;
|
||||
import com.zg.project.wisdom.service.IGysJhService;
|
||||
import com.zg.project.wisdom.util.CodeConvertUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zg.project.wisdom.mapper.RkInfoMapper;
|
||||
import com.zg.project.wisdom.domain.RkInfo;
|
||||
import com.zg.project.wisdom.service.IRkInfoService;
|
||||
|
||||
import static com.zg.common.utils.SecurityUtils.getUsername;
|
||||
|
||||
/**
|
||||
* 库存单据主Service业务层处理
|
||||
*
|
||||
@@ -29,6 +33,9 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
@Autowired
|
||||
private RkInfoMapper rkInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private GysJhMapper gysJhMapper;
|
||||
|
||||
/**
|
||||
* 查询库存单据主
|
||||
*
|
||||
@@ -97,44 +104,148 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int batchInsert(RkInfoBatchDTO dto) {
|
||||
public int batchInsert(PcRkInfoBatchDTO dto) {
|
||||
List<RkInfo> saveList = new ArrayList<>();
|
||||
String username = SecurityUtils.getUsername(); // 获取当前登录用户
|
||||
Date now = DateUtils.getNowDate(); // 当前时间
|
||||
String username = SecurityUtils.getUsername();
|
||||
Date now = DateUtils.getNowDate();
|
||||
|
||||
if (dto.getRkList() == null || dto.getRkList().isEmpty()) {
|
||||
throw new ServiceException("rkList 入库明细列表不能为空");
|
||||
}
|
||||
|
||||
for (PcRkInfoItemDTO item : dto.getRkList()) {
|
||||
RkInfo entity = new RkInfo();
|
||||
|
||||
// 顶层字段
|
||||
entity.setRkType(dto.getRkType());
|
||||
entity.setWlType(dto.getWlType());
|
||||
entity.setCangku(dto.getCangku());
|
||||
entity.setLihuoY(dto.getLihuoY());
|
||||
|
||||
// 明细字段(item)
|
||||
entity.setXj(item.getXj());
|
||||
entity.setXmNo(item.getXmNo());
|
||||
entity.setXmMs(item.getXmMs());
|
||||
entity.setSapNo(item.getSapNo());
|
||||
entity.setJhQty(item.getJhQty());
|
||||
entity.setHtQty(item.getHtQty());
|
||||
entity.setJhAmt(item.getJhAmt());
|
||||
entity.setHtDj(item.getHtDj());
|
||||
entity.setDw(item.getDw());
|
||||
entity.setWlNo(item.getWlNo());
|
||||
// entity.setWlMs(item.getWlMs());
|
||||
entity.setGysNo(item.getGysNo());
|
||||
entity.setGysMc(item.getGysMc());
|
||||
|
||||
// 库存字段
|
||||
entity.setRealQty(item.getRealQty());
|
||||
entity.setPcode(item.getPcode());
|
||||
if (item.getPcode() != null) {
|
||||
entity.setPcodeId(CodeConvertUtil.stringToHex(item.getPcode()));
|
||||
}
|
||||
entity.setTrayCode(item.getTrayCode());
|
||||
entity.setEntityId(item.getEntityId());
|
||||
entity.setRemark(item.getRemark());
|
||||
|
||||
// 系统字段
|
||||
entity.setIsChuku("0");
|
||||
entity.setIsDelete("0");
|
||||
entity.setRkTime(now);
|
||||
entity.setCreateBy(username);
|
||||
entity.setCreateTime(now);
|
||||
|
||||
saveList.add(entity);
|
||||
|
||||
// 更新供应计划状态
|
||||
if (item.getGysJhId() != null) {
|
||||
gysJhMapper.updateStatusById(item.getGysJhId());
|
||||
}
|
||||
}
|
||||
|
||||
if (saveList.isEmpty()) {
|
||||
throw new ServiceException("未提取到任何可保存的数据");
|
||||
}
|
||||
|
||||
return rkInfoMapper.batchInsertRkInfo(saveList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增入库单据(APP)
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int batchInsertApp(RkInfoBatchDTO dto) {
|
||||
List<RkInfo> saveList = new ArrayList<>();
|
||||
String username = SecurityUtils.getUsername();
|
||||
Date now = DateUtils.getNowDate();
|
||||
|
||||
if (dto.getRkList() == null || dto.getRkList().isEmpty()) {
|
||||
throw new ServiceException("rkList 入库明细列表不能为空");
|
||||
}
|
||||
|
||||
for (RkInfoItemDTO item : dto.getRkList()) {
|
||||
for (RkInfoScanDTO scan : item.getScanList()) {
|
||||
List<RkInfoScanDTO> scanList = item.getScanList();
|
||||
if (scanList == null || scanList.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (RkInfoScanDTO scan : scanList) {
|
||||
|
||||
RkInfo entity = new RkInfo();
|
||||
|
||||
// ======= 来自最外层 DTO =======
|
||||
// 批次字段
|
||||
entity.setRkType(dto.getRkType());
|
||||
entity.setWlType(dto.getWlType());
|
||||
entity.setCangku(dto.getCangku());
|
||||
entity.setLihuoY(dto.getLihuoY());
|
||||
|
||||
// ======= 中层 DTO =======
|
||||
entity.setWlNo(item.getWlNo());
|
||||
// 明细字段(RkInfoItemDTO)
|
||||
entity.setXj(item.getXj());
|
||||
entity.setXmMs(item.getXmMs());
|
||||
entity.setXmNo(item.getXmNo());
|
||||
entity.setSapNo(item.getSapNo());
|
||||
entity.setJhQty(item.getJhQty());
|
||||
entity.setHtQty(item.getHtQty());
|
||||
entity.setJhAmt(item.getJhAmt());
|
||||
entity.setHtDj(item.getHtDj());
|
||||
entity.setDw(item.getDw());
|
||||
entity.setWlNo(item.getWlNo());
|
||||
entity.setWlMs(item.getWlMs());
|
||||
entity.setGysNo(item.getGysNo());
|
||||
entity.setGysMc(item.getGysMc());
|
||||
|
||||
// ======= 最内层 DTO =======
|
||||
// 扫码记录(RkInfoScanDTO)
|
||||
entity.setPcode(scan.getPcode());
|
||||
if (scan.getPcode() != null) {
|
||||
entity.setPcodeId(CodeConvertUtil.stringToHex(scan.getPcode()));
|
||||
}
|
||||
entity.setTrayCode(scan.getTrayCode());
|
||||
entity.setRealQty(scan.getRealQty());
|
||||
entity.setEntityId(scan.getEntityId());
|
||||
entity.setRemark(scan.getRemark());
|
||||
|
||||
// ======= 系统默认字段 =======
|
||||
entity.setIsChuku("0");
|
||||
// 系统字段
|
||||
entity.setIsDelete("0");
|
||||
entity.setIsChuku("0");
|
||||
entity.setRkTime(now);
|
||||
entity.setCreateBy(username);
|
||||
entity.setCreateTime(now);
|
||||
|
||||
saveList.add(entity);
|
||||
}
|
||||
|
||||
// 每个 item 的 供应计划主键ID 更新一次供应计划状态
|
||||
if (item.getGysJhId() != null) {
|
||||
gysJhMapper.updateStatusById(item.getGysJhId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (saveList.isEmpty()) {
|
||||
throw new ServiceException("未提取到任何可保存的数据");
|
||||
}
|
||||
|
||||
// 批量插入到数据库
|
||||
return rkInfoMapper.batchInsertRkInfo(saveList);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.zg.project.wisdom.util;
|
||||
|
||||
/**
|
||||
* 编码转换工具类 - 处理如库位码转十六进制字符串等逻辑
|
||||
*/
|
||||
public class CodeConvertUtil {
|
||||
|
||||
/**
|
||||
* 将字符串转为十六进制字符串(如用于生成库位ID)
|
||||
* @param input 原始字符串,例如 "A01-013004"
|
||||
* @return 十六进制字符串,例如 "4130312D303133303034"
|
||||
*/
|
||||
public static String stringToHex(String input) {
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder hex = new StringBuilder();
|
||||
for (char ch : input.toCharArray()) {
|
||||
hex.append(String.format("%02X", (int) ch));
|
||||
}
|
||||
return hex.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 可选:将十六进制字符串转换回原始字符串
|
||||
* @param hex 十六进制字符串
|
||||
* @return 原始字符串
|
||||
*/
|
||||
public static String hexToString(String hex) {
|
||||
if (hex == null || hex.length() % 2 != 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder output = new StringBuilder();
|
||||
for (int i = 0; i < hex.length(); i += 2) {
|
||||
String str = hex.substring(i, i + 2);
|
||||
output.append((char) Integer.parseInt(str, 16));
|
||||
}
|
||||
return output.toString();
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="getBySapNo" parameterType="java.lang.String" resultMap="GysJhResult">
|
||||
<include refid="selectGysJhVo"/>
|
||||
WHERE sap_no = #{sapNo}
|
||||
AND status = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertGysJh" parameterType="GysJh" useGeneratedKeys="true" keyProperty="id">
|
||||
@@ -137,6 +138,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateStatusById" parameterType="Long">
|
||||
update gys_jh
|
||||
set status = '1'
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteGysJhById" parameterType="Long">
|
||||
delete from gys_jh where id = #{id}
|
||||
</delete>
|
||||
|
||||
@@ -62,20 +62,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<insert id="batchInsertRkInfo" parameterType="java.util.List">
|
||||
insert into rk_info (
|
||||
rk_type, wl_type, cangku, lihuo_y, rk_time,
|
||||
wl_no, xm_ms, pcode, tray_code, real_qty, entity_id,
|
||||
wl_no, wl_ms, xm_no, xm_ms, xj, sap_no, gys_no, gys_mc,
|
||||
jh_qty, ht_qty, jh_amt, ht_dj, dw,
|
||||
pcode, pcode_id, tray_code, real_qty, entity_id,
|
||||
remark, is_chuku, is_delete, create_by, create_time
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.rkType}, #{item.wlType}, #{item.cangku}, #{item.lihuoY}, #{item.rkTime},
|
||||
#{item.wlNo}, #{item.xmMs}, #{item.pcode}, #{item.trayCode}, #{item.realQty}, #{item.entityId},
|
||||
#{item.wlNo}, #{item.wlMs}, #{item.xmNo}, #{item.xmMs}, #{item.xj}, #{item.sapNo}, #{item.gysNo}, #{item.gysMc},
|
||||
#{item.jhQty}, #{item.htQty}, #{item.jhAmt}, #{item.htDj}, #{item.dw},
|
||||
#{item.pcode}, #{item.pcodeId}, #{item.trayCode}, #{item.realQty}, #{item.entityId},
|
||||
#{item.remark}, #{item.isChuku}, #{item.isDelete}, #{item.createBy}, #{item.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="selectRkInfoList" parameterType="RkInfo" resultMap="RkInfoResult">
|
||||
<include refid="selectRkInfoVo"/>
|
||||
<where>
|
||||
@@ -114,7 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult">
|
||||
<include refid="selectRkInfoVo"/>
|
||||
where id = #{id} and is_delete = 0
|
||||
where ri.id = #{id} and ri.is_delete = 0
|
||||
</select>
|
||||
|
||||
<select id="countRkInfoByLocationCode" resultType="int">
|
||||
@@ -122,6 +125,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
FROM rk_info
|
||||
WHERE pcode = #{locationCode} AND is_delete = 0
|
||||
</select>
|
||||
|
||||
<select id="selectUsedPcodes" resultType="java.lang.String">
|
||||
SELECT DISTINCT pcode
|
||||
FROM rk_info
|
||||
WHERE is_delete = '0' AND is_chuku != '1'
|
||||
</select>
|
||||
|
||||
<update id="updateRkInfo" parameterType="RkInfo">
|
||||
update rk_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
||||
Reference in New Issue
Block a user