新增配送物料字段

优化u其他逻辑
This commit is contained in:
2025-10-29 10:15:30 +08:00
parent 69d07fcdf4
commit db8e6c514c
21 changed files with 1069 additions and 206 deletions

View File

@@ -0,0 +1,112 @@
package com.zg.project.information.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.zg.framework.aspectj.lang.annotation.Log;
import com.zg.framework.aspectj.lang.enums.BusinessType;
import com.zg.project.information.domain.DeliveryMtd;
import com.zg.project.information.service.IDeliveryMtdService;
import com.zg.framework.web.controller.BaseController;
import com.zg.framework.web.domain.AjaxResult;
import com.zg.common.utils.poi.ExcelUtil;
import com.zg.framework.web.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* 配送系统物料字典Controller
*
* @author zg
* @date 2025-10-24
*/
@RestController
@RequestMapping("/information/delivery")
public class DeliveryMtdController extends BaseController
{
@Autowired
private IDeliveryMtdService deliveryMtdService;
/**
* 查询配送系统物料字典列表
*/
@PreAuthorize("@ss.hasPermi('information:delivery:list')")
@GetMapping("/list")
public TableDataInfo list(DeliveryMtd deliveryMtd)
{
startPage();
List<DeliveryMtd> list = deliveryMtdService.selectDeliveryMtdList(deliveryMtd);
return getDataTable(list);
}
/**
* 导出配送系统物料字典列表
*/
@PreAuthorize("@ss.hasPermi('information:delivery:export')")
@Log(title = "配送系统物料字典", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DeliveryMtd deliveryMtd)
{
List<DeliveryMtd> list = deliveryMtdService.selectDeliveryMtdList(deliveryMtd);
ExcelUtil<DeliveryMtd> util = new ExcelUtil<DeliveryMtd>(DeliveryMtd.class);
util.exportExcel(response, list, "配送系统物料字典数据");
}
@PreAuthorize("@ss.hasPermi('information:delivery:import')")
@Log(title = "配送系统物料字典", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
public AjaxResult importData(@RequestParam("file") MultipartFile file) throws Exception
{
if (file == null || file.isEmpty()) {
return AjaxResult.error("导入文件不能为空");
}
ExcelUtil<DeliveryMtd> util = new ExcelUtil<>(DeliveryMtd.class);
List<DeliveryMtd> list = util.importExcel(file.getInputStream());
int handled = deliveryMtdService.importDeliveryMtd(list, getUsername());
return success("导入成功,共处理 " + handled + "");
}
/**
* 获取配送系统物料字典详细信息
*/
@PreAuthorize("@ss.hasPermi('information:delivery:query')")
@GetMapping(value = "/{Id}")
public AjaxResult getInfo(@PathVariable("Id") Long Id)
{
return success(deliveryMtdService.selectDeliveryMtdById(Id));
}
/**
* 新增配送系统物料字典
*/
@PreAuthorize("@ss.hasPermi('information:delivery:add')")
@Log(title = "配送系统物料字典", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DeliveryMtd deliveryMtd)
{
return toAjax(deliveryMtdService.insertDeliveryMtd(deliveryMtd));
}
/**
* 修改配送系统物料字典
*/
@PreAuthorize("@ss.hasPermi('information:delivery:edit')")
@Log(title = "配送系统物料字典", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DeliveryMtd deliveryMtd)
{
return toAjax(deliveryMtdService.updateDeliveryMtd(deliveryMtd));
}
/**
* 删除配送系统物料字典
*/
@PreAuthorize("@ss.hasPermi('information:delivery:remove')")
@Log(title = "配送系统物料字典", businessType = BusinessType.DELETE)
@DeleteMapping("/{Ids}")
public AjaxResult remove(@PathVariable Long[] Ids)
{
return toAjax(deliveryMtdService.deleteDeliveryMtdByIds(Ids));
}
}

View File

@@ -4,14 +4,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zg.framework.aspectj.lang.annotation.Log; import com.zg.framework.aspectj.lang.annotation.Log;
import com.zg.framework.aspectj.lang.enums.BusinessType; import com.zg.framework.aspectj.lang.enums.BusinessType;
import com.zg.project.information.domain.Mtd; import com.zg.project.information.domain.Mtd;
@@ -20,6 +13,7 @@ import com.zg.framework.web.controller.BaseController;
import com.zg.framework.web.domain.AjaxResult; import com.zg.framework.web.domain.AjaxResult;
import com.zg.common.utils.poi.ExcelUtil; import com.zg.common.utils.poi.ExcelUtil;
import com.zg.framework.web.page.TableDataInfo; import com.zg.framework.web.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* 物料字典Controller * 物料字典Controller
@@ -59,6 +53,23 @@ public class MtdController extends BaseController
util.exportExcel(response, list, "物料字典数据"); util.exportExcel(response, list, "物料字典数据");
} }
/**
* Excel 导入数据(存在则更新,不存在则新增)
*/
@PreAuthorize("@ss.hasPermi('information:mtd:import')")
@Log(title = "物料字典", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
public AjaxResult importData(@RequestParam("file") MultipartFile file,
@RequestParam(value = "updateSupport", defaultValue = "true") boolean updateSupport) throws Exception
{
ExcelUtil<Mtd> util = new ExcelUtil<>(Mtd.class);
List<Mtd> mtdList = util.importExcel(file.getInputStream());
String operName = getUsername();
// String operName = "大爷的!!!";
String message = mtdService.importMtd(mtdList, updateSupport, operName);
return success(message);
}
/** /**
* 获取物料字典详细信息 * 获取物料字典详细信息
*/ */
@@ -101,4 +112,13 @@ public class MtdController extends BaseController
{ {
return toAjax(mtdService.deleteMtdByIds(Ids)); return toAjax(mtdService.deleteMtdByIds(Ids));
} }
@PreAuthorize("@ss.hasPermi('information:mtd:sync')")
@Log(title = "物料字典", businessType = BusinessType.OTHER)
@GetMapping("/syncFromPlan")
public AjaxResult syncFromPlan() {
String operName = getUsername();
int inserted = mtdService.syncFromGysPlan(operName);
return success("同步完成:新增 " + inserted + " 条。");
}
} }

View File

@@ -0,0 +1,132 @@
package com.zg.project.information.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zg.framework.aspectj.lang.annotation.Excel;
import com.zg.framework.web.domain.BaseEntity;
/**
* 配送系统物料字典对象 delivery_mtd
*
* @author zg
* @date 2025-10-24
*/
public class DeliveryMtd extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long Id;
/** 物料号 */
@Excel(name = "物料号")
private String wlNo;
/** 物料描述 */
@Excel(name = "物料描述")
private String wlMs;
/** 单位 */
@Excel(name = "单位")
private String dw;
/** 单件重量(kg) */
@Excel(name = "单件重量(kg)")
private BigDecimal weightKg;
/** 单件体积(立方米) */
@Excel(name = "单件体积(立方米)")
private BigDecimal volumeM3;
/** 是否删除(0正常 1删除) */
@Excel(name = "是否删除(0正常 1删除)")
private String isDelete;
public void setId(Long Id)
{
this.Id = Id;
}
public Long getId()
{
return Id;
}
public void setWlNo(String wlNo)
{
this.wlNo = wlNo;
}
public String getWlNo()
{
return wlNo;
}
public void setWlMs(String wlMs)
{
this.wlMs = wlMs;
}
public String getWlMs()
{
return wlMs;
}
public void setDw(String dw)
{
this.dw = dw;
}
public String getDw()
{
return dw;
}
public void setWeightKg(BigDecimal weightKg)
{
this.weightKg = weightKg;
}
public BigDecimal getWeightKg()
{
return weightKg;
}
public void setVolumeM3(BigDecimal volumeM3)
{
this.volumeM3 = volumeM3;
}
public BigDecimal getVolumeM3()
{
return volumeM3;
}
public void setIsDelete(String isDelete)
{
this.isDelete = isDelete;
}
public String getIsDelete()
{
return isDelete;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("Id", getId())
.append("wlNo", getWlNo())
.append("wlMs", getWlMs())
.append("dw", getDw())
.append("weightKg", getWeightKg())
.append("volumeM3", getVolumeM3())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("isDelete", getIsDelete())
.toString();
}
}

