fix:订单配备货

dev_1.0.2
jiangpeng 2026-05-21 10:28:15 +08:00
parent 98b9097ff2
commit f68242d2e7
22 changed files with 1639 additions and 11 deletions

View File

@ -85,3 +85,48 @@ export function updateFinanceStatus(id, status) {
data: data
})
}
// 查询产品配货备货明细
export function productMatchList(orderCode) {
return request({
url: '/project/order/vue/productMatchList',
method: 'get',
params: { orderCode }
})
}
// 查询产品配备货绑定信息
export function productMatchBindList(orderCode, productCode, params = {}) {
return request({
url: '/project/order/vue/productMatchBindList',
method: 'get',
params: { orderCode, productCode, ...params }
})
}
// 保存订单关联采购单
export function savePurchaseOrderMap(data) {
return request({
url: '/project/order/vue/purchaseOrderMap',
method: 'post',
data
})
}
// 查询采购单SN码列表
export function purchaseSnList(purchaseNo, orderCode) {
return request({
url: '/project/order/vue/purchaseSnList',
method: 'get',
params: { purchaseNo, orderCode }
})
}
// 订单绑定SN码
export function bindOrderSnCodes(orderCode, productCode, productSnList) {
return request({
url: '/project/order/vue/bindOrderSnCodes',
method: 'post',
data: { orderCode, productCode, productSnList }
})
}

File diff suppressed because it is too large Load Diff

View File

