Compare commits
15 Commits
ef0c52b6df
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 26bc599e26 | |||
| 0671f405f6 | |||
| 309022aae2 | |||
| 75449e04ba | |||
| a52754d76b | |||
| 96b9084267 | |||
| f7b9f228c3 | |||
| b6bb2e4a3a | |||
| 516434b28e | |||
| 46df19a1a8 | |||
| e59a6583b6 | |||
| e334c57736 | |||
| f27ff89614 | |||
| 87de67a188 | |||
| 676ab34c1b |
@@ -126,11 +126,11 @@ public class PcdeDetailController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 删除库位明细
|
* 删除库位明细
|
||||||
*/
|
*/
|
||||||
// @PreAuthorize("@ss.hasPermi('information:pcdedetail:remove')")
|
@PreAuthorize("@ss.hasPermi('information:pcdedetail:remove')")
|
||||||
// @Log(title = "库位明细", businessType = BusinessType.DELETE)
|
@Log(title = "库位明细", businessType = BusinessType.DELETE)
|
||||||
// @DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
// public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
// {
|
{
|
||||||
// return toAjax(pcdeDetailService.deletePcdeDetailByIds(ids));
|
return toAjax(pcdeDetailService.deletePcdeDetailByIds(ids));
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,5 +99,18 @@ public interface PcdeDetailMapper
|
|||||||
|
|
||||||
String selectEncodedIdByPcodeAndWarehouse(@Param("pcode") String pcode,
|
String selectEncodedIdByPcodeAndWarehouse(@Param("pcode") String pcode,
|
||||||
@Param("warehouseCode") String warehouseCode);
|
@Param("warehouseCode") String warehouseCode);
|
||||||
|
/**
|
||||||
|
* 新增前查重
|
||||||
|
* 同一仓库、同一场景、同一库位编码,不允许重复
|
||||||
|
*/
|
||||||
|
public PcdeDetail selectByWarehouseSceneAndPcode(PcdeDetail pcdeDetail);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改前查重(排除自己)
|
||||||
|
*/
|
||||||
|
public PcdeDetail selectRepeatByWarehouseSceneAndPcode(PcdeDetail pcdeDetail);
|
||||||
|
/**
|
||||||
|
* 批量查已存在
|
||||||
|
*/
|
||||||
|
List<PcdeDetail> selectExistsForImport(@Param("list") List<PcdeDetail> list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public interface IPcdeDetailService
|
|||||||
* @param ids 需要删除的库位明细主键集合
|
* @param ids 需要删除的库位明细主键集合
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
// public int deletePcdeDetailByIds(Long[] ids);
|
public int deletePcdeDetailByIds(Long[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除库位明细信息
|
* 删除库位明细信息
|
||||||
|
|||||||
@@ -61,6 +61,15 @@ public class PcdeDetailServiceImpl implements IPcdeDetailService
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertPcdeDetail(PcdeDetail pcdeDetail) {
|
public int insertPcdeDetail(PcdeDetail pcdeDetail) {
|
||||||
|
pcdeDetail.setWarehouseCode(pcdeDetail.getWarehouseCode().trim());
|
||||||
|
pcdeDetail.setScene(pcdeDetail.getScene().trim());
|
||||||
|
pcdeDetail.setPcode(pcdeDetail.getPcode().trim());
|
||||||
|
// 查重:同一仓库、同一场景、同一库位编码
|
||||||
|
PcdeDetail exist = pcdeDetailMapper.selectByWarehouseSceneAndPcode(pcdeDetail);
|
||||||
|
if (exist != null)
|
||||||
|
{
|
||||||
|
throw new RuntimeException("当前仓库、当前场景下已存在该库位编码,请勿重复新增");
|
||||||
|
}
|
||||||
// 原始 locationCode
|
// 原始 locationCode
|
||||||
String locationCode = pcdeDetail.getPcode();
|
String locationCode = pcdeDetail.getPcode();
|
||||||
|
|
||||||
@@ -86,6 +95,16 @@ public class PcdeDetailServiceImpl implements IPcdeDetailService
|
|||||||
@Override
|
@Override
|
||||||
public int updatePcdeDetail(PcdeDetail pcdeDetail)
|
public int updatePcdeDetail(PcdeDetail pcdeDetail)
|
||||||
{
|
{
|
||||||
|
pcdeDetail.setWarehouseCode(pcdeDetail.getWarehouseCode().trim());
|
||||||
|
pcdeDetail.setScene(pcdeDetail.getScene().trim());
|
||||||
|
pcdeDetail.setPcode(pcdeDetail.getPcode().trim());
|
||||||
|
|
||||||
|
// 查重:排除自己
|
||||||
|
PcdeDetail exist = pcdeDetailMapper.selectRepeatByWarehouseSceneAndPcode(pcdeDetail);
|
||||||
|
if (exist != null)
|
||||||
|
{
|
||||||
|
throw new RuntimeException("当前仓库、当前场景下已存在该库位编码,请勿重复修改");
|
||||||
|
}
|
||||||
return pcdeDetailMapper.updatePcdeDetail(pcdeDetail);
|
return pcdeDetailMapper.updatePcdeDetail(pcdeDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,29 +114,29 @@ public class PcdeDetailServiceImpl implements IPcdeDetailService
|
|||||||
* @param ids 需要删除的库位明细主键
|
* @param ids 需要删除的库位明细主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
// @Override
|
@Override
|
||||||
// public int deletePcdeDetailByIds(Long[] ids)
|
public int deletePcdeDetailByIds(Long[] ids)
|
||||||
// {
|
{
|
||||||
// for (Long id : ids) {
|
for (Long id : ids) {
|
||||||
// // 获取库位信息
|
// 获取库位信息
|
||||||
// PcdeDetail pcdeDetail = pcdeDetailMapper.selectPcdeDetailById(id);
|
PcdeDetail pcdeDetail = pcdeDetailMapper.selectPcdeDetailById(id);
|
||||||
// if (pcdeDetail == null) {
|
if (pcdeDetail == null) {
|
||||||
// throw new ServiceException("ID为 " + id + " 的库位不存在,无法删除");
|
throw new ServiceException("ID为 " + id + " 的库位不存在,无法删除");
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // 获取库位编号
|
// 获取库位编号
|
||||||
// String locationCode = pcdeDetail.getPcode();
|
String locationCode = pcdeDetail.getPcode();
|
||||||
//
|
|
||||||
// // 检查该库位是否仍有关联货物
|
// 检查该库位是否仍有关联货物
|
||||||
// int count = rkInfoMapper.countRkInfoByLocationCode(locationCode);
|
int count = rkInfoMapper.countRkInfoByLocationCode(locationCode);
|
||||||
// if (count > 0) {
|
if (count > 0) {
|
||||||
// throw new ServiceException("库位 [" + locationCode + "] 上还有货物,无法批量删除");
|
throw new ServiceException("库位 [" + locationCode + "] 上还有货物,无法批量删除");
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // 全部校验通过后再执行删除
|
// 全部校验通过后再执行删除
|
||||||
// return pcdeDetailMapper.deletePcdeDetailByIds(ids);
|
return pcdeDetailMapper.deletePcdeDetailByIds(ids);
|
||||||
// }
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除库位明细信息
|
* 删除库位明细信息
|
||||||
@@ -155,49 +174,96 @@ public class PcdeDetailServiceImpl implements IPcdeDetailService
|
|||||||
|
|
||||||
final Date now = DateUtils.getNowDate();
|
final Date now = DateUtils.getNowDate();
|
||||||
|
|
||||||
// 1) 清洗 + 本地生成 encodedId(逐字符→Unicode→HEX大写→拼接)
|
// 1. 清洗数据
|
||||||
List<PcdeDetail> cleaned = new ArrayList<>(pcdeList.size());
|
List<PcdeDetail> cleaned = new ArrayList<>(pcdeList.size());
|
||||||
|
|
||||||
|
// 文件内去重:同一仓库+同一场景+同一库位编码
|
||||||
|
Set<String> importKeySet = new HashSet<>();
|
||||||
|
int innerRepeatCount = 0;
|
||||||
|
|
||||||
for (PcdeDetail d : pcdeList) {
|
for (PcdeDetail d : pcdeList) {
|
||||||
if (d == null) continue;
|
if (d == null) {
|
||||||
String p = d.getPcode() == null ? null : d.getPcode().trim();
|
|
||||||
if (StringUtils.isEmpty(p)) {
|
|
||||||
// 跳过空 pcode
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
d.setPcode(p);
|
|
||||||
d.setEncodedId(toHexStringFromPcode(p));
|
|
||||||
|
|
||||||
// 审计字段(与你实体保持一致:createdBy/createdAt/updatedBy/updatedAt)
|
String warehouseCode = d.getWarehouseCode() == null ? null : d.getWarehouseCode().trim();
|
||||||
|
String scene = d.getScene() == null ? null : d.getScene().trim();
|
||||||
|
String pcode = d.getPcode() == null ? null : d.getPcode().trim();
|
||||||
|
|
||||||
|
if (StringUtils.isEmpty(warehouseCode) || StringUtils.isEmpty(scene) || StringUtils.isEmpty(pcode)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String repeatKey = warehouseCode + "_" + scene + "_" + pcode;
|
||||||
|
if (importKeySet.contains(repeatKey)) {
|
||||||
|
innerRepeatCount++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
importKeySet.add(repeatKey);
|
||||||
|
|
||||||
|
d.setWarehouseCode(warehouseCode);
|
||||||
|
d.setScene(scene);
|
||||||
|
d.setPcode(pcode);
|
||||||
|
d.setEncodedId(toHexStringFromPcode(pcode));
|
||||||
|
|
||||||
d.setCreatedBy(operName);
|
d.setCreatedBy(operName);
|
||||||
d.setCreatedAt(now);
|
d.setCreatedAt(now);
|
||||||
d.setUpdatedBy(operName);
|
d.setUpdatedBy(operName);
|
||||||
d.setUpdatedAt(now);
|
d.setUpdatedAt(now);
|
||||||
|
|
||||||
// 业务兜底
|
if (d.getIsDelete() == null) {
|
||||||
if (d.getIsDelete() == null) d.setIsDelete("0");
|
d.setIsDelete("0");
|
||||||
|
}
|
||||||
|
|
||||||
cleaned.add(d);
|
cleaned.add(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cleaned.isEmpty()) {
|
if (cleaned.isEmpty()) {
|
||||||
throw new ServiceException("有效的库位编号为空,请检查导入文件!");
|
throw new ServiceException("有效的导入数据为空,请检查导入文件!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2) 批量写库(分片,避免 SQL 过大;配合 uk_pcode + INSERT IGNORE 实现幂等忽略)
|
// 2. 批量查数据库已存在数据
|
||||||
|
List<PcdeDetail> existList = pcdeDetailMapper.selectExistsForImport(cleaned);
|
||||||
|
|
||||||
|
Set<String> dbExistKeySet = new HashSet<>();
|
||||||
|
if (!CollectionUtils.isEmpty(existList)) {
|
||||||
|
for (PcdeDetail item : existList) {
|
||||||
|
String key = item.getWarehouseCode() + "_" + item.getScene() + "_" + item.getPcode();
|
||||||
|
dbExistKeySet.add(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 过滤数据库中已存在的数据
|
||||||
|
List<PcdeDetail> needInsertList = new ArrayList<>();
|
||||||
|
int dbRepeatCount = 0;
|
||||||
|
|
||||||
|
for (PcdeDetail d : cleaned) {
|
||||||
|
String key = d.getWarehouseCode() + "_" + d.getScene() + "_" + d.getPcode();
|
||||||
|
if (dbExistKeySet.contains(key)) {
|
||||||
|
dbRepeatCount++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
needInsertList.add(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needInsertList.isEmpty()) {
|
||||||
|
return String.format("导入完成:共读取 %d 条,文件内重复 %d 条,数据库已存在 %d 条,本次成功导入 0 条。",
|
||||||
|
pcdeList.size(), innerRepeatCount, dbRepeatCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 分批插入
|
||||||
final int batchSize = 1000;
|
final int batchSize = 1000;
|
||||||
int totalTried = cleaned.size();
|
|
||||||
int totalInserted = 0;
|
int totalInserted = 0;
|
||||||
|
|
||||||
for (int i = 0; i < cleaned.size(); i += batchSize) {
|
for (int i = 0; i < needInsertList.size(); i += batchSize) {
|
||||||
int end = Math.min(i + batchSize, cleaned.size());
|
int end = Math.min(i + batchSize, needInsertList.size());
|
||||||
List<PcdeDetail> slice = cleaned.subList(i, end);
|
List<PcdeDetail> slice = needInsertList.subList(i, end);
|
||||||
int affected = pcdeDetailMapper.batchInsertIgnore(slice);
|
int affected = pcdeDetailMapper.batchInsertIgnore(slice);
|
||||||
totalInserted += affected;
|
totalInserted += affected;
|
||||||
}
|
}
|
||||||
|
|
||||||
int skipped = totalTried - totalInserted;
|
return String.format("导入完成:共读取 %d 条,文件内重复 %d 条,数据库已存在 %d 条,成功导入 %d 条。",
|
||||||
return String.format("导入完成:共读取 %d 条,成功导入 %d 条,跳过(可能重复) %d 条。",
|
pcdeList.size(), innerRepeatCount, dbRepeatCount, totalInserted);
|
||||||
totalTried, totalInserted, skipped);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 将 pcode 按字符转大写十六进制(与新增接口保持一致) */
|
/** 将 pcode 按字符转大写十六进制(与新增接口保持一致) */
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.zg.project.wisdom.domain;
|
package com.zg.project.wisdom.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.zg.framework.web.domain.BaseEntity;
|
import com.zg.framework.web.domain.BaseEntity;
|
||||||
import com.zg.framework.aspectj.lang.annotation.Excel;
|
import com.zg.framework.aspectj.lang.annotation.Excel;
|
||||||
import com.zg.project.wisdom.config.BigDecimalSerializer;
|
import com.zg.project.wisdom.config.BigDecimalSerializer;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -96,14 +98,26 @@ public class MoveRecord extends BaseEntity {
|
|||||||
/** 项目描述 */
|
/** 项目描述 */
|
||||||
@Excel(name = "项目描述")
|
@Excel(name = "项目描述")
|
||||||
private String xmMs;
|
private String xmMs;
|
||||||
|
/** 物料号 */
|
||||||
|
@Excel(name = "物料号")
|
||||||
|
private String wlNo;
|
||||||
/** 物料描述 */
|
/** 物料描述 */
|
||||||
@Excel(name = "物料描述")
|
@Excel(name = "物料描述")
|
||||||
private String wlMs;
|
private String wlMs;
|
||||||
|
/** SAP订单编号 */
|
||||||
|
@Excel(name = "SAP订单编号")
|
||||||
|
private String sapNo;
|
||||||
/** 供应商名称 */
|
/** 供应商名称 */
|
||||||
@Excel(name = "供应商名称")
|
@Excel(name = "供应商名称")
|
||||||
private String gysMc;
|
private String gysMc;
|
||||||
|
/** 入库 / 出库开始时间(查询用) */
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date startDate;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date endDate;
|
||||||
|
|
||||||
// ==================== Getter / Setter ====================
|
// ==================== Getter / Setter ====================
|
||||||
|
|
||||||
@@ -266,6 +280,13 @@ public class MoveRecord extends BaseEntity {
|
|||||||
public void setXmNo(String xmNo) {
|
public void setXmNo(String xmNo) {
|
||||||
this.xmNo = xmNo;
|
this.xmNo = xmNo;
|
||||||
}
|
}
|
||||||
|
public String getSapNo() {
|
||||||
|
return sapNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSapNo(String sapNo) {
|
||||||
|
this.sapNo = sapNo;
|
||||||
|
}
|
||||||
|
|
||||||
public String getXmMs() {
|
public String getXmMs() {
|
||||||
return xmMs;
|
return xmMs;
|
||||||
@@ -282,6 +303,13 @@ public class MoveRecord extends BaseEntity {
|
|||||||
public void setWlMs(String wlMs) {
|
public void setWlMs(String wlMs) {
|
||||||
this.wlMs = wlMs;
|
this.wlMs = wlMs;
|
||||||
}
|
}
|
||||||
|
public String getWlNo() {
|
||||||
|
return wlNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWlNo(String wlNo) {
|
||||||
|
this.wlNo = wlNo;
|
||||||
|
}
|
||||||
|
|
||||||
public String getGysMc() {
|
public String getGysMc() {
|
||||||
return gysMc;
|
return gysMc;
|
||||||
@@ -290,6 +318,21 @@ public class MoveRecord extends BaseEntity {
|
|||||||
public void setGysMc(String gysMc) {
|
public void setGysMc(String gysMc) {
|
||||||
this.gysMc = gysMc;
|
this.gysMc = gysMc;
|
||||||
}
|
}
|
||||||
|
public Date getStartDate() {
|
||||||
|
return startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartDate(Date startDate) {
|
||||||
|
this.startDate = startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getEndDate() {
|
||||||
|
return endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndDate(Date endDate) {
|
||||||
|
this.endDate = endDate;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
@@ -310,7 +353,11 @@ public class MoveRecord extends BaseEntity {
|
|||||||
.append("movedBy", getMovedBy())
|
.append("movedBy", getMovedBy())
|
||||||
.append("movedByName", getMovedByName())
|
.append("movedByName", getMovedByName())
|
||||||
.append("movedAt", getMovedAt())
|
.append("movedAt", getMovedAt())
|
||||||
|
.append("wlNo", getWlNo())
|
||||||
|
.append("sapNo", getSapNo())
|
||||||
.append("isDelete", getIsDelete())
|
.append("isDelete", getIsDelete())
|
||||||
|
.append("startDate", startDate)
|
||||||
|
.append("endDate", endDate)
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,6 +131,12 @@ public class RkBill extends BaseEntity {
|
|||||||
/** 备注 */
|
/** 备注 */
|
||||||
@Excel(name = "备注")
|
@Excel(name = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
/** 是否上传照片(0否 1是) */
|
||||||
|
@Excel(name = "是否上传照片", readConverterExp = "0=否,1=是")
|
||||||
|
private Integer isUploadPhoto;
|
||||||
|
/** 需求方(部门/单位) */
|
||||||
|
@Excel(name = "需求方")
|
||||||
|
private String demandDeptName;
|
||||||
|
|
||||||
// ================= getter / setter =================
|
// ================= getter / setter =================
|
||||||
|
|
||||||
@@ -217,7 +223,20 @@ public class RkBill extends BaseEntity {
|
|||||||
|
|
||||||
public String getRemark() { return remark; }
|
public String getRemark() { return remark; }
|
||||||
public void setRemark(String remark) { this.remark = remark; }
|
public void setRemark(String remark) { this.remark = remark; }
|
||||||
|
public Integer getIsUploadPhoto() {
|
||||||
|
return isUploadPhoto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsUploadPhoto(Integer isUploadPhoto) {
|
||||||
|
this.isUploadPhoto = isUploadPhoto;
|
||||||
|
}
|
||||||
|
public String getDemandDeptName() {
|
||||||
|
return demandDeptName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDemandDeptName(String demandDeptName) {
|
||||||
|
this.demandDeptName = demandDeptName;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
@@ -247,6 +266,8 @@ public class RkBill extends BaseEntity {
|
|||||||
.append("startDate", startDate)
|
.append("startDate", startDate)
|
||||||
.append("endDate", endDate)
|
.append("endDate", endDate)
|
||||||
.append("remark", remark)
|
.append("remark", remark)
|
||||||
|
.append("isUploadPhoto", isUploadPhoto)
|
||||||
|
.append("demandDeptName", demandDeptName)
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -256,6 +256,12 @@ public class RkInfo extends BaseEntity
|
|||||||
private String scene;
|
private String scene;
|
||||||
|
|
||||||
private String sceneName;
|
private String sceneName;
|
||||||
|
/** 是否上传照片(0否 1是) */
|
||||||
|
@Excel(name = "是否上传照片", readConverterExp = "0=否,1=是")
|
||||||
|
private Integer isUploadPhoto;
|
||||||
|
/** 需求方(部门/单位) */
|
||||||
|
@Excel(name = "需求方")
|
||||||
|
private String demandDeptName;
|
||||||
|
|
||||||
public void setId(Long id)
|
public void setId(Long id)
|
||||||
{
|
{
|
||||||
@@ -820,7 +826,20 @@ public class RkInfo extends BaseEntity
|
|||||||
{
|
{
|
||||||
return sceneName;
|
return sceneName;
|
||||||
}
|
}
|
||||||
|
public Integer getIsUploadPhoto() {
|
||||||
|
return isUploadPhoto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsUploadPhoto(Integer isUploadPhoto) {
|
||||||
|
this.isUploadPhoto = isUploadPhoto;
|
||||||
|
}
|
||||||
|
public String getDemandDeptName() {
|
||||||
|
return demandDeptName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDemandDeptName(String demandDeptName) {
|
||||||
|
this.demandDeptName = demandDeptName;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
@@ -886,6 +905,8 @@ public class RkInfo extends BaseEntity
|
|||||||
.append("endDate", endDate)
|
.append("endDate", endDate)
|
||||||
.append("totalAmount", totalAmount)
|
.append("totalAmount", totalAmount)
|
||||||
.append("scene", getScene())
|
.append("scene", getScene())
|
||||||
|
.append("isUploadPhoto",isUploadPhoto)
|
||||||
|
.append("demandDeptName", demandDeptName)
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,6 +268,15 @@ public class RkRecord extends BaseEntity
|
|||||||
@Excel(name = "备注")
|
@Excel(name = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/** 是否上传照片(0否 1是) */
|
||||||
|
@Excel(name = "是否上传照片", readConverterExp = "0=否,1=是")
|
||||||
|
private Integer isUploadPhoto;
|
||||||
|
|
||||||
|
/** 需求方(部门/单位) */
|
||||||
|
@Excel(name = "需求方")
|
||||||
|
private String demandDeptName;
|
||||||
|
|
||||||
|
|
||||||
public void setId(Long id)
|
public void setId(Long id)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@@ -837,6 +846,20 @@ public class RkRecord extends BaseEntity
|
|||||||
public void setRemark(String remark) {
|
public void setRemark(String remark) {
|
||||||
this.remark = remark;
|
this.remark = remark;
|
||||||
}
|
}
|
||||||
|
public Integer getIsUploadPhoto() {
|
||||||
|
return isUploadPhoto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsUploadPhoto(Integer isUploadPhoto) {
|
||||||
|
this.isUploadPhoto = isUploadPhoto;
|
||||||
|
}
|
||||||
|
public String getDemandDeptName() {
|
||||||
|
return demandDeptName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDemandDeptName(String demandDeptName) {
|
||||||
|
this.demandDeptName = demandDeptName;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
@@ -904,6 +927,8 @@ public class RkRecord extends BaseEntity
|
|||||||
.append("startDate", startDate)
|
.append("startDate", startDate)
|
||||||
.append("endDate", endDate)
|
.append("endDate", endDate)
|
||||||
.append("rkInfoId", getRkInfoId())
|
.append("rkInfoId", getRkInfoId())
|
||||||
.toString();
|
.append("isUploadPhoto", isUploadPhoto)
|
||||||
|
.append("demandDeptName", demandDeptName)
|
||||||
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,4 +179,7 @@ public interface GysJhMapper
|
|||||||
*/
|
*/
|
||||||
int decreaseRealQtyById(@Param("rollbackQty") BigDecimal rollbackQty,
|
int decreaseRealQtyById(@Param("rollbackQty") BigDecimal rollbackQty,
|
||||||
@Param("gysJhId") Long gysJhId);
|
@Param("gysJhId") Long gysJhId);
|
||||||
|
|
||||||
|
|
||||||
|
int syncGysJhQty(GysJh gysJh);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,4 +190,9 @@ public interface RkInfoMapper
|
|||||||
@Param("warehouseCode") String warehouseCode,
|
@Param("warehouseCode") String warehouseCode,
|
||||||
@Param("sceneId") String sceneId
|
@Param("sceneId") String sceneId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
int updateInfoByBillNo(RkInfo rkInfo);
|
||||||
|
|
||||||
|
|
||||||
|
public int countRkInfoByLocationCode(String locationCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ public class RkBillServiceImpl implements IRkBillService
|
|||||||
info.setScene(scene);
|
info.setScene(scene);
|
||||||
info.setCreateTime(now);
|
info.setCreateTime(now);
|
||||||
info.setCreateBy(userId);
|
info.setCreateBy(userId);
|
||||||
|
info.setIsUploadPhoto(bill.getIsUploadPhoto());
|
||||||
rkInfoMapper.insertRkInfo(info);
|
rkInfoMapper.insertRkInfo(info);
|
||||||
|
|
||||||
// rk_record
|
// rk_record
|
||||||
@@ -206,10 +206,13 @@ public class RkBillServiceImpl implements IRkBillService
|
|||||||
BigDecimal currentInQty = entry.getValue();
|
BigDecimal currentInQty = entry.getValue();
|
||||||
|
|
||||||
GysJh gysJh = gysJhMapper.selectGysJhById(gysJhId);
|
GysJh gysJh = gysJhMapper.selectGysJhById(gysJhId);
|
||||||
|
|
||||||
if (gysJh == null) {
|
if (gysJh == null) {
|
||||||
throw new RuntimeException("供应计划不存在,ID:" + gysJhId);
|
throw new RuntimeException("供应计划不存在,ID:" + gysJhId);
|
||||||
}
|
}
|
||||||
|
int rows = gysJhMapper.syncGysJhQty(gysJh);
|
||||||
|
// 重新查(必须)
|
||||||
|
gysJh = gysJhMapper.selectGysJhById(gysJhId);
|
||||||
BigDecimal planQty = gysJh.getJhQty();
|
BigDecimal planQty = gysJh.getJhQty();
|
||||||
if (planQty == null) {
|
if (planQty == null) {
|
||||||
continue;
|
continue;
|
||||||
@@ -262,7 +265,7 @@ public class RkBillServiceImpl implements IRkBillService
|
|||||||
// ⑤ 关联明细
|
// ⑤ 关联明细
|
||||||
record.setRkInfoId(info.getId());
|
record.setRkInfoId(info.getId());
|
||||||
record.setRdid(info.getId());
|
record.setRdid(info.getId());
|
||||||
|
record.setIsUploadPhoto(bill.getIsUploadPhoto());
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -463,9 +466,29 @@ public class RkBillServiceImpl implements IRkBillService
|
|||||||
updateRecord.setTeamCode(rkBill.getTeamCode());
|
updateRecord.setTeamCode(rkBill.getTeamCode());
|
||||||
updateRecord.setOperator(rkBill.getOperator());
|
updateRecord.setOperator(rkBill.getOperator());
|
||||||
updateRecord.setIsDelivery(rkBill.getIsDelivery());
|
updateRecord.setIsDelivery(rkBill.getIsDelivery());
|
||||||
|
updateRecord.setWlType(rkBill.getWlType());
|
||||||
|
updateRecord.setDemandDeptName(rkBill.getDemandDeptName());
|
||||||
|
updateRecord.setIsUploadPhoto(rkBill.getIsUploadPhoto());
|
||||||
|
|
||||||
|
|
||||||
// 执行批量更新
|
// 执行批量更新
|
||||||
rkRecordMapper.updateRecordByBillNo(updateRecord);
|
rkRecordMapper.updateRecordByBillNo(updateRecord);
|
||||||
|
// ====================== 3. 同步更新 rk_info ======================
|
||||||
|
RkInfo updateInfo = new RkInfo();
|
||||||
|
|
||||||
|
updateInfo.setBillNo(rkBill.getBillNo());
|
||||||
|
|
||||||
|
// 同步字段
|
||||||
|
updateInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
updateInfo.setOperationType(rkBill.getOperationType());
|
||||||
|
updateInfo.setTeamCode(rkBill.getTeamCode());
|
||||||
|
updateInfo.setOperator(rkBill.getOperator());
|
||||||
|
updateInfo.setIsDelivery(rkBill.getIsDelivery());
|
||||||
|
updateInfo.setWlType(rkBill.getWlType());
|
||||||
|
updateInfo.setIsUploadPhoto(rkBill.getIsUploadPhoto());
|
||||||
|
updateInfo.setDemandDeptName(rkBill.getDemandDeptName());
|
||||||
|
rkInfoMapper.updateInfoByBillNo(updateInfo);
|
||||||
|
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,13 +125,13 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
|
|
||||||
rkRecord.setUpdateTime(DateUtils.getNowDate());
|
rkRecord.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
|
||||||
/* ====================== 2. 查询原记录(唯一可信来源) ====================== */
|
/* ====================== 2. 查询原记录 ====================== */
|
||||||
RkRecord oldRecord = rkRecordMapper.selectRkRecordById(rkRecord.getId());
|
RkRecord oldRecord = rkRecordMapper.selectRkRecordById(rkRecord.getId());
|
||||||
if (oldRecord == null) {
|
if (oldRecord == null) {
|
||||||
throw new RuntimeException("原出入库记录不存在");
|
throw new RuntimeException("原出入库记录不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ====================== 3. 获取并校验库存ID(必须来自 oldRecord) ====================== */
|
/* ====================== 3. 获取库存ID ====================== */
|
||||||
Long rkInfoId = oldRecord.getRkInfoId();
|
Long rkInfoId = oldRecord.getRkInfoId();
|
||||||
if (rkInfoId == null) {
|
if (rkInfoId == null) {
|
||||||
throw new RuntimeException("出入库记录未关联库存,禁止修改");
|
throw new RuntimeException("出入库记录未关联库存,禁止修改");
|
||||||
@@ -145,7 +145,7 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
String bizType = rkRecord.getBizType();
|
String bizType = rkRecord.getBizType();
|
||||||
|
|
||||||
/* =========================================================
|
/* =========================================================
|
||||||
* 【A】入库记录修改(bizType = 0)
|
* 【A】入库记录修改
|
||||||
* ========================================================= */
|
* ========================================================= */
|
||||||
if ("0".equals(bizType)) {
|
if ("0".equals(bizType)) {
|
||||||
|
|
||||||
@@ -159,7 +159,6 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
|
|
||||||
BigDecimal diff = newInQty.subtract(oldInQty);
|
BigDecimal diff = newInQty.subtract(oldInQty);
|
||||||
|
|
||||||
/* ---------- 供应计划处理 ---------- */
|
|
||||||
Long gysJhId = oldRecord.getGysJhId();
|
Long gysJhId = oldRecord.getGysJhId();
|
||||||
if (gysJhId != null) {
|
if (gysJhId != null) {
|
||||||
|
|
||||||
@@ -182,11 +181,11 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
gysJh.setRealQty(newPlanRealQty);
|
gysJh.setRealQty(newPlanRealQty);
|
||||||
|
|
||||||
if (newPlanRealQty.compareTo(BigDecimal.ZERO) == 0) {
|
if (newPlanRealQty.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
gysJh.setStatus("0"); // 未到货
|
gysJh.setStatus("0");
|
||||||
} else if (planQty != null && newPlanRealQty.compareTo(planQty) >= 0) {
|
} else if (planQty != null && newPlanRealQty.compareTo(planQty) >= 0) {
|
||||||
gysJh.setStatus("1"); // 已入库
|
gysJh.setStatus("1");
|
||||||
} else {
|
} else {
|
||||||
gysJh.setStatus("2"); // 部分入库
|
gysJh.setStatus("2");
|
||||||
}
|
}
|
||||||
|
|
||||||
gysJh.setWlNo(rkRecord.getWlNo());
|
gysJh.setWlNo(rkRecord.getWlNo());
|
||||||
@@ -202,9 +201,8 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
gysJhMapper.updateGysJh(gysJh);
|
gysJhMapper.updateGysJh(gysJh);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------- 同步库存(明确字段,禁止 BeanUtils) ---------- */
|
|
||||||
String scene = "";
|
String scene = "";
|
||||||
// 库位校验
|
|
||||||
if (StringUtils.isNotBlank(info.getPcode())) {
|
if (StringUtils.isNotBlank(info.getPcode())) {
|
||||||
PcdeDetail pcde = pcdeDetailMapper.selectByPcodeAndWarehouse(
|
PcdeDetail pcde = pcdeDetailMapper.selectByPcodeAndWarehouse(
|
||||||
rkRecord.getPcode(),
|
rkRecord.getPcode(),
|
||||||
@@ -213,18 +211,22 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
if (pcde == null) {
|
if (pcde == null) {
|
||||||
throw new RuntimeException("库位不存在:" + info.getPcode());
|
throw new RuntimeException("库位不存在:" + info.getPcode());
|
||||||
}
|
}
|
||||||
|
|
||||||
info.setPcodeId(pcde.getEncodedId());
|
info.setPcodeId(pcde.getEncodedId());
|
||||||
if(StringUtils.isNotBlank(pcde.getScene())){
|
|
||||||
|
if (StringUtils.isNotBlank(pcde.getScene())) {
|
||||||
scene = pcde.getScene();
|
scene = pcde.getScene();
|
||||||
info.setScene(scene);
|
info.setScene(scene);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
info.setRealQty(newInQty);
|
info.setRealQty(newInQty);
|
||||||
info.setWlNo(rkRecord.getWlNo());
|
info.setWlNo(rkRecord.getWlNo());
|
||||||
info.setWlMs(rkRecord.getWlMs());
|
info.setWlMs(rkRecord.getWlMs());
|
||||||
info.setXmNo(rkRecord.getXmNo());
|
info.setXmNo(rkRecord.getXmNo());
|
||||||
info.setXmMs(rkRecord.getXmMs());
|
info.setXmMs(rkRecord.getXmMs());
|
||||||
info.setGysNo(rkRecord.getGysNo());
|
info.setGysNo(rkRecord.getGysNo());
|
||||||
|
info.setSapNo(rkRecord.getSapNo());
|
||||||
info.setGysMc(rkRecord.getGysMc());
|
info.setGysMc(rkRecord.getGysMc());
|
||||||
info.setDw(rkRecord.getDw());
|
info.setDw(rkRecord.getDw());
|
||||||
info.setHtDj(rkRecord.getHtDj());
|
info.setHtDj(rkRecord.getHtDj());
|
||||||
@@ -235,26 +237,24 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* =========================================================
|
/* =========================================================
|
||||||
* 【B】出库记录修改(bizType = 1)
|
* 【B】出库记录修改(修改逻辑)
|
||||||
* ========================================================= */
|
* ========================================================= */
|
||||||
if ("1".equals(bizType)) {
|
if ("1".equals(bizType)) {
|
||||||
|
|
||||||
BigDecimal oldOutQty = oldRecord.getRealQty();
|
|
||||||
BigDecimal newOutQty = rkRecord.getRealQty();
|
BigDecimal newOutQty = rkRecord.getRealQty();
|
||||||
BigDecimal stockQty = info.getRealQty();
|
BigDecimal stockQty = info.getRealQty();
|
||||||
|
|
||||||
if (oldOutQty == null || newOutQty == null || stockQty == null) {
|
if (newOutQty == null || stockQty == null) {
|
||||||
throw new RuntimeException("数量数据异常,无法修改出库记录");
|
throw new RuntimeException("数量数据异常,无法修改出库记录");
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal diff = newOutQty.subtract(oldOutQty);
|
/* 关键修改:直接用 newOutQty 计算库存 */
|
||||||
BigDecimal newStockQty = stockQty.subtract(diff);
|
BigDecimal newStockQty = stockQty.subtract(newOutQty);
|
||||||
|
|
||||||
if (newStockQty.compareTo(BigDecimal.ZERO) < 0) {
|
if (newStockQty.compareTo(BigDecimal.ZERO) < 0) {
|
||||||
throw new RuntimeException("库存不足,无法修改出库数量");
|
throw new RuntimeException("库存不足,无法修改出库数量");
|
||||||
}
|
}
|
||||||
|
|
||||||
info.setRealQty(newStockQty);
|
|
||||||
info.setIsChuku(newStockQty.compareTo(BigDecimal.ZERO) == 0 ? "1" : "0");
|
info.setIsChuku(newStockQty.compareTo(BigDecimal.ZERO) == 0 ? "1" : "0");
|
||||||
|
|
||||||
info.setWlNo(rkRecord.getWlNo());
|
info.setWlNo(rkRecord.getWlNo());
|
||||||
@@ -277,8 +277,8 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
throw new RuntimeException("同步更新库存表失败");
|
throw new RuntimeException("同步更新库存表失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ====================== 5. 最后更新 rk_record ====================== */
|
/* ====================== 5. 更新记录表 ====================== */
|
||||||
rkRecord.setRkInfoId(rkInfoId); // 强制回填,防止被置空
|
rkRecord.setRkInfoId(rkInfoId);
|
||||||
int rows = rkRecordMapper.updateRkRecord(rkRecord);
|
int rows = rkRecordMapper.updateRkRecord(rkRecord);
|
||||||
if (rows <= 0) {
|
if (rows <= 0) {
|
||||||
throw new RuntimeException("更新出入库记录失败");
|
throw new RuntimeException("更新出入库记录失败");
|
||||||
@@ -286,6 +286,7 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int deleteRkRecordByIds(Long[] ids) {
|
public int deleteRkRecordByIds(Long[] ids) {
|
||||||
@@ -516,7 +517,9 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
if (gysJh == null) {
|
if (gysJh == null) {
|
||||||
throw new ServiceException("供应计划不存在,ID:" + gysJhId);
|
throw new ServiceException("供应计划不存在,ID:" + gysJhId);
|
||||||
}
|
}
|
||||||
|
int rows = gysJhMapper.syncGysJhQty(gysJh);
|
||||||
|
// 重新查(必须)
|
||||||
|
gysJh = gysJhMapper.selectGysJhById(gysJhId);
|
||||||
BigDecimal planQty = gysJh.getJhQty();
|
BigDecimal planQty = gysJh.getJhQty();
|
||||||
BigDecimal alreadyQty = gysJh.getRealQty() == null
|
BigDecimal alreadyQty = gysJh.getRealQty() == null
|
||||||
? BigDecimal.ZERO
|
? BigDecimal.ZERO
|
||||||
|
|||||||
@@ -335,7 +335,6 @@
|
|||||||
INSERT IGNORE INTO pcde_detail
|
INSERT IGNORE INTO pcde_detail
|
||||||
(pcode,
|
(pcode,
|
||||||
scene,
|
scene,
|
||||||
scene_name,
|
|
||||||
parent_warehouse_code,
|
parent_warehouse_code,
|
||||||
parent_warehouse_name,
|
parent_warehouse_name,
|
||||||
warehouse_code,
|
warehouse_code,
|
||||||
@@ -353,7 +352,6 @@
|
|||||||
(
|
(
|
||||||
#{item.pcode},
|
#{item.pcode},
|
||||||
#{item.scene},
|
#{item.scene},
|
||||||
#{item.sceneName},
|
|
||||||
#{item.parentWarehouseCode},
|
#{item.parentWarehouseCode},
|
||||||
#{item.parentWarehouseName},
|
#{item.parentWarehouseName},
|
||||||
#{item.warehouseCode},
|
#{item.warehouseCode},
|
||||||
@@ -384,5 +382,84 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
<!-- 新增前查重 -->
|
||||||
|
<select id="selectByWarehouseSceneAndPcode" parameterType="PcdeDetail" resultMap="PcdeDetailResult">
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
pcode,
|
||||||
|
scene,
|
||||||
|
parent_warehouse_code,
|
||||||
|
parent_warehouse_name,
|
||||||
|
warehouse_code,
|
||||||
|
warehouse_name,
|
||||||
|
encoded_id,
|
||||||
|
tag,
|
||||||
|
remark,
|
||||||
|
is_delete,
|
||||||
|
created_by,
|
||||||
|
created_at,
|
||||||
|
updated_by,
|
||||||
|
updated_at
|
||||||
|
FROM pcde_detail
|
||||||
|
WHERE is_delete = 0
|
||||||
|
AND warehouse_code = #{warehouseCode}
|
||||||
|
AND scene = #{scene}
|
||||||
|
AND pcode = #{pcode}
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 修改前查重(排除当前id) -->
|
||||||
|
<select id="selectRepeatByWarehouseSceneAndPcode" parameterType="PcdeDetail" resultMap="PcdeDetailResult">
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
pcode,
|
||||||
|
scene,
|
||||||
|
parent_warehouse_code,
|
||||||
|
parent_warehouse_name,
|
||||||
|
warehouse_code,
|
||||||
|
warehouse_name,
|
||||||
|
encoded_id,
|
||||||
|
tag,
|
||||||
|
remark,
|
||||||
|
is_delete,
|
||||||
|
created_by,
|
||||||
|
created_at,
|
||||||
|
updated_by,
|
||||||
|
updated_at
|
||||||
|
FROM pcde_detail
|
||||||
|
WHERE is_delete = 0
|
||||||
|
AND warehouse_code = #{warehouseCode}
|
||||||
|
AND scene = #{scene}
|
||||||
|
AND pcode = #{pcode}
|
||||||
|
AND id != #{id}
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
<select id="selectExistsForImport" resultMap="PcdeDetailResult">
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
pcode,
|
||||||
|
scene,
|
||||||
|
parent_warehouse_code,
|
||||||
|
parent_warehouse_name,
|
||||||
|
warehouse_code,
|
||||||
|
warehouse_name,
|
||||||
|
encoded_id,
|
||||||
|
tag,
|
||||||
|
remark,
|
||||||
|
is_delete,
|
||||||
|
created_by,
|
||||||
|
created_at,
|
||||||
|
updated_by,
|
||||||
|
updated_at
|
||||||
|
FROM pcde_detail
|
||||||
|
WHERE is_delete = '0'
|
||||||
|
AND
|
||||||
|
<foreach collection="list" item="item" separator=" OR " open="(" close=")">
|
||||||
|
(
|
||||||
|
warehouse_code = #{item.warehouseCode}
|
||||||
|
AND scene = #{item.scene}
|
||||||
|
AND pcode = #{item.pcode}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -317,5 +317,29 @@
|
|||||||
WHERE id = #{gysJhId}
|
WHERE id = #{gysJhId}
|
||||||
AND IFNULL(real_qty, 0) >= #{rollbackQty}
|
AND IFNULL(real_qty, 0) >= #{rollbackQty}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="syncGysJhQty" parameterType="GysJh">
|
||||||
|
UPDATE gys_jh gj
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
sap_no,
|
||||||
|
wl_no,
|
||||||
|
xm_no,
|
||||||
|
IFNULL(SUM(real_qty), 0) AS total_real_qty
|
||||||
|
FROM rk_info
|
||||||
|
WHERE (is_delete = '0' OR is_delete IS NULL)
|
||||||
|
AND exec_status = '1'
|
||||||
|
AND sap_no = #{sapNo}
|
||||||
|
AND wl_no = #{wlNo}
|
||||||
|
AND xm_no = #{xmNo}
|
||||||
|
GROUP BY sap_no, wl_no, xm_no
|
||||||
|
) t
|
||||||
|
ON gj.sap_no = t.sap_no
|
||||||
|
AND gj.wl_no = t.wl_no
|
||||||
|
AND gj.xm_no = t.xm_no
|
||||||
|
SET gj.real_qty = IFNULL(t.total_real_qty, 0)
|
||||||
|
WHERE (gj.is_delete = '0' OR gj.is_delete IS NULL)
|
||||||
|
AND gj.sap_no = #{sapNo}
|
||||||
|
AND gj.wl_no = #{wlNo}
|
||||||
|
AND gj.xm_no = #{xmNo}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -49,6 +49,8 @@
|
|||||||
<result property="xmNo" column="xm_no"/>
|
<result property="xmNo" column="xm_no"/>
|
||||||
<result property="xmMs" column="xm_ms"/>
|
<result property="xmMs" column="xm_ms"/>
|
||||||
<result property="wlMs" column="wl_ms"/>
|
<result property="wlMs" column="wl_ms"/>
|
||||||
|
<result property="wlNo" column="wl_no"/>
|
||||||
|
<result property="sapNo" column="sap_no"/>
|
||||||
<result property="gysMc" column="gys_mc"/>
|
<result property="gysMc" column="gys_mc"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
@@ -141,6 +143,8 @@
|
|||||||
ri.xm_no,
|
ri.xm_no,
|
||||||
ri.xm_ms,
|
ri.xm_ms,
|
||||||
ri.wl_ms,
|
ri.wl_ms,
|
||||||
|
ri.wl_no,
|
||||||
|
ri.sap_no,
|
||||||
ri.gys_mc,
|
ri.gys_mc,
|
||||||
wi1.warehouse_name AS from_cangku_name,
|
wi1.warehouse_name AS from_cangku_name,
|
||||||
wi2.warehouse_name AS to_cangku_name
|
wi2.warehouse_name AS to_cangku_name
|
||||||
@@ -163,9 +167,21 @@
|
|||||||
<if test="xmNo != null and xmNo != ''">
|
<if test="xmNo != null and xmNo != ''">
|
||||||
AND ri.xm_no = #{xmNo}
|
AND ri.xm_no = #{xmNo}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="wlNo != null and wlNo != ''">
|
||||||
|
AND ri.wl_no = #{wlNo}
|
||||||
|
</if>
|
||||||
|
<if test="sapNo != null and sapNo != ''">
|
||||||
|
AND ri.sap_no = #{sapNo}
|
||||||
|
</if>
|
||||||
<if test="moveReason != null and moveReason != ''">
|
<if test="moveReason != null and moveReason != ''">
|
||||||
AND mr.move_reason LIKE concat('%', #{moveReason}, '%')
|
AND mr.move_reason LIKE concat('%', #{moveReason}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="startDate != null">
|
||||||
|
AND mr.moved_at >= #{startDate}
|
||||||
|
</if>
|
||||||
|
<if test="endDate != null">
|
||||||
|
AND mr.moved_at <= #{endDate}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY mr.create_time DESC
|
ORDER BY mr.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -44,6 +44,8 @@
|
|||||||
<result property="createTime" column="create_time"/>
|
<result property="createTime" column="create_time"/>
|
||||||
<result property="updateBy" column="update_by"/>
|
<result property="updateBy" column="update_by"/>
|
||||||
<result property="updateTime" column="update_time"/>
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="isUploadPhoto" column="is_upload_photo"/>
|
||||||
|
<result property="demandDeptName" column="demand_dept_name"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- ==================== Base Select ==================== -->
|
<!-- ==================== Base Select ==================== -->
|
||||||
@@ -72,7 +74,8 @@
|
|||||||
rb.create_time,
|
rb.create_time,
|
||||||
rb.update_by,
|
rb.update_by,
|
||||||
rb.update_time,
|
rb.update_time,
|
||||||
|
rb.is_upload_photo,
|
||||||
|
rb.demand_dept_name,
|
||||||
mt.type_name AS wl_type_name,
|
mt.type_name AS wl_type_name,
|
||||||
COALESCE(sit.type_name, sot.type_name) AS operation_type_name,
|
COALESCE(sit.type_name, sot.type_name) AS operation_type_name,
|
||||||
su.nick_name AS operator_name,
|
su.nick_name AS operator_name,
|
||||||
@@ -199,7 +202,9 @@
|
|||||||
create_time,
|
create_time,
|
||||||
update_by,
|
update_by,
|
||||||
update_time,
|
update_time,
|
||||||
is_delete
|
is_delete,
|
||||||
|
is_upload_photo,
|
||||||
|
demand_dept_name
|
||||||
FROM rk_bill
|
FROM rk_bill
|
||||||
WHERE bill_no = #{billNo}
|
WHERE bill_no = #{billNo}
|
||||||
AND (is_delete = '0' OR is_delete IS NULL)
|
AND (is_delete = '0' OR is_delete IS NULL)
|
||||||
@@ -229,7 +234,9 @@
|
|||||||
remark,
|
remark,
|
||||||
create_by,
|
create_by,
|
||||||
create_time,
|
create_time,
|
||||||
is_delete
|
is_delete,
|
||||||
|
is_upload_photo,
|
||||||
|
demand_dept_name
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{billNo},
|
#{billNo},
|
||||||
#{bizType},
|
#{bizType},
|
||||||
@@ -248,7 +255,9 @@
|
|||||||
#{remark},
|
#{remark},
|
||||||
#{createBy},
|
#{createBy},
|
||||||
#{createTime},
|
#{createTime},
|
||||||
#{isDelete}
|
#{isDelete},
|
||||||
|
#{isUploadPhoto},
|
||||||
|
#{demandDeptName}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -272,6 +281,8 @@
|
|||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
<if test="isDelivery != null and isDelivery != ''">is_delivery = #{isDelivery},</if>
|
<if test="isDelivery != null and isDelivery != ''">is_delivery = #{isDelivery},</if>
|
||||||
<if test="isDelete != null and isDelete != ''">is_delete = #{isDelete},</if>
|
<if test="isDelete != null and isDelete != ''">is_delete = #{isDelete},</if>
|
||||||
|
<if test="isUploadPhoto != null ">is_upload_photo = #{isUploadPhoto},</if>
|
||||||
|
<if test="demandDeptName != null and demandDeptName != ''">demand_dept_name = #{demandDeptName},</if>
|
||||||
</trim>
|
</trim>
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|||||||
@@ -68,6 +68,8 @@
|
|||||||
<result property="isUpdate" column="is_update"/>
|
<result property="isUpdate" column="is_update"/>
|
||||||
<result property="scene" column="scene"/>
|
<result property="scene" column="scene"/>
|
||||||
<result property="sceneName" column="sceneName"/>
|
<result property="sceneName" column="sceneName"/>
|
||||||
|
<result property="isUploadPhoto" column="is_upload_photo"/>
|
||||||
|
<result property="demandDeptName" column="demand_dept_name"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- ========================= 公共查询 SQL(联表完整版) ========================= -->
|
<!-- ========================= 公共查询 SQL(联表完整版) ========================= -->
|
||||||
@@ -166,7 +168,12 @@
|
|||||||
<if test="isDelete != null and isDelete != ''">
|
<if test="isDelete != null and isDelete != ''">
|
||||||
AND ri.is_delete = #{isDelete}
|
AND ri.is_delete = #{isDelete}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="isUploadPhoto != null ">
|
||||||
|
AND ri.is_upload_photo = #{isUploadPhoto}
|
||||||
|
</if>
|
||||||
|
<if test="demandDeptName != null and demandDeptName != ''">
|
||||||
|
AND ri.demand_dept_name = #{demandDeptName}
|
||||||
|
</if>
|
||||||
<if test="startDate != null">
|
<if test="startDate != null">
|
||||||
AND ri.operation_time >= #{startDate}
|
AND ri.operation_time >= #{startDate}
|
||||||
</if>
|
</if>
|
||||||
@@ -176,7 +183,7 @@
|
|||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|
||||||
ORDER BY ri.operation_time DESC
|
ORDER BY ri.pcode ASC, ri.operation_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- ========================= 按 ID 查询 ========================= -->
|
<!-- ========================= 按 ID 查询 ========================= -->
|
||||||
@@ -275,6 +282,15 @@
|
|||||||
<if test="endDate != null">
|
<if test="endDate != null">
|
||||||
AND ri.operation_time <= #{endDate}
|
AND ri.operation_time <= #{endDate}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
AND ri.remark LIKE CONCAT('%', #{remark}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="isUploadPhoto != null ">
|
||||||
|
AND ri.is_upload_photo = #{isUploadPhoto}
|
||||||
|
</if>
|
||||||
|
<if test="demandDeptName != null and demandDeptName != ''">
|
||||||
|
AND ri.demand_dept_name = #{demandDeptName}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -309,7 +325,7 @@
|
|||||||
is_delivery,
|
is_delivery,
|
||||||
fycde_1, fycde_2,
|
fycde_1, fycde_2,
|
||||||
is_update,
|
is_update,
|
||||||
create_by, create_time, is_delete,scene
|
create_by, create_time, is_delete,scene,is_upload_photo,demand_dept_name
|
||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
#{operationType}, #{bizType}, #{wlType}, #{cangku}, #{operationTime}, #{operator},
|
#{operationType}, #{bizType}, #{wlType}, #{cangku}, #{operationTime}, #{operator},
|
||||||
@@ -327,7 +343,7 @@
|
|||||||
#{isDelivery},
|
#{isDelivery},
|
||||||
#{fycde1}, #{fycde2},
|
#{fycde1}, #{fycde2},
|
||||||
#{isUpdate},
|
#{isUpdate},
|
||||||
#{createBy}, #{createTime}, #{isDelete},#{scene}
|
#{createBy}, #{createTime}, #{isDelete},#{scene},#{isUploadPhoto},#{demandDeptName}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -383,7 +399,9 @@
|
|||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||||
<if test="scene != null">scene = #{scene}</if>
|
<if test="scene != null">scene = #{scene},</if>
|
||||||
|
<if test="isUploadPhoto != null">is_upload_photo = #{isUploadPhoto},</if>
|
||||||
|
<if test="demandDeptName != null">demand_dept_name = #{demandDeptName},</if>
|
||||||
</trim>
|
</trim>
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
@@ -676,5 +694,41 @@
|
|||||||
AND ri.cangku = #{warehouseCode}
|
AND ri.cangku = #{warehouseCode}
|
||||||
AND ri.scene = #{sceneId}
|
AND ri.scene = #{sceneId}
|
||||||
</select>
|
</select>
|
||||||
|
<update id="updateInfoByBillNo">
|
||||||
|
UPDATE rk_info
|
||||||
|
<set>
|
||||||
|
<if test="operationType != null">
|
||||||
|
operation_type = #{operationType},
|
||||||
|
</if>
|
||||||
|
<if test="wlType != null">
|
||||||
|
wl_type = #{wlType},
|
||||||
|
</if>
|
||||||
|
<if test="teamCode != null">
|
||||||
|
team_code = #{teamCode},
|
||||||
|
</if>
|
||||||
|
<if test="operator != null">
|
||||||
|
operator = #{operator},
|
||||||
|
</if>
|
||||||
|
<if test="isDelivery != null">
|
||||||
|
is_delivery = #{isDelivery},
|
||||||
|
</if>
|
||||||
|
<if test="isUploadPhoto != null">
|
||||||
|
is_upload_photo = #{isUploadPhoto},
|
||||||
|
</if>
|
||||||
|
<if test="demandDeptName != null">
|
||||||
|
demand_dept_name = #{demandDeptName},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
WHERE bill_no = #{billNo}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="countRkInfoByLocationCode" parameterType="String" resultType="int">
|
||||||
|
SELECT COUNT(1)
|
||||||
|
FROM rk_info
|
||||||
|
WHERE pcode = #{locationCode}
|
||||||
|
AND (is_delete = '0' OR is_delete IS NULL)
|
||||||
|
AND exec_status = 1
|
||||||
|
AND is_chuku = 0
|
||||||
|
AND IFNULL(real_qty, 0) > 0
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -86,6 +86,8 @@
|
|||||||
<result property="operatorName" column="operatorName"/>
|
<result property="operatorName" column="operatorName"/>
|
||||||
<result property="parentWarehouseName" column="parentWarehouseName"/>
|
<result property="parentWarehouseName" column="parentWarehouseName"/>
|
||||||
<result property="warehouseName" column="warehouseName"/>
|
<result property="warehouseName" column="warehouseName"/>
|
||||||
|
<result property="isUploadPhoto" column="is_upload_photo"/>
|
||||||
|
<result property="demandDeptName" column="demand_dept_name"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- ===================== 查询字段(统一视图) ===================== -->
|
<!-- ===================== 查询字段(统一视图) ===================== -->
|
||||||
@@ -231,6 +233,12 @@
|
|||||||
AND rr.is_delete = #{isDelete}
|
AND rr.is_delete = #{isDelete}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
<if test="isUploadPhoto != null ">
|
||||||
|
AND rr.is_upload_photo = #{isUploadPhoto}
|
||||||
|
</if>
|
||||||
|
<if test="demandDeptName != null and demandDeptName != ''">
|
||||||
|
AND rr.demand_dept_name = #{demandDeptName}
|
||||||
|
</if>
|
||||||
<!-- ================= 时间条件(最终正确版) ================= -->
|
<!-- ================= 时间条件(最终正确版) ================= -->
|
||||||
<if test="startDate != null or endDate != null">
|
<if test="startDate != null or endDate != null">
|
||||||
AND (
|
AND (
|
||||||
@@ -404,7 +412,9 @@
|
|||||||
create_time,
|
create_time,
|
||||||
update_by,
|
update_by,
|
||||||
update_time,
|
update_time,
|
||||||
is_delete
|
is_delete,
|
||||||
|
is_upload_photo,
|
||||||
|
demand_dept_name
|
||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
|
|
||||||
@@ -471,7 +481,9 @@
|
|||||||
#{createTime},
|
#{createTime},
|
||||||
#{updateBy},
|
#{updateBy},
|
||||||
#{updateTime},
|
#{updateTime},
|
||||||
#{isDelete}
|
#{isDelete},
|
||||||
|
#{isUploadPhoto},
|
||||||
|
#{demandDeptName}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -542,6 +554,8 @@
|
|||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||||
|
<if test="isUploadPhoto != null">is_upload_photo = #{isUploadPhoto},</if>
|
||||||
|
<if test="demandDeptName != null">demand_dept_name = #{demandDeptName},</if>
|
||||||
</trim>
|
</trim>
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
@@ -695,7 +709,12 @@
|
|||||||
<if test="isBorrowed != null and isBorrowed != ''">
|
<if test="isBorrowed != null and isBorrowed != ''">
|
||||||
AND rr.is_borrowed = #{isBorrowed}
|
AND rr.is_borrowed = #{isBorrowed}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="isUploadPhoto != null ">
|
||||||
|
AND rr.is_upload_photo = #{isUploadPhoto}
|
||||||
|
</if>
|
||||||
|
<if test="demandDeptName != null and demandDeptName != ''">
|
||||||
|
AND rr.demand_dept_name = #{demandDeptName}
|
||||||
|
</if>
|
||||||
<!-- 删除标识 -->
|
<!-- 删除标识 -->
|
||||||
<if test="isDelete == null">
|
<if test="isDelete == null">
|
||||||
AND (rr.is_delete = '0' OR rr.is_delete = 0 OR rr.is_delete IS NULL)
|
AND (rr.is_delete = '0' OR rr.is_delete = 0 OR rr.is_delete IS NULL)
|
||||||
@@ -840,6 +859,15 @@
|
|||||||
<if test="endDate != null">
|
<if test="endDate != null">
|
||||||
AND rr.operation_time < DATE_ADD(#{endDate}, INTERVAL 1 DAY)
|
AND rr.operation_time < DATE_ADD(#{endDate}, INTERVAL 1 DAY)
|
||||||
</if>
|
</if>
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
AND rr.remark LIKE CONCAT('%', #{remark}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="isUploadPhoto != null ">
|
||||||
|
AND rr.is_upload_photo = #{isUploadPhoto}
|
||||||
|
</if>
|
||||||
|
<if test="demandDeptName != null and demandDeptName != ''">
|
||||||
|
AND rr.demand_dept_name = #{demandDeptName}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
@@ -918,7 +946,9 @@
|
|||||||
<if test="operationType != null">
|
<if test="operationType != null">
|
||||||
operation_type = #{operationType},
|
operation_type = #{operationType},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="wlType != null">
|
||||||
|
wl_type = #{wlType},
|
||||||
|
</if>
|
||||||
<if test="teamCode != null">
|
<if test="teamCode != null">
|
||||||
team_code = #{teamCode},
|
team_code = #{teamCode},
|
||||||
</if>
|
</if>
|
||||||
@@ -930,7 +960,12 @@
|
|||||||
<if test="isDelivery != null">
|
<if test="isDelivery != null">
|
||||||
is_delivery = #{isDelivery},
|
is_delivery = #{isDelivery},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="isUploadPhoto != null">
|
||||||
|
is_upload_photo = #{isUploadPhoto},
|
||||||
|
</if>
|
||||||
|
<if test="demandDeptName != null">
|
||||||
|
demand_dept_name = #{demandDeptName},
|
||||||
|
</if>
|
||||||
update_time = NOW()
|
update_time = NOW()
|
||||||
</set>
|
</set>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user