View File

@@ -0,0 +1,68 @@
package com.zg.project.information.mapper;
import java.util.List;
import com.zg.project.information.domain.DeliveryMtd;
/**
* 配送系统物料字典Mapper接口
*
* @author zg
* @date 2025-10-24
*/
public interface DeliveryMtdMapper
{
/**
* 查询配送系统物料字典
*
* @param Id 配送系统物料字典主键
* @return 配送系统物料字典
*/
public DeliveryMtd selectDeliveryMtdById(Long Id);
/**
* 查询配送系统物料字典列表
*
* @param deliveryMtd 配送系统物料字典
* @return 配送系统物料字典集合
*/
public List<DeliveryMtd> selectDeliveryMtdList(DeliveryMtd deliveryMtd);
/**
* 新增配送系统物料字典
*
* @param deliveryMtd 配送系统物料字典
* @return 结果
*/
public int insertDeliveryMtd(DeliveryMtd deliveryMtd);
/**
* 修改配送系统物料字典
*
* @param deliveryMtd 配送系统物料字典
* @return 结果
*/
public int updateDeliveryMtd(DeliveryMtd deliveryMtd);
/**
* 删除配送系统物料字典
*
* @param Id 配送系统物料字典主键
* @return 结果
*/
public int deleteDeliveryMtdById(Long Id);
/**
* 批量删除配送系统物料字典
*
* @param Ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDeliveryMtdByIds(Long[] Ids);
/**
* 批量插入数据
* @param clean
* @return
*/
int batchUpsertDeliveryMtd(List<DeliveryMtd> clean);
}

View File

@@ -65,4 +65,11 @@ public interface MtdMapper
* @return * @return
*/ */
String selectWlmsByWlbh(String materialCode); String selectWlmsByWlbh(String materialCode);
/**
* 根据物料编码查询物料信息
* @param
* @return
*/
Mtd selectMtdByMid(String trim);
} }

View File

@@ -0,0 +1,69 @@
package com.zg.project.information.service;
import java.util.List;
import com.zg.project.information.domain.DeliveryMtd;
/**
* 配送系统物料字典Service接口
*
* @author zg
* @date 2025-10-24
*/
public interface IDeliveryMtdService
{
/**
* 查询配送系统物料字典
*
* @param Id 配送系统物料字典主键
* @return 配送系统物料字典
*/
public DeliveryMtd selectDeliveryMtdById(Long Id);
/**
* 查询配送系统物料字典列表
*
* @param deliveryMtd 配送系统物料字典
* @return 配送系统物料字典集合
*/
public List<DeliveryMtd> selectDeliveryMtdList(DeliveryMtd deliveryMtd);
/**
* 新增配送系统物料字典
*
* @param deliveryMtd 配送系统物料字典
* @return 结果
*/
public int insertDeliveryMtd(DeliveryMtd deliveryMtd);
/**
* 修改配送系统物料字典
*
* @param deliveryMtd 配送系统物料字典
* @return 结果
*/
public int updateDeliveryMtd(DeliveryMtd deliveryMtd);
/**
* 批量删除配送系统物料字典
*
* @param Ids 需要删除的配送系统物料字典主键集合
* @return 结果
*/
public int deleteDeliveryMtdByIds(Long[] Ids);
/**
* 删除配送系统物料字典信息
*
* @param Id 配送系统物料字典主键
* @return 结果
*/
public int deleteDeliveryMtdById(Long Id);
/**
* 批量导入UPSERT依赖 wl_no 唯一索引)
* @param list 数据
* @param operator 操作人
* @return 处理条数
*/
int importDeliveryMtd(List<DeliveryMtd> list, String operator);
}

View File

@@ -58,4 +58,17 @@ public interface IMtdService
* @return 结果 * @return 结果
*/ */
public int deleteMtdById(Long Id); public int deleteMtdById(Long Id);
/**
* 导入物料字典数据
*
* @param mtdList 物料字典数据列表
* @param updateSupport 是否更新已经存在的物料字典数据
* @param operName 操作人员
* @return 结果
*/
String importMtd(List<Mtd> mtdList, boolean updateSupport, String operName);
int syncFromGysPlan(String operName);
} }

View File

@@ -0,0 +1,132 @@
package com.zg.project.information.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.zg.common.exception.ServiceException;
import com.zg.common.utils.DateUtils;
import com.zg.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zg.project.information.mapper.DeliveryMtdMapper;
import com.zg.project.information.domain.DeliveryMtd;
import com.zg.project.information.service.IDeliveryMtdService;
/**
* 配送系统物料字典Service业务层处理
*
* @author zg
* @date 2025-10-24
*/
@Service
public class DeliveryMtdServiceImpl implements IDeliveryMtdService
{
@Autowired
private DeliveryMtdMapper deliveryMtdMapper;
/**
* 查询配送系统物料字典
*
* @param Id 配送系统物料字典主键
* @return 配送系统物料字典
*/
@Override
public DeliveryMtd selectDeliveryMtdById(Long Id)
{
return deliveryMtdMapper.selectDeliveryMtdById(Id);
}
/**
* 查询配送系统物料字典列表
*
* @param deliveryMtd 配送系统物料字典
* @return 配送系统物料字典
*/
@Override
public List<DeliveryMtd> selectDeliveryMtdList(DeliveryMtd deliveryMtd)
{
return deliveryMtdMapper.selectDeliveryMtdList(deliveryMtd);
}
/**
* 新增配送系统物料字典
*
* @param deliveryMtd 配送系统物料字典
* @return 结果
*/
@Override
public int insertDeliveryMtd(DeliveryMtd deliveryMtd)
{
deliveryMtd.setCreateTime(DateUtils.getNowDate());
return deliveryMtdMapper.insertDeliveryMtd(deliveryMtd);
}
/**
* 修改配送系统物料字典
*
* @param deliveryMtd 配送系统物料字典
* @return 结果
*/
@Override
public int updateDeliveryMtd(DeliveryMtd deliveryMtd)
{
deliveryMtd.setUpdateTime(DateUtils.getNowDate());
return deliveryMtdMapper.updateDeliveryMtd(deliveryMtd);
}
/**
* 批量删除配送系统物料字典
*
* @param Ids 需要删除的配送系统物料字典主键
* @return 结果
*/
@Override
public int deleteDeliveryMtdByIds(Long[] Ids)
{
return deliveryMtdMapper.deleteDeliveryMtdByIds(Ids);
}
/**
* 删除配送系统物料字典信息
*
* @param Id 配送系统物料字典主键
* @return 结果
*/
@Override
public int deleteDeliveryMtdById(Long Id)
{
return deliveryMtdMapper.deleteDeliveryMtdById(Id);
}
@Override
public int importDeliveryMtd(List<DeliveryMtd> list, String operator)
{
if (list == null || list.isEmpty()) {
throw new ServiceException("导入数据为空");
}
// 清洗与校验
List<DeliveryMtd> clean = new ArrayList<>(list.size());
for (DeliveryMtd m : list) {
if (m == null) continue;
if (StringUtils.isEmpty(m.getWlNo())) {
// wlNo 必填,缺失则跳过
continue;
}
m.setWlNo(m.getWlNo().trim());
if (StringUtils.isEmpty(m.getIsDelete())) m.setIsDelete("0");
// 写入操作人与时间
m.setUpdateBy(operator);
m.setUpdateTime(DateUtils.getNowDate());
if (m.getCreateBy() == null) m.setCreateBy(operator);
if (m.getCreateTime() == null) m.setCreateTime(DateUtils.getNowDate());
clean.add(m);
}
if (clean.isEmpty()) {
throw new ServiceException("有效导入数据为空(缺少 wlNo");
}
// 批量 UPSERT依赖 delivery_mtd.wl_no 唯一索引)
return deliveryMtdMapper.batchUpsertDeliveryMtd(clean);
}
}