@ -135,6 +135,7 @@ export default {
inventoryStatus: '0',
productCode: undefined,
warehouseId: undefined,
orderCode: undefined,
},
isImported: false, // Flag to track if data is from import
isInitialLoad: false,
@ -168,6 +169,7 @@ export default {
});
console.log('outerForm 关键字段:', {
outerCode: outerForm && outerForm.outerCode,
orderCode: outerForm && outerForm.orderCode,
deliveryTime: outerForm && outerForm.deliveryTime,
vendorName: outerForm && outerForm.vendorName,
notifierAddress: outerForm && outerForm.notifierAddress
@ -183,6 +185,7 @@ export default {
this.queryParams.productCode = productRow.productCode;
this.queryParams.warehouseId = productRow.warehouseId;
this.queryParams.orderCode = outerForm && outerForm.orderCode;
this.queryParams.pageSize = productRow.quantity - productRow.deliveryGenerateQuantity - productRow.deliveryConfirmQuantity;
this.isInitialLoad = true;
@ -333,6 +336,7 @@ export default {
inventoryStatus: '0',
productCode: undefined,
warehouseId: undefined,
orderCode: undefined,
};
this.isImported = false;
this.price = null;

View File

@ -391,7 +391,7 @@ export default {
} else if (type === 'hardware') {
this.currentProductType = '2';
} else if (type === 'maintenance') {
this.currentProductType = '3';
this.currentProductType = '3,22';
}
this.selectProductVisible = true;

View File

@ -6,9 +6,13 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Locale;
import java.util.Set;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
@ -421,13 +425,17 @@ public class ProjectOrderInfoController extends BaseController
@PostMapping("/importContractData")
@ResponseBody
public AjaxResult importContractData(@RequestPart("file") MultipartFile file, @RequestParam(value = "orderId",required = false) Long orderId, @RequestParam("fileSort") String fileSort, @RequestParam("versionCode") String versionCode) {
String fileName = file.getOriginalFilename();
if (!isAllowedContractFile(fileName, fileSort)) {
return AjaxResult.error(getContractFileTypeError(fileSort));
}
ProjectOrderFileLog projectOrderFileLog = new ProjectOrderFileLog();
projectOrderFileLog.setFileType(ProjectOrderFileLog.FileTypeEnum.CONTRACT.getCode());
projectOrderFileLog.setOrderId(orderId);
projectOrderFileLog.setUploadTime(DateUtils.getNowDate());
projectOrderFileLog.setUploadUser(ShiroUtils.getUserId().toString());
projectOrderFileLog.setUploadUserName(ShiroUtils.getSysUser().getUserName().toString());
projectOrderFileLog.setFileName(file.getOriginalFilename());
projectOrderFileLog.setFileName(fileName);
projectOrderFileLog.setFileSort(fileSort);
projectOrderFileLog.setFileVersionCode(versionCode);
try {
@ -440,6 +448,46 @@ public class ProjectOrderInfoController extends BaseController
return AjaxResult.success(projectOrderFileLog);
}
private boolean isAllowedContractFile(String fileName, String fileSort) {
if (StringUtils.isEmpty(fileName) || StringUtils.isEmpty(fileSort)) {
return false;
}
int dotIndex = fileName.lastIndexOf('.');
if (dotIndex < 0 || dotIndex == fileName.length() - 1) {
return false;
}
String extension = fileName.substring(dotIndex + 1).toLowerCase(Locale.ROOT);
return getAllowedContractExtensions(fileSort).contains(extension);
}
private Set<String> getAllowedContractExtensions(String fileSort) {
switch (fileSort) {
case "0":
case "1":
case "3":
return new HashSet<>(Arrays.asList("pdf", "jpg", "png"));
case "2":
return new HashSet<>(Arrays.asList("zip", "rar", "jpg", "png"));
default:
return Collections.emptySet();
}
}
private String getContractFileTypeError(String fileSort) {
switch (fileSort) {
case "0":
return "商务折扣审批文件仅支持 pdf、jpg、png 格式";
case "1":
return "合同文件仅支持 pdf、jpg、png 格式";
case "2":
return "补充附件仅支持 zip、rar、jpg、png 格式";
case "3":
return "已盖章合同文件仅支持 pdf、jpg、png 格式";
default:
return "不支持的文件类型";
}
}
@GetMapping("/contract/export")
public void contractExport(@RequestParam(required = false) String fileName,

View File

@ -7,8 +7,11 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.sip.domain.OmsPurchaseOrderMap;
import com.ruoyi.sip.domain.ProjectOrderFileLog;
import com.ruoyi.sip.domain.ProjectOrderInfo;
import com.ruoyi.sip.dto.OrderProductMatchBindDto;
import com.ruoyi.sip.dto.OrderProductMatchDto;
import com.ruoyi.sip.flowable.domain.Todo;
import com.ruoyi.sip.flowable.service.TodoService;
import com.ruoyi.sip.service.IProjectOrderFileLogService;
@ -155,4 +158,51 @@ public class VueProjectOrderInfoController extends BaseController {
String fileName = projectOrderInfoService.exportMcpList(projectOrderInfo);
return AjaxResult.success(fileName);
}
/**
*
*/
@GetMapping("/productMatchList")
public AjaxResult productMatchList(@RequestParam String orderCode) {
List<OrderProductMatchDto> list = projectOrderInfoService.selectProductMatchList(orderCode);
return AjaxResult.success(list);
}
/**
*
*/
@GetMapping("/productMatchBindList")
public TableDataInfo productMatchBindList(@RequestParam String orderCode, @RequestParam String productCode) {
startPage();
List<OrderProductMatchBindDto> list = projectOrderInfoService.selectProductMatchBindList(orderCode, productCode);
return getDataTable(list);
}
/**
*
*/
@PostMapping("/purchaseOrderMap")
public AjaxResult savePurchaseOrderMap(@RequestBody OmsPurchaseOrderMap omsPurchaseOrderMap) {
return toAjax(projectOrderInfoService.savePurchaseOrderMap(omsPurchaseOrderMap));
}
/**
* SN
*/
@GetMapping("/purchaseSnList")
public AjaxResult purchaseSnList(@RequestParam String purchaseNo, @RequestParam String orderCode) {
return AjaxResult.success(projectOrderInfoService.selectPurchaseSnList(purchaseNo, orderCode));
}
/**
* SN
*/
@PostMapping("/bindOrderSnCodes")
public AjaxResult bindOrderSnCodes(@RequestBody Map<String, Object> params) {
String orderCode = (String) params.get("orderCode");
String productCode = (String) params.get("productCode");
List<String> productSnList = (List<String>) params.get("productSnList");
return toAjax(projectOrderInfoService.bindOrderSnCodes(orderCode, productCode, productSnList));
}
}

View File

@ -50,6 +50,7 @@ public class InventoryInfo extends BaseEntity
/** 出库单号 */
@Excel(name = "出库单号")
private String outerCode;
private String orderCode;
/** 所属仓库 */
@Excel(name = "所属仓库")

View File

@ -0,0 +1,15 @@
package com.ruoyi.sip.domain;
import lombok.Data;
@Data
public class OmsPurchaseOrderMap {
private Long id;
private Long orderId;
private Long purchaseId;
private Integer bindNum;
}

View File

@ -264,6 +264,10 @@ public class ProjectOrderInfo extends BaseEntity {
private String approveNode;
//计收状态
private String chargeStatus;
/**
*
*/
private String orderStockingStatus;
/**
*
@ -435,4 +439,21 @@ public class ProjectOrderInfo extends BaseEntity {
}
}
@Getter
public enum OrderStockingStatusEnum {
PHZ("PHZ", "配货中"),
YPH("YPH", "已配货"),
BFBH("BFBH", "部分备货"),
BHWC("BHWC", "备货完成"),
;
private final String code;
private final String value;
OrderStockingStatusEnum(String code, String value) {
this.code = code;
this.value = value;
}
}
}

View File

@ -0,0 +1,41 @@
package com.ruoyi.sip.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrderProductMatchBindDto {
/** 产品编号 */
private String productCode;
/** 产品型号 */
private String model;
/** 采购单主键 */
private Long purchaseId;
/** 采购单号 */
private String purchaseNo;
/** 制造商 */
private String vendorAddress;
/** 采购数量 */
private Integer cgNum;
/** 可用数量 */
private Integer kyNum;
/** 配额数量 */
private Integer phNum;
/** 备货数量 */
private Integer bhNum;
/** 入库状态 */
private String status;
}

View File

@ -0,0 +1,32 @@
package com.ruoyi.sip.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrderProductMatchDto {
/** 产品编码 */
private String productCode;
/** 产品型号 */
private String model;
/** 订单数量 */
private Integer orderNum;
/** 配货数量 */
private Integer phNum;
/** 备货数量 */
private Integer bhNum;
/** 总成本 */
private BigDecimal sumCost;
}

View File

@ -0,0 +1,23 @@
package com.ruoyi.sip.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrderProductMatchSnDetailDto {
/** 产品SN码 */
private String productSn;
/** 仓库名称 */
private String warehouseName;
/** 订单编号 */
private String orderCode;
/** 出库单号 */
private String outerCode;
}

View File

@ -0,0 +1,25 @@
package com.ruoyi.sip.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrderProductMatchSnDto {
/** SN码总数量 */
private Integer totalQuantity;
private Integer quotaQuantity;
/** 仓库列表 */
private List<OrderProductMatchWarehouseDto> warehouseList;
/** SN码列表 */
private List<OrderProductMatchSnDetailDto> snList;
}

View File

@ -0,0 +1,18 @@
package com.ruoyi.sip.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrderProductMatchWarehouseDto {
/** 仓库名称 */
private String WarehouseName;
/** 绑定数量 */
private Integer bindNum;
}

View File

@ -83,4 +83,8 @@ public interface InventoryInfoMapper
List<InventoryInfo> selectInventoryInfoByOuterCodeList(List<String> outerCodeList);
List<InventoryInfo> selectInventoryInfoByInnerCodeList(List<String> innerCodeList);
int clearOrderCodeByOrderCodeAndProductCode(@Param("orderCode") String orderCode, @Param("productCode") String productCode);
int updateOrderCodeByProductSnList(@Param("productSnList") List<String> productSnList, @Param("orderCode") String orderCode);
}

View File

@ -0,0 +1,13 @@
package com.ruoyi.sip.mapper;
import com.ruoyi.sip.domain.OmsPurchaseOrderMap;
import org.apache.ibatis.annotations.Param;
public interface OmsPurchaseOrderMapMapper {
OmsPurchaseOrderMap selectByOrderIdAndPurchaseId(@Param("orderId") Long orderId, @Param("purchaseId") Long purchaseId);
int insertOmsPurchaseOrderMap(OmsPurchaseOrderMap omsPurchaseOrderMap);
int updateOmsPurchaseOrderMap(OmsPurchaseOrderMap omsPurchaseOrderMap);
}

View File

@ -5,6 +5,9 @@ import java.util.List;
import com.ruoyi.sip.domain.InventoryDelivery;
import com.ruoyi.sip.domain.ProjectOrderInfo;
import com.ruoyi.sip.dto.HomepageQueryDto;
import com.ruoyi.sip.dto.OrderProductMatchBindDto;
import com.ruoyi.sip.dto.OrderProductMatchDto;
import com.ruoyi.sip.dto.OrderProductMatchSnDetailDto;
import com.ruoyi.sip.dto.StatisticsDetailDto;
import com.ruoyi.sip.vo.OrderInfoVo;
import org.apache.ibatis.annotations.Param;
@ -76,6 +79,9 @@ public interface ProjectOrderInfoMapper
int updateProjectOrderInfoByCode(ProjectOrderInfo projectOrderInfo);
int updateOrderStockingStatusByCode(@Param("orderCode") String orderCode,
@Param("orderStockingStatus") String orderStockingStatus);
void bakData(ProjectOrderInfo projectOrderInfo);
List<OrderInfoVo> listOrderInfoVo(ProjectOrderInfo queryParams);
@ -93,4 +99,16 @@ public interface ProjectOrderInfoMapper
@Param("dutyPhone") String dutyPhone,
@Param("projectIds") List<Long> projectIds);
List<OrderProductMatchDto> selectProductMatchList(@Param("orderCode") String orderCode);
List<OrderProductMatchBindDto> selectProductMatchBindList(@Param("orderCode") String orderCode,
@Param("productCode") String productCode);
int selectProductMatchSnCountlList(@Param("purchaseNo") String purchaseNo);
int selectPurchaseOrderMapBindNum(@Param("purchaseNo") String purchaseNo,
@Param("orderCode") String orderCode);
List<OrderProductMatchSnDetailDto> selectProductMatchSnDetailList(@Param("purchaseNo") String purchaseNo);
}

View File

@ -2,9 +2,13 @@ package com.ruoyi.sip.service;
import java.util.List;
import com.ruoyi.sip.domain.OmsPurchaseOrderMap;
import com.ruoyi.sip.domain.ProjectOrderFileLog;
import com.ruoyi.sip.domain.ProjectOrderInfo;
import com.ruoyi.sip.dto.ApiDataQueryDto;
import com.ruoyi.sip.dto.OrderProductMatchBindDto;
import com.ruoyi.sip.dto.OrderProductMatchDto;
import com.ruoyi.sip.dto.OrderProductMatchSnDto;
import com.ruoyi.sip.flowable.domain.Todo;
import com.ruoyi.sip.dto.HomepageQueryDto;
import com.ruoyi.sip.dto.StatisticsDetailDto;
@ -107,4 +111,14 @@ public interface IProjectOrderInfoService
void approveOrderBatch(Todo todo);
List<OrderProductMatchDto> selectProductMatchList(String orderCode);
List<OrderProductMatchBindDto> selectProductMatchBindList(String orderCode, String productCode);
int savePurchaseOrderMap(OmsPurchaseOrderMap omsPurchaseOrderMap);
OrderProductMatchSnDto selectPurchaseSnList(String purchaseNo, String orderCode);
int bindOrderSnCodes(String orderCode, String productCode, List<String> productSnList);
}