View File

@@ -1,11 +1,21 @@
package com.zg.project.information.service.impl; package com.zg.project.information.service.impl;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger;
import com.zg.common.exception.ServiceException;
import com.zg.project.wisdom.domain.vo.PlanToMtdVO;
import com.zg.project.wisdom.mapper.GysJhMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zg.project.information.mapper.MtdMapper; import com.zg.project.information.mapper.MtdMapper;
import com.zg.project.information.domain.Mtd; import com.zg.project.information.domain.Mtd;
import com.zg.project.information.service.IMtdService; import com.zg.project.information.service.IMtdService;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 物料字典Service业务层处理 * 物料字典Service业务层处理
@@ -19,6 +29,13 @@ public class MtdServiceImpl implements IMtdService
@Autowired @Autowired
private MtdMapper mtdMapper; private MtdMapper mtdMapper;
// 注入若依内置线程池
@Autowired
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
@Autowired
private GysJhMapper gysJhMapper;
/** /**
* 查询物料字典 * 查询物料字典
* *
@@ -90,4 +107,105 @@ public class MtdServiceImpl implements IMtdService
{ {
return mtdMapper.deleteMtdById(Id); return mtdMapper.deleteMtdById(Id);
} }
/**
* 导入 Excel 数据(存在则更新,不存在则新增)
*/
@Override
public String importMtd(List<Mtd> mtdList, boolean updateSupport, String operName)
{
if (mtdList == null || mtdList.isEmpty()) {
throw new ServiceException("导入数据不能为空!");
}
int nThreads = 3; // 启动3个线程
int size = mtdList.size();
int chunk = (size + nThreads - 1) / nThreads;
AtomicInteger insertCount = new AtomicInteger(0);
AtomicInteger updateCount = new AtomicInteger(0);
AtomicInteger failCount = new AtomicInteger(0);
ConcurrentLinkedQueue<String> errorMsgs = new ConcurrentLinkedQueue<>();
List<CompletableFuture<Void>> futures = new ArrayList<>();
for (int t = 0; t < nThreads; t++) {
int from = t * chunk;
int to = Math.min(from + chunk, size);
if (from >= to) break;
final List<Mtd> part = mtdList.subList(from, to);
final int startRow = 2 + from;
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
for (int i = 0; i < part.size(); i++) {
Mtd row = part.get(i);
int rowNum = startRow + i;
try {
if (row.getMid() == null || row.getMid().trim().isEmpty()) {
failCount.incrementAndGet();
errorMsgs.add("" + rowNum + "行:物料号为空;");
continue;
}
String mid = row.getMid().trim();
Mtd exist = mtdMapper.selectMtdByMid(mid);
if (exist == null) {
row.setCreateBy(operName);
mtdMapper.insertMtd(row);
insertCount.incrementAndGet();
} else if (updateSupport) {
exist.setDesMat(row.getDesMat());
exist.setGrp(row.getGrp());
exist.setUnt(row.getUnt());
exist.setUprc(row.getUprc());
exist.setBtpe(row.getBtpe());
exist.setMtpe(row.getMtpe());
exist.setStpe(row.getStpe());
exist.setUpdateBy(operName);
mtdMapper.updateMtd(exist);
updateCount.incrementAndGet();
} else {
failCount.incrementAndGet();
errorMsgs.add("" + rowNum + "行:物料号(" + mid + ")已存在,跳过;");
}
} catch (Exception e) {
failCount.incrementAndGet();
errorMsgs.add("" + rowNum + "行导入异常:" + e.getMessage() + "");
}
}
}, threadPoolTaskExecutor);
futures.add(future);
}
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
String summary = String.format("导入完成:新增 %d 条,更新 %d 条,失败 %d 条。",
insertCount.get(), updateCount.get(), failCount.get());
if (failCount.get() > 0) {
StringBuilder sb = new StringBuilder(summary).append(" 失败详情:");
errorMsgs.forEach(sb::append);
throw new ServiceException(sb.toString());
}
return summary;
}
@Override
public int syncFromGysPlan(String operName) {
// 查出“供应计划里有、物料字典里没有”的物料(去重)
List<PlanToMtdVO> needAdd = gysJhMapper.selectMissingMtdItems();
if (needAdd == null || needAdd.isEmpty()) return 0;
int cnt = 0;
for (PlanToMtdVO it : needAdd) {
Mtd m = new Mtd();
m.setMid(it.getWlNo()); // 物料号
m.setDesMat(it.getWlMs()); // 物料描述
m.setUnt(it.getDw()); // 单位
m.setUprc(it.getHtDj() == null ? null : it.getHtDj().toPlainString()); // 单价(字符串)
m.setCreateBy(operName);
cnt += mtdMapper.insertMtd(m);
}
return cnt;
}
} }

View File

@@ -251,6 +251,7 @@ public class RkInfoController extends BaseController
List<RkInfo> list = rkInfoService.selectAllRkInfo(dto); List<RkInfo> list = rkInfoService.selectAllRkInfo(dto);
return getDataTable(list); return getDataTable(list);
} }
} }

View File

@@ -251,6 +251,14 @@ public class RkInfo extends BaseEntity
@TableField(exist = false) @TableField(exist = false)
private Date lyEndTime; private Date lyEndTime;
/** 一次封样号 */
@Excel(name = "一次封样号")
private String fycde1;
/** 二次封样号 */
@Excel(name = "二次封样号")
private String fycde2;
/** 是否删除0 表示正常1 表示已删除) */ /** 是否删除0 表示正常1 表示已删除) */
private String isDelete; private String isDelete;
@@ -473,6 +481,23 @@ public class RkInfo extends BaseEntity
public void setAuditResult(String auditResult) { public void setAuditResult(String auditResult) {
this.auditResult = auditResult; this.auditResult = auditResult;
} }
public String getFycde1() {
return fycde1;
}
public void setFycde1(String fycde1) {
this.fycde1 = fycde1;
}
public String getFycde2() {
return fycde2;
}
public void setFycde2(String fycde2) {
this.fycde2 = fycde2;
}
public String getIsDelete() { return isDelete; } public String getIsDelete() { return isDelete; }
public void setIsDelete(String isDelete) { this.isDelete = isDelete; } public void setIsDelete(String isDelete) { this.isDelete = isDelete; }
@@ -547,6 +572,8 @@ public class RkInfo extends BaseEntity
.append("isChukuList", getIsChukuList()) .append("isChukuList", getIsChukuList())
.append("lyStartTime", getLyStartTime()) .append("lyStartTime", getLyStartTime())
.append("lyEndTime", getLyEndTime()) .append("lyEndTime", getLyEndTime())
.append("fycde1", getFycde1())
.append("fycde2", getFycde2())
.append("isDelete", getIsDelete()) .append("isDelete", getIsDelete())
.toString(); .toString();
} }

View File

@@ -73,6 +73,12 @@ public class PcRkInfoItemDTO {
/** 实物 ID */ /** 实物 ID */
private String entityId; private String entityId;
/*一次封样号*/
private String fycde1;
/*二次封样号*/
private String fycde2;
/** 备注 */ /** 备注 */
private String remark; private String remark;

View File

@@ -0,0 +1,13 @@
package com.zg.project.wisdom.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class PlanToMtdVO {
private String wlNo; // 物料号
private String wlMs; // 物料描述
private String dw; // 单位
private BigDecimal htDj; // 合同单价
}

View File

@@ -6,6 +6,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import com.zg.project.wisdom.domain.GysJh; import com.zg.project.wisdom.domain.GysJh;
import com.zg.project.wisdom.domain.vo.PlanToMtdVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
@@ -114,4 +115,12 @@ public interface GysJhMapper
* @param realQty * @param realQty
*/ */
void decreaseJhQtyById(@Param("id") Long id, @Param("realQty") BigDecimal realQty); void decreaseJhQtyById(@Param("id") Long id, @Param("realQty") BigDecimal realQty);
/**
* 查询缺失的物料
* @return
*/
List<PlanToMtdVO> selectMissingMtdItems();
} }