View File

@ -55,13 +55,11 @@ import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.sip.domain.*;
import com.ruoyi.sip.dto.ApiDataQueryDto;
import com.ruoyi.sip.dto.*;
import com.ruoyi.sip.flowable.domain.Todo;
import com.ruoyi.sip.dto.HomepageQueryDto;
import com.ruoyi.sip.dto.OrderExcelNumStaticsDto;
import com.ruoyi.sip.dto.StatisticsDetailDto;
import com.ruoyi.sip.flowable.service.IBuApproveConfigService;
import com.ruoyi.sip.llm.tools.ProjectOrderInfoToolProvider;
import com.ruoyi.sip.mapper.OmsPurchaseOrderMapMapper;
import com.ruoyi.sip.mapper.OmsStockInfoMapper;
import com.ruoyi.sip.mapper.ProjectInfoMapper;
import com.ruoyi.sip.service.*;
@ -110,6 +108,9 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
@Autowired
private ProjectOrderInfoMapper projectOrderInfoMapper;
@Autowired
private OmsPurchaseOrderMapMapper omsPurchaseOrderMapMapper;
@Autowired
private IProjectOrderFileLogService fileLogService;
@Autowired
@ -146,6 +147,9 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
@Autowired
private IProjectProductInfoBakService projectProductInfoBakService;
@Autowired
private com.ruoyi.sip.mapper.InventoryInfoMapper inventoryInfoMapper;
private static final List<String> CSS_EMAIL_LIST = Arrays.asList("shiguijuan@pcitech.com", "huiwang@pcitech.com", "zhaoqian1@pcitech.com", "pci-ict@pcitech.com");
private static final List<String> REJECT_EMAIL_LIST = Arrays.asList("li.junjie@unisinsight.com", "chen.shenggang@unisinsight.com");
@ -2872,4 +2876,92 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
XWPFRun run = paragraph.createRun();
run.setText(text != null ? text : "");
}
@Override
public List<OrderProductMatchDto> selectProductMatchList(String orderCode) {
return projectOrderInfoMapper.selectProductMatchList(orderCode);
}
@Override
public List<OrderProductMatchBindDto> selectProductMatchBindList(String orderCode, String productCode) {
return projectOrderInfoMapper.selectProductMatchBindList(orderCode, productCode);
}
@Override
public int savePurchaseOrderMap(OmsPurchaseOrderMap omsPurchaseOrderMap) {
OmsPurchaseOrderMap exist = omsPurchaseOrderMapMapper.selectByOrderIdAndPurchaseId(omsPurchaseOrderMap.getOrderId(), omsPurchaseOrderMap.getPurchaseId());
int result;
if (exist == null) {
result = omsPurchaseOrderMapMapper.insertOmsPurchaseOrderMap(omsPurchaseOrderMap);
} else {
exist.setBindNum(omsPurchaseOrderMap.getBindNum());
result = omsPurchaseOrderMapMapper.updateOmsPurchaseOrderMap(exist);
}
ProjectOrderInfo projectOrderInfo = projectOrderInfoMapper.selectProjectOrderInfoById(omsPurchaseOrderMap.getOrderId());
if (projectOrderInfo != null) {
refreshOrderStockingStatus(projectOrderInfo.getOrderCode());
}
return result;
}
@Override
public OrderProductMatchSnDto selectPurchaseSnList(String purchaseNo, String orderCode) {
OrderProductMatchSnDto result = new OrderProductMatchSnDto();
result.setTotalQuantity(projectOrderInfoMapper.selectProductMatchSnCountlList(purchaseNo));
Integer quotaQuantity = projectOrderInfoMapper.selectPurchaseOrderMapBindNum(purchaseNo, orderCode);
result.setQuotaQuantity(quotaQuantity == null ? 0 : quotaQuantity);
List<OrderProductMatchSnDetailDto> snList = projectOrderInfoMapper.selectProductMatchSnDetailList(purchaseNo);
result.setSnList(snList);
List<OrderProductMatchWarehouseDto> warehouseList = snList.stream()
.collect(Collectors.groupingBy(OrderProductMatchSnDetailDto::getWarehouseName))
.entrySet().stream()
.map(entry -> new OrderProductMatchWarehouseDto(entry.getKey(), (int) entry.getValue().stream()
.filter(item -> orderCode != null && orderCode.equals(item.getOrderCode()))
.count()))
.collect(Collectors.toList());
result.setWarehouseList(warehouseList);
return result;
}
@Override
public int bindOrderSnCodes(String orderCode, String productCode, List<String> productSnList) {
if (StringUtils.isEmpty(orderCode) || StringUtils.isEmpty(productCode)) {
return 0;
}
inventoryInfoMapper.clearOrderCodeByOrderCodeAndProductCode(orderCode, productCode);
int result = 1;
if (CollUtil.isNotEmpty(productSnList)) {
result = inventoryInfoMapper.updateOrderCodeByProductSnList(productSnList, orderCode);
}
refreshOrderStockingStatus(orderCode);
return result;
}
private void refreshOrderStockingStatus(String orderCode) {
if (StringUtils.isEmpty(orderCode)) {
return;
}
List<OrderProductMatchDto> matchList = projectOrderInfoMapper.selectProductMatchList(orderCode);
if (CollUtil.isEmpty(matchList)) {
return;
}
int orderNum = matchList.stream().mapToInt(item -> item.getOrderNum() == null ? 0 : item.getOrderNum()).sum();
int phNum = matchList.stream().mapToInt(item -> item.getPhNum() == null ? 0 : item.getPhNum()).sum();
int bhNum = matchList.stream().mapToInt(item -> item.getBhNum() == null ? 0 : item.getBhNum()).sum();
String stockingStatus = null;
if (phNum > 0) {
stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.PHZ.getCode();
}
if (orderNum > 0 && phNum >= orderNum) {
stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.YPH.getCode();
if (bhNum > 0) {
stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.BFBH.getCode();
}
}
if (orderNum > 0 && bhNum >= orderNum) {
stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.BHWC.getCode();
}
projectOrderInfoMapper.updateOrderStockingStatusByCode(orderCode, stockingStatus);
}
}