View File

@@ -343,6 +343,8 @@ public class RkInfoServiceImpl implements IRkInfoService
rk.setCreateTime(now); rk.setCreateTime(now);
rk.setIsDelete("0"); rk.setIsDelete("0");
rk.setGysJhId(item.getGysJhId()); rk.setGysJhId(item.getGysJhId());
rk.setFycde1(item.getFycde1());
rk.setFycde2(item.getFycde2());
if (needAudit) { if (needAudit) {
rk.setStatus("0"); // 待审核 rk.setStatus("0"); // 待审核
@@ -758,6 +760,9 @@ public class RkInfoServiceImpl implements IRkInfoService
throw new ServiceException("匹配失败缺少场景ID"); throw new ServiceException("匹配失败缺少场景ID");
} }
//根据任务ID修改任务状态
taskMapper.updateStatus(dto.getTaskId(), "1");
// 自动盘点必须有设备 ID // 自动盘点必须有设备 ID
String deviceId = dto.getDeviceId(); String deviceId = dto.getDeviceId();
int scanType = dto.getScanType() != null ? dto.getScanType() : 0; // 扫描类型0=手动盘点1=自动盘点 int scanType = dto.getScanType() != null ? dto.getScanType() : 0; // 扫描类型0=手动盘点1=自动盘点

View File

@@ -7,9 +7,9 @@ spring:
# 主库数据源 # 主库数据源
master: master:
# url: jdbc:mysql://101.132.133.142:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # url: jdbc:mysql://101.132.133.142:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://192.168.1.20:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # url: jdbc:mysql://192.168.1.20:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://192.168.1.192:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # url: jdbc:mysql://192.168.1.192:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://localhost:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # url: jdbc:mysql://localhost:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: shzg password: shzg

View File

@@ -69,8 +69,8 @@ spring:
redis: redis:
# 地址 # 地址
# host: 101.132.133.142 # host: 101.132.133.142
host: 192.168.1.20 # host: 192.168.1.20
# host: 192.168.1.251 host: 192.168.1.251
# host: localhost # host: localhost
# 端口默认为6379 # 端口默认为6379
port: 6379 port: 6379

View File

@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zg.project.information.mapper.DeliveryMtdMapper">
<resultMap type="DeliveryMtd" id="DeliveryMtdResult">
<result property="Id" column="Id" />
<result property="wlNo" column="wl_no" />
<result property="wlMs" column="wl_ms" />
<result property="dw" column="dw" />
<result property="weightKg" column="weight_kg" />
<result property="volumeM3" column="volume_m3" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="isDelete" column="is_delete" />
</resultMap>
<sql id="selectDeliveryMtdVo">
select Id, wl_no, wl_ms, dw, weight_kg, volume_m3, create_by, create_time, update_by, update_time, is_delete from delivery_mtd
</sql>
<select id="selectDeliveryMtdList" parameterType="DeliveryMtd" resultMap="DeliveryMtdResult">
<include refid="selectDeliveryMtdVo"/>
<where>
<if test="wlNo != null and wlNo != ''"> and wl_no = #{wlNo}</if>
<if test="wlMs != null and wlMs != ''"> and wl_ms = #{wlMs}</if>
<if test="dw != null and dw != ''"> and dw = #{dw}</if>
<if test="weightKg != null "> and weight_kg = #{weightKg}</if>
<if test="volumeM3 != null "> and volume_m3 = #{volumeM3}</if>
<if test="isDelete != null and isDelete != ''"> and is_delete = #{isDelete}</if>
</where>
</select>
<select id="selectDeliveryMtdById" parameterType="Long" resultMap="DeliveryMtdResult">
<include refid="selectDeliveryMtdVo"/>
where Id = #{Id}
</select>
<insert id="insertDeliveryMtd" parameterType="DeliveryMtd" useGeneratedKeys="true" keyProperty="Id">
insert into delivery_mtd
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="wlNo != null">wl_no,</if>
<if test="wlMs != null">wl_ms,</if>
<if test="dw != null">dw,</if>
<if test="weightKg != null">weight_kg,</if>
<if test="volumeM3 != null">volume_m3,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="isDelete != null">is_delete,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="wlNo != null">#{wlNo},</if>
<if test="wlMs != null">#{wlMs},</if>
<if test="dw != null">#{dw},</if>
<if test="weightKg != null">#{weightKg},</if>
<if test="volumeM3 != null">#{volumeM3},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="isDelete != null">#{isDelete},</if>
</trim>
</insert>
<update id="updateDeliveryMtd" parameterType="DeliveryMtd">
update delivery_mtd
<trim prefix="SET" suffixOverrides=",">
<if test="wlNo != null">wl_no = #{wlNo},</if>
<if test="wlMs != null">wl_ms = #{wlMs},</if>
<if test="dw != null">dw = #{dw},</if>
<if test="weightKg != null">weight_kg = #{weightKg},</if>
<if test="volumeM3 != null">volume_m3 = #{volumeM3},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
</trim>
where Id = #{Id}
</update>
<insert id="batchUpsertDeliveryMtd" parameterType="java.util.List">
INSERT INTO delivery_mtd
(wl_no, wl_ms, dw, weight_kg, volume_m3, create_by, create_time, update_by, update_time, is_delete)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.wlNo}, #{item.wlMs}, #{item.dw}, #{item.weightKg}, #{item.volumeM3},
#{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.isDelete})
</foreach>
ON DUPLICATE KEY UPDATE
wl_ms = VALUES(wl_ms),
dw = VALUES(dw),
weight_kg = VALUES(weight_kg),
volume_m3 = VALUES(volume_m3),
update_by = VALUES(update_by),
update_time = VALUES(update_time),
is_delete = VALUES(is_delete)
</insert>
<delete id="deleteDeliveryMtdById" parameterType="Long">
delete from delivery_mtd where Id = #{Id}
</delete>
<delete id="deleteDeliveryMtdByIds" parameterType="String">
delete from delivery_mtd where Id in
<foreach item="Id" collection="array" open="(" separator="," close=")">
#{Id}
</foreach>
</delete>
</mapper>

View File

@@ -45,6 +45,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE mid = #{materialCode} WHERE mid = #{materialCode}
</select> </select>
<select id="selectMtdByMid" resultMap="MtdResult">
SELECT * FROM mtd WHERE mid = #{mid} LIMIT 1
</select>
<insert id="insertMtd" parameterType="Mtd" useGeneratedKeys="true" keyProperty="Id"> <insert id="insertMtd" parameterType="Mtd" useGeneratedKeys="true" keyProperty="Id">
insert into mtd insert into mtd
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

View File

@@ -93,6 +93,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</select> </select>
<select id="selectMissingMtdItems" resultType="com.zg.project.wisdom.domain.vo.PlanToMtdVO">
SELECT
g.wl_no AS wlNo,
MAX(g.wl_ms) AS wlMs,
MAX(g.dw) AS dw,
MAX(g.ht_dj) AS htDj
FROM gys_jh g
LEFT JOIN mtd m ON m.mid = g.wl_no
WHERE g.wl_no IS NOT NULL AND g.wl_no &lt;&gt; ''
AND m.mid IS NULL
GROUP BY g.wl_no
</select>
<insert id="insertGysJh" parameterType="GysJh" useGeneratedKeys="true" keyProperty="id"> <insert id="insertGysJh" parameterType="GysJh" useGeneratedKeys="true" keyProperty="id">
insert into gys_jh insert into gys_jh
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zg.project.wisdom.mapper.RkInfoMapper"> <mapper namespace="com.zg.project.wisdom.mapper.RkInfoMapper">
<resultMap type="RkInfo" id="RkInfoResult"> <resultMap type="RkInfo" id="RkInfoResult">
@@ -57,9 +57,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="isDelete" column="is_delete" /> <result property="isDelete" column="is_delete" />
<result property="hasMoved" column="has_moved"/> <result property="hasMoved" column="has_moved"/>
<result property="lihuoYName" column="lihuo_y_name"/> <result property="lihuoYName" column="lihuo_y_name"/>
<result property="fycde1" column="fycde_1"/>
<result property="fycde2" column="fycde_2"/>
<result property="isDelivery" column="is_delivery"/> <result property="isDelivery" column="is_delivery"/>
</resultMap> </resultMap>
<!-- 明细查询SQL包含多表JOIN用于普通明细/分页等) -->
<sql id="selectRkInfoVo"> <sql id="selectRkInfoVo">
SELECT SELECT
ri.id, ri.id,
@@ -73,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ri.team_code, ct.team_name, ri.team_code, ct.team_name,
ri.ck_remark, ri.ck_remark,
ri.ly_time, ri.ly_time,
ri.fycde_1, ri.fycde_2,
ri.borrow_time, ri.return_time, ri.borrow_time, ri.return_time,
ri.xj, ri.xm_no, ri.xm_ms, ri.wl_no, ri.wl_ms, ri.xm_no_ck, ri.xm_ms_ck, ri.xj, ri.xm_no, ri.xm_ms, ri.wl_no, ri.wl_ms, ri.xm_no_ck, ri.xm_ms_ck,
ri.gys_no, ri.gys_mc, ri.jh_amt, ri.ht_dj, ri.sap_no, ri.xh, ri.gys_jh_id, ri.gys_no, ri.gys_mc, ri.jh_amt, ri.ht_dj, ri.sap_no, ri.xh, ri.gys_jh_id,
@@ -90,6 +94,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN sys_user u ON ri.lihuo_y = u.user_id LEFT JOIN sys_user u ON ri.lihuo_y = u.user_id
</sql> </sql>
<!-- 轻量分组专用SQL仅rk_info字段不做JOIN供按单据分组内层使用 -->
<sql id="selectRkInfoForGroup">
SELECT
ri.id,
ri.bill_no,
ri.bill_no_ck,
ri.rk_type,
ri.wl_type,
ri.cangku,
ri.rk_time,
ri.lihuo_y,
ri.is_chuku,
ri.xj,
ri.xm_no,
ri.xm_ms,
ri.xm_no_ck,
ri.xm_ms_ck,
ri.gys_mc,
ri.wl_no,
ri.wl_ms,
ri.gys_no,
ri.sap_no,
ri.ck_type,
ri.ly_time,
ri.ck_lihuo_y,
ri.pcode,
ri.is_delete
FROM rk_info ri
</sql>
<insert id="batchInsertRkInfo" <insert id="batchInsertRkInfo"
parameterType="java.util.List" parameterType="java.util.List"
useGeneratedKeys="true" useGeneratedKeys="true"
@@ -101,7 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
xm_no_ck, xm_ms_ck, xj, sap_no, gys_no, gys_mc, xm_no_ck, xm_ms_ck, xj, sap_no, gys_no, gys_mc,
jh_qty, ht_qty, jh_amt, ht_dj, dw, jh_qty, ht_qty, jh_amt, ht_dj, dw,
borrow_time, return_time, status, borrow_time, return_time, status,
pcode, pcode_id, tray_code, real_qty, entity_id, pcode, pcode_id, tray_code, real_qty, entity_id, fycde_1, fycde_2,
remark, is_chuku, is_borrowed, gys_jh_id, remark, is_chuku, is_borrowed, gys_jh_id,
is_delete, create_by, create_time is_delete, create_by, create_time
) )
@@ -114,7 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.xmNoCk}, #{item.xmMsCk}, #{item.xj}, #{item.sapNo}, #{item.gysNo}, #{item.gysMc}, #{item.xmNoCk}, #{item.xmMsCk}, #{item.xj}, #{item.sapNo}, #{item.gysNo}, #{item.gysMc},
#{item.jhQty}, #{item.htQty}, #{item.jhAmt}, #{item.htDj}, #{item.dw}, #{item.jhQty}, #{item.htQty}, #{item.jhAmt}, #{item.htDj}, #{item.dw},
#{item.borrowTime}, #{item.returnTime}, #{item.status}, #{item.borrowTime}, #{item.returnTime}, #{item.status},
#{item.pcode}, #{item.pcodeId}, #{item.trayCode}, #{item.realQty}, #{item.entityId}, #{item.pcode}, #{item.pcodeId}, #{item.trayCode}, #{item.realQty}, #{item.entityId}, #{item.fycde1}, #{item.fycde2},
#{item.remark}, #{item.isChuku}, #{item.isBorrowed}, #{item.gysJhId}, #{item.remark}, #{item.isChuku}, #{item.isBorrowed}, #{item.gysJhId},
#{item.isDelete}, #{item.createBy}, #{item.createTime} #{item.isDelete}, #{item.createBy}, #{item.createTime}
) )
@@ -146,7 +180,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) )
</insert> </insert>
<update id="cancelStockOut"> <update id="cancelStockOut">
UPDATE rk_info UPDATE rk_info
SET SET
@@ -186,6 +219,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND ( AND (
ri.xm_no like concat('%', #{keyword}, '%') ri.xm_no like concat('%', #{keyword}, '%')
or ri.xm_ms like concat('%', #{keyword}, '%') or ri.xm_ms like concat('%', #{keyword}, '%')
or ri.fycde_1 like concat('%', #{keyword}, '%')
or ri.fycde_2 like concat('%', #{keyword}, '%')
or ri.wl_no like concat('%', #{keyword}, '%') or ri.wl_no like concat('%', #{keyword}, '%')
or ri.wl_ms like concat('%', #{keyword}, '%') or ri.wl_ms like concat('%', #{keyword}, '%')
or ri.gys_no like concat('%', #{keyword}, '%') or ri.gys_no like concat('%', #{keyword}, '%')
@@ -207,7 +242,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cangku != null and cangku != ''"> <if test="cangku != null and cangku != ''">
AND ri.cangku like concat('%', #{cangku}, '%') AND ri.cangku like concat('%', #{cangku}, '%')
</if> </if>
<if test="fycde1 != null and fycde1 != ''">
AND ri.fycde_1 like concat('%', #{fycde1}, '%')
</if>
<if test="fycde2 != null and fycde2 != ''">
AND ri.fycde_2 like concat('%', #{fycde2}, '%')
</if>
<if test="ids != null and ids.size > 0"> <if test="ids != null and ids.size > 0">
AND ri.id IN AND ri.id IN
<foreach collection="ids" item="id" open="(" separator="," close=")"> <foreach collection="ids" item="id" open="(" separator="," close=")">
@@ -318,12 +358,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY ri.rk_time DESC ORDER BY ri.rk_time DESC
</select> </select>
<!-- <!-- ================== 这里是已优化的按单据分组查询(替换旧版本) ================== -->
按单据分组bill_no列表
复用 <sql id="selectRkInfoVo"> 作为子查询,外层分组聚合
返回字段bill_no、bill_no_ck + 你指定的通用字段rk_type、wl_type、cangku、rk_time、lihuo_y、is_chuku、xj、
xm_no、xm_ms、xm_no_ck、xm_ms_ck、wl_no、wl_ms、gys_no、sap_no
-->
<select id="selectGroupedByBill" resultMap="RkInfoResult" parameterType="map"> <select id="selectGroupedByBill" resultMap="RkInfoResult" parameterType="map">
SELECT SELECT
a.id, a.id,
@@ -355,7 +390,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT SELECT
MIN(t.id) AS id, -- 代表ID MIN(t.id) AS id, -- 代表ID
t.bill_no AS bill_no, -- 分组键 t.bill_no AS bill_no, -- 分组键
MIN(t.bill_no_ck) AS bill_no_ck, -- 代表值 MIN(t.bill_no_ck) AS bill_no_ck,
MIN(t.rk_type) AS rk_type, MIN(t.rk_type) AS rk_type,
MIN(t.wl_type) AS wl_type, MIN(t.wl_type) AS wl_type,
MIN(t.cangku) AS cangku, MIN(t.cangku) AS cangku,
@@ -376,10 +411,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
MAX(t.ly_time) AS ly_time, MAX(t.ly_time) AS ly_time,
MIN(t.ck_lihuo_y) AS ck_lihuo_y MIN(t.ck_lihuo_y) AS ck_lihuo_y
FROM ( FROM (
<!-- 复用已有的明细查询(列别名与 RkInfoResult 一致) --> <include refid="selectRkInfoForGroup"/>
<include refid="selectRkInfoVo"/>
) t ) t
<where> <where>
<!-- 删除标记默认0 -->
<choose>
<when test="q.isDelete != null and q.isDelete != ''">
AND t.is_delete = #{q.isDelete}
</when>
<otherwise>
AND t.is_delete = 0
</otherwise>
</choose>
<!-- is_chuku 优先列表,其次单值 --> <!-- is_chuku 优先列表,其次单值 -->
<choose> <choose>
<when test="q.isChukuList != null and q.isChukuList.size > 0"> <when test="q.isChukuList != null and q.isChukuList.size > 0">
@@ -411,102 +455,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
<!-- 维度筛选 --> <!-- 维度筛选 -->
<if test="q.rkType != null and q.rkType != ''"> <if test="q.rkType != null and q.rkType != ''"> AND t.rk_type LIKE concat('%', #{q.rkType}, '%') </if>
AND t.rk_type LIKE concat('%', #{q.rkType}, '%') <if test="q.wlType != null and q.wlType != ''"> AND t.wl_type LIKE concat('%', #{q.wlType}, '%') </if>
</if> <if test="q.cangku != null and q.cangku != ''"> AND t.cangku LIKE concat('%', #{q.cangku}, '%') </if>
<if test="q.wlType != null and q.wlType != ''">
AND t.wl_type LIKE concat('%', #{q.wlType}, '%')
</if>
<if test="q.cangku != null and q.cangku != ''">
AND t.cangku LIKE concat('%', #{q.cangku}, '%')
</if>
<!-- ID 列表 --> <!-- 入库/领用时间范围(闭区间) -->
<if test="q.ids != null and q.ids.size > 0"> <if test="q.startTime != null"><![CDATA[ AND t.rk_time >= #{q.startTime} ]]></if>
AND t.id IN <if test="q.endTime != null"><![CDATA[ AND t.rk_time <= #{q.endTime} ]]></if>
<foreach collection="q.ids" item="id" open="(" separator="," close=")"> <if test="q.lyStartTime!= null"><![CDATA[ AND t.ly_time >= #{q.lyStartTime}]]></if>
#{id} <if test="q.lyEndTime != null"><![CDATA[ AND t.ly_time <= #{q.lyEndTime} ]]></if>
</foreach>
</if>
<!-- 入库时间范围(闭区间) --> <!-- 其它等值/模糊 -->
<if test="q.startTime != null"><![CDATA[ <if test="q.lihuoY != null and q.lihuoY != ''"> AND t.lihuo_y LIKE concat('%', #{q.lihuoY}, '%') </if>
AND t.rk_time >= #{q.startTime} <if test="q.xj != null and q.xj != ''"> AND t.xj LIKE concat('%', #{q.xj}, '%') </if>
]]></if> <if test="q.billNo != null and q.billNo != ''"> AND t.bill_no LIKE concat('%', #{q.billNo}, '%') </if>
<if test="q.endTime != null"><![CDATA[ <if test="q.billNoCk != null and q.billNoCk != ''"> AND t.bill_no_ck LIKE concat('%', #{q.billNoCk}, '%') </if>
AND t.rk_time <= #{q.endTime} <if test="q.xmNo != null and q.xmNo != ''"> AND t.xm_no LIKE concat('%', #{q.xmNo}, '%') </if>
]]></if> <if test="q.xmMs != null and q.xmMs != ''"> AND t.xm_ms LIKE concat('%', #{q.xmMs}, '%') </if>
<if test="q.wlNo != null and q.wlNo != ''"> AND t.wl_no LIKE concat('%', #{q.wlNo}, '%') </if>
<!-- 领用时间范围(闭区间) --> <if test="q.wlMs != null and q.wlMs != ''"> AND t.wl_ms LIKE concat('%', #{q.wlMs}, '%') </if>
<if test="q.lyStartTime != null"><![CDATA[ <if test="q.gysNo != null and q.gysNo != ''"> AND t.gys_no LIKE concat('%', #{q.gysNo}, '%') </if>
AND t.ly_time >= #{q.lyStartTime} <if test="q.gysMc != null and q.gysMc != ''"> AND t.gys_mc LIKE concat('%', #{q.gysMc}, '%') </if>
]]></if> <if test="q.sapNo != null and q.sapNo != ''"> AND t.sap_no LIKE concat('%', #{q.sapNo}, '%') </if>
<if test="q.lyEndTime != null"><![CDATA[ <if test="q.xh != null and q.xh != ''"> AND t.xh LIKE concat('%', #{q.xh}, '%') </if>
AND t.ly_time <= #{q.lyEndTime} <if test="q.pcode != null and q.pcode != ''"> AND t.pcode LIKE concat('%', #{q.pcode}, '%') </if>
]]></if>
<!-- 其它模糊/等值 -->
<if test="q.lihuoY != null and q.lihuoY != ''">
AND t.lihuo_y LIKE concat('%', #{q.lihuoY}, '%')
</if>
<if test="q.xj != null and q.xj != ''">
AND t.xj LIKE concat('%', #{q.xj}, '%')
</if>
<if test="q.billNo != null and q.billNo != ''">
AND t.bill_no LIKE concat('%', #{q.billNo}, '%')
</if>
<if test="q.billNoCk != null and q.billNoCk != ''">
AND t.bill_no_ck LIKE concat('%', #{q.billNoCk}, '%')
</if>
<if test="q.xmNo != null and q.xmNo != ''">
AND t.xm_no LIKE concat('%', #{q.xmNo}, '%')
</if>
<if test="q.xmMs != null and q.xmMs != ''">
AND t.xm_ms LIKE concat('%', #{q.xmMs}, '%')
</if>
<if test="q.wlNo != null and q.wlNo != ''">
AND t.wl_no LIKE concat('%', #{q.wlNo}, '%')
</if>
<if test="q.wlMs != null and q.wlMs != ''">
AND t.wl_ms LIKE concat('%', #{q.wlMs}, '%')
</if>
<if test="q.gysNo != null and q.gysNo != ''">
AND t.gys_no LIKE concat('%', #{q.gysNo}, '%')
</if>
<if test="q.gysMc != null and q.gysMc != ''">
AND t.gys_mc LIKE concat('%', #{q.gysMc}, '%')
</if>
<if test="q.jhAmt != null"> AND t.jh_amt = #{q.jhAmt} </if>
<if test="q.htDj != null"> AND t.ht_dj = #{q.htDj} </if>
<if test="q.sapNo != null and q.sapNo != ''">
AND t.sap_no LIKE concat('%', #{q.sapNo}, '%')
</if>
<if test="q.xh != null and q.xh != ''">
AND t.xh LIKE concat('%', #{q.xh}, '%')
</if>
<if test="q.jhQty != null"> AND t.jh_qty = #{q.jhQty} </if>
<if test="q.htQty != null"> AND t.ht_qty = #{q.htQty} </if>
<if test="q.dw != null and q.dw != ''">
AND t.dw LIKE concat('%', #{q.dw}, '%')
</if>
<if test="q.realQty != null"> AND t.real_qty = #{q.realQty} </if>
<if test="q.pcode != null and q.pcode != ''">
AND t.pcode LIKE concat('%', #{q.pcode}, '%')
</if>
<if test="q.lyTime != null"> AND t.ly_time = #{q.lyTime} </if>
<if test="q.returnTime != null"> AND t.return_time = #{q.returnTime} </if>
<if test="q.trayCode != null and q.trayCode != ''">
AND t.tray_code LIKE concat('%', #{q.trayCode}, '%')
</if>
<if test="q.entityId != null and q.entityId != ''">
AND t.entity_id LIKE concat('%', #{q.entityId}, '%')
</if>
<if test="q.ckType != null and q.ckType != ''">
AND t.ck_type LIKE concat('%', #{q.ckType}, '%')
</if>
<!-- 若查询出库单据,则要求已生成出库单号 --> <!-- 若查询出库单据,则要求已生成出库单号 -->
<if test="(q.isChuku != null and q.isChuku == 1) <if test="(q.isChuku != null and q.isChuku == 1)
@@ -514,24 +486,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND t.bill_no_ck IS NOT NULL AND t.bill_no_ck IS NOT NULL
</if> </if>
<!-- 删除标记默认0 --> <!-- 审核开启:剔除该 bill_no 下任意一条“审核失败”的明细 -->
<choose>
<when test="q.isDelete != null and q.isDelete != ''">
AND t.is_delete = #{q.isDelete}
</when>
<otherwise>
AND t.is_delete = 0
</otherwise>
</choose>
<!-- 审核开启:剔除审核失败(不使用 &lt;&gt;,而用 != 或 CDATA -->
<if test="needAudit != null and needAudit == 1"> <if test="needAudit != null and needAudit == 1">
AND NOT EXISTS ( AND NOT EXISTS (
SELECT 1 SELECT 1
FROM audit_signature asg FROM rk_info r2
WHERE asg.rk_id = t.id JOIN audit_signature asg
ON asg.rk_id = r2.id
AND asg.approver_id IS NOT NULL AND asg.approver_id IS NOT NULL
AND (asg.audit_result IS NOT NULL AND asg.audit_result != '1') AND (asg.audit_result IS NOT NULL AND asg.audit_result != '1')
WHERE r2.bill_no = t.bill_no
AND r2.is_delete = 0
) )
</if> </if>
</where> </where>
@@ -542,7 +507,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN sys_user u ON a.ck_lihuo_y = u.user_id LEFT JOIN sys_user u ON a.ck_lihuo_y = u.user_id
ORDER BY a.rk_time DESC ORDER BY a.rk_time DESC
</select> </select>
<!-- ================== /按单据分组查询 ================== -->
<select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult"> <select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/> <include refid="selectRkInfoVo"/>
@@ -583,6 +548,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY rk_time DESC ORDER BY rk_time DESC
LIMIT #{limit} LIMIT #{limit}
</select> </select>
<select id="selectSapNoByCkBillNo" resultType="java.lang.String"> <select id="selectSapNoByCkBillNo" resultType="java.lang.String">
SELECT DISTINCT sap_no FROM rk_info SELECT DISTINCT sap_no FROM rk_info
WHERE bill_no = #{billNo} AND sap_no IS NOT NULL WHERE bill_no = #{billNo} AND sap_no IS NOT NULL
@@ -648,7 +614,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND pd.scene = #{sceneId} AND pd.scene = #{sceneId}
</select> </select>
<select id="countGetByWh" resultType="java.lang.Integer" parameterType="java.lang.String"> <select id="countGetByWh" resultType="java.lang.Integer" parameterType="java.lang.String">
SELECT COUNT(1) FROM rk_info SELECT COUNT(1) FROM rk_info
WHERE is_delete = '0' WHERE is_delete = '0'
@@ -662,15 +627,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
r.pcode AS rkPcode, r.pcode AS rkPcode,
COALESCE(SUM(r.real_qty), 0) AS realQty COALESCE(SUM(r.real_qty), 0) AS realQty
FROM pcde_detail d FROM pcde_detail d
JOIN rk_info r JOIN rk_info r ON r.pcode = d.pcode
ON r.pcode = d.pcode
LEFT JOIN ( LEFT JOIN (
SELECT DISTINCT pcode SELECT DISTINCT pcode
FROM inventory_match_scan FROM inventory_match_scan
WHERE task_id = #{taskId} WHERE task_id = #{taskId}
AND status = '0' AND status = '0'
) s ) s ON s.pcode = r.pcode
ON s.pcode = r.pcode
WHERE (d.is_delete IS NULL OR d.is_delete = '0') WHERE (d.is_delete IS NULL OR d.is_delete = '0')
AND d.scene = #{sceneId} AND d.scene = #{sceneId}
AND r.is_chuku = '0' AND r.is_chuku = '0'
@@ -722,8 +685,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY COALESCE(r.bill_no_ck, r.bill_no) GROUP BY COALESCE(r.bill_no_ck, r.bill_no)
</select> </select>
<select id="selectRkInfoListByBillNo" resultMap="RkInfoResult" <select id="selectRkInfoListByBillNo" resultMap="RkInfoResult"
parameterType="java.lang.String"> parameterType="java.lang.String">
SELECT SELECT
@@ -750,7 +711,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<update id="updateRkInfo" parameterType="RkInfo"> <update id="updateRkInfo" parameterType="RkInfo">
update rk_info UPDATE rk_info
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="rkType != null">rk_type = #{rkType},</if> <if test="rkType != null">rk_type = #{rkType},</if>
<if test="wlType != null">wl_type = #{wlType},</if> <if test="wlType != null">wl_type = #{wlType},</if>
@@ -759,40 +720,62 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="lihuoY != null">lihuo_y = #{lihuoY},</if> <if test="lihuoY != null">lihuo_y = #{lihuoY},</if>
<if test="isChuku != null">is_chuku = #{isChuku},</if> <if test="isChuku != null">is_chuku = #{isChuku},</if>
<if test="isBorrowed != null">is_borrowed = #{isBorrowed},</if> <if test="isBorrowed != null">is_borrowed = #{isBorrowed},</if>
<if test="billNo != null">bill_no = #{billNo},</if> <if test="billNo != null">bill_no = #{billNo},</if>
<if test="billNoCk != null">bill_no_ck = #{billNoCk},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="xj != null">xj = #{xj},</if> <if test="xj != null">xj = #{xj},</if>
<if test="xmNo != null">xm_no = #{xmNo},</if> <if test="xmNo != null">xm_no = #{xmNo},</if>
<if test="xmMs != null">xm_ms = #{xmMs},</if> <if test="xmMs != null">xm_ms = #{xmMs},</if>
<if test="xmNoCk != null">xm_no_ck = #{xmNoCk},</if> <if test="xmNoCk != null">xm_no_ck = #{xmNoCk},</if>
<if test="xmMsCk != null">xm_ms_ck = #{xmMsCk},</if> <if test="xmMsCk != null">xm_ms_ck = #{xmMsCk},</if>
<if test="wlNo != null">wl_no = #{wlNo},</if> <if test="wlNo != null">wl_no = #{wlNo},</if>
<if test="wlMs != null">wl_ms = #{wlMs},</if> <if test="wlMs != null">wl_ms = #{wlMs},</if>
<if test="gysNo != null">gys_no = #{gysNo},</if> <if test="gysNo != null">gys_no = #{gysNo},</if>
<if test="gysMc != null">gys_mc = #{gysMc},</if> <if test="gysMc != null">gys_mc = #{gysMc},</if>
<if test="jhAmt != null">jh_amt = #{jhAmt},</if> <if test="jhAmt != null">jh_amt = #{jhAmt},</if>
<if test="htDj != null">ht_dj = #{htDj},</if> <if test="htDj != null">ht_dj = #{htDj},</if>
<if test="sapNo != null">sap_no = #{sapNo},</if> <if test="sapNo != null">sap_no = #{sapNo},</if>
<if test="xh != null">xh = #{xh},</if> <if test="xh != null">xh = #{xh},</if>
<if test="jhQty != null">jh_qty = #{jhQty},</if> <if test="jhQty != null">jh_qty = #{jhQty},</if>
<if test="htQty != null">ht_qty = #{htQty},</if> <if test="htQty != null">ht_qty = #{htQty},</if>
<if test="dw != null">dw = #{dw},</if> <if test="dw != null">dw = #{dw},</if>
<if test="realQty != null">real_qty = #{realQty},</if> <if test="realQty != null">real_qty = #{realQty},</if>
<if test="pcode != null">pcode = #{pcode},</if> <if test="pcode != null">pcode = #{pcode},</if>
<if test="pcodeId != null">pcode_id = #{pcodeId},</if>
<if test="trayCode != null">tray_code = #{trayCode},</if> <if test="trayCode != null">tray_code = #{trayCode},</if>
<if test="entityId != null">entity_id = #{entityId},</if> <if test="entityId != null">entity_id = #{entityId},</if>
<if test="ckLihuoY != null">ck_lihuo_y = #{ckLihuoY},</if> <if test="ckLihuoY != null">ck_lihuo_y = #{ckLihuoY},</if>
<if test="ckType != null">ck_type = #{ckType},</if> <if test="ckType != null">ck_type = #{ckType},</if>
<if test="teamCode != null">team_code = #{teamCode},</if>
<if test="lyTime != null">ly_time = #{lyTime},</if> <if test="lyTime != null">ly_time = #{lyTime},</if>
<if test="borrowTime != null">borrow_time = #{borrowTime},</if> <if test="borrowTime != null">borrow_time = #{borrowTime},</if>
<if test="returnTime != null">return_time = #{returnTime},</if> <if test="returnTime != null">return_time = #{returnTime},</if>
<if test="ckRemark != null">ck_remark = #{ckRemark},</if> <if test="ckRemark != null">ck_remark = #{ckRemark},</if>
<if test="isDelivery != null">is_delivery = #{isDelivery},</if>
<if test="hasMoved != null">has_moved = #{hasMoved},</if> <if test="hasMoved != null">has_moved = #{hasMoved},</if>
<!-- 新增:封样号 -->
<if test="fycde1 != null">fycde_1 = #{fycde1},</if>
<if test="fycde2 != null">fycde_2 = #{fycde2},</if>
<!-- 关联计划 -->
<if test="gysJhId != null">gys_jh_id = #{gysJhId},</if>
<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>
</trim> </trim>
where id = #{id} WHERE id = #{id}
</update> </update>
<update id="deleteRkInfoById" parameterType="Long"> <update id="deleteRkInfoById" parameterType="Long">
@@ -907,7 +890,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ri.is_delete = '0' ri.is_delete = '0'
AND ri.is_delivery = '1' AND ri.is_delivery = '1'
<!-- 可选筛选:按你当前 RkInfo 实体常用查询项补充 -->
<if test="billNoCk != null and billNoCk != ''"> <if test="billNoCk != null and billNoCk != ''">
AND ri.bill_no_ck = #{billNoCk} AND ri.bill_no_ck = #{billNoCk}
</if> </if>
@@ -921,7 +903,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND ri.status = #{status} AND ri.status = #{status}
</if> </if>
<!-- 领用(出库)时间范围 -->
<if test="lyStartTime != null"> <if test="lyStartTime != null">
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime} AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
</if> </if>
@@ -929,7 +910,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime} AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime}
</if> </if>
<!-- 关键字模糊(项目/物料/供应商/出库单号等) -->
<if test="keyword != null and keyword != ''"> <if test="keyword != null and keyword != ''">
AND ( AND (
ri.xm_no_ck LIKE CONCAT('%', #{keyword}, '%') ri.xm_no_ck LIKE CONCAT('%', #{keyword}, '%')
@@ -953,34 +933,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
(ri.is_delete = '0' OR ri.is_delete = 0 OR ri.is_delete IS NULL) (ri.is_delete = '0' OR ri.is_delete = 0 OR ri.is_delete IS NULL)
<!-- keyword 模糊 -->
<if test="keyword != null and keyword != ''">
AND (
ri.xm_no LIKE CONCAT('%', #{keyword}, '%')
OR ri.xm_ms LIKE CONCAT('%', #{keyword}, '%')
OR ri.wl_no LIKE CONCAT('%', #{keyword}, '%')
OR ri.wl_ms LIKE CONCAT('%', #{keyword}, '%')
OR ri.gys_no LIKE CONCAT('%', #{keyword}, '%')
OR ri.gys_mc LIKE CONCAT('%', #{keyword}, '%')
OR ri.sap_no LIKE CONCAT('%', #{keyword}, '%')
OR ri.bill_no LIKE CONCAT('%', #{keyword}, '%')
OR ri.bill_no_ck LIKE CONCAT('%', #{keyword}, '%')
OR ri.ck_type LIKE CONCAT('%', #{keyword}, '%')
OR ri.pcode LIKE CONCAT('%', #{keyword}, '%')
)
</if>
<!-- 入/出库状态 -->
<if test="isChuku != null and isChuku != ''"> <if test="isChuku != null and isChuku != ''">
AND ri.is_chuku = #{isChuku} AND ri.is_chuku = #{isChuku}
</if> </if>
<!-- 仓库 -->
<if test="cangku != null and cangku != ''"> <if test="cangku != null and cangku != ''">
AND ri.cangku = #{cangku} AND ri.cangku = #{cangku}
</if> </if>
<!-- 入库时间范围 -->
<if test="startTime != null"> <if test="startTime != null">
AND ri.rk_time <![CDATA[ >= ]]> #{startTime} AND ri.rk_time <![CDATA[ >= ]]> #{startTime}
</if> </if>
@@ -988,13 +948,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND ri.rk_time <![CDATA[ <= ]]> #{endTime} AND ri.rk_time <![CDATA[ <= ]]> #{endTime}
</if> </if>
<!-- 领用(出库)时间范围 -->
<if test="lyStartTime != null"> <if test="lyStartTime != null">
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime} AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
</if> </if>
<if test="lyEndTime != null"> <if test="lyEndTime != null">
AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime} AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime}
</if> </if>
<if test="xmNo != null and xmNo != ''">
AND ri.xm_no LIKE CONCAT('%', #{xmNo}, '%')
</if>
<if test="xmMs != null and xmMs != ''">
AND ri.xm_ms LIKE CONCAT('%', #{xmMs}, '%')
</if>
<if test="wlNo != null and wlNo != ''">
AND ri.wl_no LIKE CONCAT('%', #{wlNo}, '%')
</if>
<if test="wlMs != null and wlMs != ''">
AND ri.wl_ms LIKE CONCAT('%', #{wlMs}, '%')
</if>
<if test="gysNo != null and gysNo != ''">
AND ri.gys_no LIKE CONCAT('%', #{gysNo}, '%')
</if>
<if test="gysMc != null and gysMc != ''">
AND ri.gys_mc LIKE CONCAT('%', #{gysMc}, '%')
</if>
<if test="sapNo != null and sapNo != ''">
AND ri.sap_no LIKE CONCAT('%', #{sapNo}, '%')
</if>
<if test="billNo != null and billNo != ''">
AND ri.bill_no LIKE CONCAT('%', #{billNo}, '%')
</if>
<if test="billNoCk != null and billNoCk != ''">
AND ri.bill_no_ck LIKE CONCAT('%', #{billNoCk}, '%')
</if>
<if test="ckType != null and ckType != ''">
AND ri.ck_type LIKE CONCAT('%', #{ckType}, '%')
</if>
<if test="pcode != null and pcode != ''">
AND ri.pcode LIKE CONCAT('%', #{pcode}, '%')
</if>
<if test="fycde1 != null and fycde1 != ''">
AND ri.fycde_1 LIKE CONCAT('%', #{fycde1}, '%')
</if>
<if test="fycde2 != null and fycde2 != ''">
AND ri.fycde_2 LIKE CONCAT('%', #{fycde2}, '%')
</if>
</where> </where>
ORDER BY ri.create_time DESC, ri.id DESC ORDER BY ri.create_time DESC, ri.id DESC
</select> </select>