View File

@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="inventoryStatus" column="inventory_status" />
<result property="innerCode" column="inner_code" />
<result property="outerCode" column="outer_code" />
<result property="orderCode" column="order_code" />
<result property="warehouseId" column="warehouse_id" />
<result property="innerPrice" column="inner_price" />
<result property="outerPrice" column="outer_price" />
@ -22,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectInventoryInfoVo">
select t1.id, t1.product_code, t1.product_sn, t1.license_key, t1.inventory_status, t1.inner_code, t1.outer_code, t1.warehouse_id, t1.inner_price,t1.tax_rate,
select t1.id, t1.product_code, t1.product_sn, t1.license_key, t1.inventory_status, t1.inner_code, t1.outer_code, t1.order_code, t1.warehouse_id, t1.inner_price,t1.tax_rate,
t1.outer_price, t1.create_by, t1.create_time, t1.update_by, t1.update_time ,
t2.warehouse_name,t3.description as 'product_desc',t3.model,t3.type as product_type
from oms_inventory_info t1
@ -50,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<if test="innerCode != null and innerCode != ''">and t1.inner_code = #{innerCode}</if>
<if test="outerCode != null and outerCode != ''">and t1.outer_code = #{outerCode}</if>
<if test="orderCode != null and orderCode != ''">and t1.order_code = #{orderCode}</if>
<if test="warehouseId != null ">and t1.warehouse_id = #{warehouseId}</if>
<if test="innerPrice != null ">and t1.inner_price = #{innerPrice}</if>
<if test="outerPrice != null ">and t1.outer_price = #{outerPrice}</if>
@ -213,6 +215,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>)
</update>
<update id="clearOrderCodeByOrderCodeAndProductCode">
update oms_inventory_info
set order_code = null,
update_time = now()
where order_code = #{orderCode}
and product_code = #{productCode}
</update>
<update id="updateOrderCodeByProductSnList">
update oms_inventory_info
set order_code = #{orderCode},
update_time = now()
where product_sn in
<foreach item="productSn" collection="productSnList" separator="," open="(" close=")">
#{productSn}
</foreach>
</update>
<delete id="deleteInventoryInfoById" parameterType="Long">
delete from oms_inventory_info where id = #{id}

View File

@ -0,0 +1,33 @@
<?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.ruoyi.sip.mapper.OmsPurchaseOrderMapMapper">
<resultMap type="OmsPurchaseOrderMap" id="OmsPurchaseOrderMapResult">
<result property="id" column="id"/>
<result property="orderId" column="order_id"/>
<result property="purchaseId" column="purchase_id"/>
<result property="bindNum" column="bind_num"/>
</resultMap>
<select id="selectByOrderIdAndPurchaseId" resultMap="OmsPurchaseOrderMapResult">
select id, order_id, purchase_id, bind_num
from oms_purchase_order_map
where order_id = #{orderId}
and purchase_id = #{purchaseId}
limit 1
</select>
<insert id="insertOmsPurchaseOrderMap" parameterType="OmsPurchaseOrderMap" useGeneratedKeys="true" keyProperty="id">
insert into oms_purchase_order_map(order_id, purchase_id, bind_num)
values (#{orderId}, #{purchaseId}, #{bindNum})
</insert>
<update id="updateOmsPurchaseOrderMap" parameterType="OmsPurchaseOrderMap">
update oms_purchase_order_map
set bind_num = #{bindNum}
where id = #{id}
</update>
</mapper>

View File

@ -38,13 +38,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="paymentRatio" column="payment_ratio" />
<result property="paymentDescription" column="payment_description" />
<result property="operationVersion" column="operation_version" />
<result property="orderStockingStatus" column="order_stocking_status" />
</resultMap>
<sql id="selectProjectOrderInfoVo">
select id, project_id,province, city, business_person, business_email, business_phone, order_code, currencyType,
shipment_amount, actual_purchase_amount, order_end_time, delivery_time, company_delivery, notifier,finance_status,
notifier_email, notifier_phone, duty, duty_email, duty_phone, order_channel, partner_code, supplier,notifier_address,
remark, order_status, create_by, create_time, update_by, update_time,version_code,process_type,process_template,discount_fold,
remark, order_status, create_by, create_time, update_by, update_time,version_code,process_type,process_template,discount_fold,order_stocking_status,
delivery_status,sign_status,outer_status,approve_time,payment_method,payment_ratio,payment_description,order_type,operation_version
from project_order_info t1
@ -55,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t1.notifier_email, t1.notifier_phone, t1.duty, t1.duty_email, t1.duty_phone, t1.order_channel, t1.partner_code, t1.supplier,
t1.remark, t1.order_status, t1.create_by, t1.create_time, t1.update_by, t1.update_time,t1.partner_user_name,t1.partner_email
,t1.partner_phone,t1.version_code,t1.process_type,t1.process_template,t1.discount_fold,t1.notifier_address,t1.finance_status,
t1.delivery_status,t1.sign_status,t1.outer_status,t1.approve_time,t1.payment_method,t1.payment_ratio,t1.payment_description,t1.operation_version
t1.delivery_status,t1.sign_status,t1.outer_status,t1.approve_time,t1.payment_method,t1.payment_ratio,t1.payment_description,t1.operation_version,t1.order_stocking_status
,t2.project_code,t2.project_name,t2.province,t2.customer_name,t2.customer_code,t2.industry_type,t2.bg_property,t2.agent_code,t2.estimated_order_time
,t2.customer_phone,t2.customer_user_name,t2.agent_code,t2.customer_code,t2.partner_name project_partner_name
,t3.partner_name,t3.level,t3.system_user_id,t3.address partner_address
@ -122,6 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="supplier != null and supplier != ''">and t1.supplier = #{supplier}</if>
<if test="supplier != null and supplier != ''">and t1.supplier = #{supplier}</if>
<if test="orderStatus != null and orderStatus != ''">and t1.order_status = #{orderStatus}</if>
<if test="orderStockingStatus != null and orderStockingStatus != ''">and t1.order_stocking_status = #{orderStockingStatus}</if>
<if test="deliveryStatus != null and deliveryStatus != ''">and t1.delivery_status = #{deliveryStatus}</if>
<if test="outerStatus != null and outerStatus != ''">and t1.outer_status = #{outerStatus}</if>
<if test="signStatus != null and signStatus != ''">and t1.sign_status = #{signStatus}</if>
@ -411,7 +413,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t1.notifier_email, t1.notifier_phone, t1.duty, t1.duty_email, t1.duty_phone, t1.order_channel, t1.partner_code, t1.supplier,
t1.remark, t1.order_status, t1.create_by, t1.create_time, t1.update_by, t1.update_time,t1.partner_user_name,t1.partner_email
,t1.partner_phone,t1.version_code,t1.process_type,t1.process_template,t1.discount_fold,t1.notifier_address,t1.finance_status,
t1.delivery_status,t1.sign_status,t1.outer_status,t1.approve_time,t1.payment_method,t1.payment_ratio,t1.payment_description,t1.operation_version
t1.delivery_status,t1.sign_status,t1.outer_status,t1.approve_time,t1.payment_method,t1.payment_ratio,t1.payment_description,t1.operation_version,t1.order_stocking_status
,t2.project_code,t2.project_name,t2.province,t2.customer_name,t2.customer_code,t2.industry_type,t2.bg_property,t2.agent_code,t2.estimated_order_time
,t2.customer_phone,t2.customer_user_name,t2.agent_code,t2.customer_code,t2.partner_name project_partner_name
,t3.partner_name,t3.level,t3.system_user_id,t3.address partner_address
@ -479,6 +481,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="supplier != null and supplier != ''">and t1.supplier = #{supplier}</if>
<if test="supplier != null and supplier != ''">and t1.supplier = #{supplier}</if>
<if test="orderStatus != null and orderStatus != ''">and t1.order_status = #{orderStatus}</if>
<if test="orderStockingStatus != null and orderStockingStatus != ''">and t1.order_stocking_status = #{orderStockingStatus}</if>
<if test="deliveryStatus != null and deliveryStatus != ''">and t1.delivery_status = #{deliveryStatus}</if>
<if test="outerStatus != null and outerStatus != ''">and t1.outer_status = #{outerStatus}</if>
<if test="signStatus != null and signStatus != ''">and t1.sign_status = #{signStatus}</if>
@ -623,6 +626,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="supplier != null">supplier,</if>
<if test="remark != null">remark,</if>
<if test="orderStatus != null">order_status,</if>
<if test="orderStockingStatus != null and orderStockingStatus != ''">order_stocking_status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
@ -666,6 +670,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="supplier != null">#{supplier},</if>
<if test="remark != null">#{remark},</if>
<if test="orderStatus != null">#{orderStatus},</if>
<if test="orderStockingStatus != null and orderStockingStatus != ''">#{orderStockingStatus},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
@ -806,6 +811,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="supplier != null">supplier = #{supplier},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="orderStatus != null">order_status = #{orderStatus},</if>
<if test="orderStockingStatus != null and orderStockingStatus != ''">order_stocking_status = #{orderStockingStatus},</if>
<if test="outerStatus != null">outer_status = #{outerStatus},</if>
<if test="deliveryStatus != null">delivery_status = #{deliveryStatus},</if>
<if test="signStatus != null">sign_status = #{signStatus},</if>
@ -867,6 +873,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="supplier != null">supplier = #{supplier},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="orderStatus != null">order_status = #{orderStatus},</if>
<if test="orderStockingStatus != null and orderStockingStatus != ''">order_stocking_status = #{orderStockingStatus},</if>
<if test="outerStatus != null">outer_status = #{outerStatus},</if>
<if test="deliveryStatus != null">delivery_status = #{deliveryStatus},</if>
<if test="signStatus != null">sign_status = #{signStatus},</if>
@ -880,6 +887,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updatePartnerCodeByCode">
update project_order_info set partner_code = #{newValue} where partner_code = #{oldValue}
</update>
<update id="updateOrderStockingStatusByCode">
update project_order_info
set order_stocking_status = #{orderStockingStatus},
update_time = now()
where order_code = #{orderCode}
</update>
<update id="updateDutyByProjectIds">
update project_order_info
@ -914,4 +927,100 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where t1.id = #{id}
</select>
<select id="selectProductMatchList" resultType="com.ruoyi.sip.dto.OrderProductMatchDto">
select
t3.product_code as product_code,
t3.model,
t1.quantity as order_num,
sum(ifnull(t5.bind_num, 0)) as ph_num,
(select count(1) from oms_inventory_info as tt where t2.order_code = tt.order_code and t3.product_code = tt.product_code) as bh_num,
ifnull((select sum(inner_price) from oms_inventory_info as tt where t2.order_code = tt.order_code and t3.product_code = tt.product_code),0) as sum_cost
from project_product_info as t1
inner join project_order_info as t2
on t1.project_id = t2.project_id
inner join product_info as t3
on t1.product_bom_code = t3.product_code
left join oms_purchase_order_item as t4
on t3.product_code = t4.product_code
left join oms_purchase_order_map as t5
on t2.id = t5.order_id and t4.purchase_id = t5.purchase_id
where t2.order_code = #{orderCode}
and t3.type in (1, 2)
group by t3.product_code, t3.model, t1.quantity
</select>
<select id="selectProductMatchBindList" resultType="com.ruoyi.sip.dto.OrderProductMatchBindDto">
select
t3.product_code,
t3.model,
t6.id as purchase_id,
t6.purchase_no,
(select vendor_address from oms_vendor_info as tt where tt.vendor_id = t6.vendor_id) as vendor_address,
t4.quantity as cg_num,
t4.quantity - ifnull((select sum(bind_num) from oms_purchase_order_map as tt where tt.purchase_id = t5.purchase_id), 0) as ky_num,
t5.bind_num as ph_num,
t6.status,
(
select count(1) from oms_inventory_info as tt1
inner join oms_inventory_inner as tt2
on tt1.inner_code = tt2.inner_code
where t2.order_code = tt1.order_code
and t3.product_code = tt1.product_code
and tt2.purchase_no = t6.purchase_no
) as bh_num
from project_product_info as t1
inner join project_order_info as t2
on t1.project_id = t2.project_id
inner join product_info as t3
on t1.product_bom_code = t3.product_code
inner join oms_purchase_order_item as t4
on t3.product_code = t4.product_code
left join oms_purchase_order_map as t5
on t2.id = t5.order_id and t4.purchase_id = t5.purchase_id
inner join oms_purchase_order as t6
on t6.id = t4.purchase_id
where t2.order_code = #{orderCode}
and t3.product_code = #{productCode}
and t6.approve_status = 2 and t6.confirm_status = 1
group by t6.purchase_no
</select>
<select id="selectProductMatchSnCountlList" resultType="java.lang.Integer">
select
count(1)
from oms_inventory_info as t1
inner join oms_inventory_inner as t2
on t1.inner_code = t2.inner_code
left join oms_warehouse_info as t3
on t2.warehouse_id = t3.id
where t2.purchase_no = #{purchaseNo}
</select>
<select id="selectPurchaseOrderMapBindNum" resultType="java.lang.Integer">
select
ifnull(t3.bind_num, 0)
from oms_purchase_order as t1
inner join project_order_info as t2
on t2.order_code = #{orderCode}
left join oms_purchase_order_map as t3
on t2.id = t3.order_id and t1.id = t3.purchase_id
where t1.purchase_no = #{purchaseNo}
limit 1
</select>
<select id="selectProductMatchSnDetailList" resultType="com.ruoyi.sip.dto.OrderProductMatchSnDetailDto">
select
t1.product_sn,
t3.warehouse_name,
t1.order_code,
t1.outer_code
from oms_inventory_info as t1
inner join oms_inventory_inner as t2
on t1.inner_code = t2.inner_code
left join oms_warehouse_info as t3
on t2.warehouse_id = t3.id
where t2.purchase_no = #{purchaseNo}
order by t1.product_sn
</select>
</mapper>