Merge remote-tracking branch 'origin/dev_1.0.2' into dev_1.0.2

dev_1.0.2
wangy 2026-05-28 15:02:36 +08:00
commit c27bfd26cf
16 changed files with 165 additions and 150 deletions

View File

@ -123,10 +123,10 @@ export function purchaseSnList(purchaseNo, orderCode) {
}
// 订单绑定SN码
export function bindOrderSnCodes(orderCode, productCode, productSnList) {
export function bindOrderSnCodes(orderCode, productCode, purchaseNo, orderId, purchaseId, productSnList) {
return request({
url: '/project/order/vue/bindOrderSnCodes',
method: 'post',
data: { orderCode, productCode, productSnList }
data: { orderCode, productCode, purchaseNo, orderId, purchaseId, productSnList }
})
}

View File

@ -277,10 +277,10 @@
type="number"
:disabled="String(scope.row.status) === '0'"
:min="scope.row.bhNum || 0"
:max="scope.row.cgNum || 0"
:max="calculateMaxPhNum(scope.row, item)"
size="small"
class="stocking-bind-input"
@input="handleBindNumInput(scope.row)"
@input="handleBindNumInput(scope.row, item)"
@change="handleBindNumChange(scope.row, item)"
></el-input>
</template>
@ -321,7 +321,7 @@
</div>
<div>
<el-button @click="stockingDetailVisible = false"> </el-button>
<el-button type="primary" :loading="stockingDetailSaving" @click="handleSaveStockingBind"></el-button>
<!-- <el-button type="primary" :loading="stockingDetailSaving" @click="handleSaveStockingBind"></el-button>-->
</div>
</div>
</el-dialog>
@ -664,7 +664,7 @@ export default {
},
/** 撤单按钮操作 */
handleRecall(row) {
this.$modal.confirm('撤回此单后,该合同所有出库单以及关联的发货纪录将同步删除,操作不可恢复,请确认后执行!').then(function() {
this.$modal.confirm('撤回此单后,该合同绑定的采购单和SN码信息将同步解除该合同所有出库单以及关联的发货纪录将同步删除,操作不可恢复,请确认后执行!').then(function() {
return recallExecution(row.id);
}).then(() => {
this.getList();
@ -711,8 +711,36 @@ export default {
}
return defaultValue;
},
handleBindNumInput(row) {
this.$set(this.stockingBindDraftMap, row.purchaseId, row.phNum);
handleBindNumInput(row, item) {
const rawValue = row.phNum === '' || row.phNum === null || row.phNum === undefined ? 0 : Number(row.phNum);
const minValue = row.bhNum === '' || row.bhNum === null || row.bhNum === undefined ? 0 : Number(row.bhNum);
const maxValue = this.calculateMaxPhNum(row, item);
const validValue = Math.max(minValue, Math.min(rawValue, maxValue));
row.phNum = validValue;
this.$set(this.stockingBindDraftMap, row.purchaseId, validValue);
},
calculateMaxPhNum(row, item) {
const originalPhNum = row.originalPhNum === '' || row.originalPhNum === null || row.originalPhNum === undefined ? 0 : Number(row.originalPhNum);
const originalKyNum = row.originalKyNum === '' || row.originalKyNum === null || row.originalKyNum === undefined ? 0 : Number(row.originalKyNum);
const orderNum = item ? (item.orderNum === '' || item.orderNum === null || item.orderNum === undefined ? 0 : Number(item.orderNum)) : 0;
const maxPhysical = originalPhNum + originalKyNum;
let otherRowsPhNumSum = 0;
if (item && item.bindList) {
item.bindList.forEach(b => {
if (b.purchaseId !== row.purchaseId) {
const p = Number(b.phNum) || 0;
otherRowsPhNumSum += p;
}
});
}
const maxAllowedByOrder = orderNum - otherRowsPhNumSum;
return Math.min(maxPhysical, maxAllowedByOrder);
},
loadBindPageData(orderCode, item) {
return productMatchBindList(orderCode, item.productCode, {
@ -756,50 +784,20 @@ export default {
},
handleBindNumChange(row, item) {
const rawValue = row.phNum === '' || row.phNum === null || row.phNum === undefined ? 0 : Number(row.phNum);
const cgNum = row.cgNum === '' || row.cgNum === null || row.cgNum === undefined ? 0 : Number(row.cgNum);
const originalKyNum = row.originalKyNum === '' || row.originalKyNum === null || row.originalKyNum === undefined ? 0 : Number(row.originalKyNum);
const bhNum = row.bhNum === '' || row.bhNum === null || row.bhNum === undefined ? 0 : Number(row.bhNum);
const originalPhNum = row.originalPhNum === '' || row.originalPhNum === null || row.originalPhNum === undefined ? 0 : Number(row.originalPhNum);
const originalKyNum = row.originalKyNum === '' || row.originalKyNum === null || row.originalKyNum === undefined ? 0 : Number(row.originalKyNum);
const minValue = row.bhNum === '' || row.bhNum === null || row.bhNum === undefined ? 0 : Number(row.bhNum);
const maxValue = this.calculateMaxPhNum(row, item);
const orderNum = item ? (item.orderNum === '' || item.orderNum === null || item.orderNum === undefined ? 0 : Number(item.orderNum)) : 0;
const originalTotalPhNum = item ? (item.originalTotalPhNum === '' || item.originalTotalPhNum === null || item.originalTotalPhNum === undefined ? 0 : Number(item.originalTotalPhNum)) : 0;
let nextValue = Math.max(rawValue, bhNum);
const maxPhysical = originalPhNum + originalKyNum;
let otherRowsDiffSum = 0;
if (item && item.bindList) {
item.bindList.forEach(b => {
if (b.purchaseId !== row.purchaseId) {
const p = Number(b.phNum) || 0;
const op = Number(b.originalPhNum) || 0;
otherRowsDiffSum += (p - op);
}
});
}
const maxAllowedDiff = orderNum - originalTotalPhNum - otherRowsDiffSum;
const maxAllowedByOrder = originalPhNum + maxAllowedDiff;
let upperLimit = Math.min(maxPhysical, maxAllowedByOrder);
if (nextValue > upperLimit) {
nextValue = upperLimit;
}
if (nextValue < bhNum) {
nextValue = bhNum;
}
if (nextValue < 0) {
nextValue = 0;
}
const nextValue = Math.max(minValue, Math.min(rawValue, maxValue));
row.phNum = nextValue;
const diff = nextValue - originalPhNum;
row.kyNum = originalKyNum - diff;
this.$set(this.stockingBindDraftMap, row.purchaseId, nextValue); },
this.$set(this.stockingBindDraftMap, row.purchaseId, nextValue);
},
handleSaveStockingBind() {
const changedList = [];
this.stockingDetailList.forEach(item => {
@ -1032,7 +1030,7 @@ export default {
}
saveQuotaPromise.then(() => {
return bindOrderSnCodes(this.stockingDetailRow.orderCode, this.outerSnProductRow.productCode, this.outerSnSelectedList);
return bindOrderSnCodes(this.stockingDetailRow.orderCode, this.outerSnProductRow.productCode, this.outerSnBindRow.purchaseNo, this.stockingDetailRow.id, this.outerSnBindRow.purchaseId, this.outerSnSelectedList);
}).then(response => {
loading.close();
this.$message.success(`成功分配 ${this.outerSnSelectedList.length} 个SN码` + (changedList.length > 0 ? ',并同步保存了配额修改' : ''));
@ -1282,20 +1280,6 @@ export default {
margin-bottom: 8px;
}
.outer-sn-info {
font-size: 13px;
color: #606266;
}
.outer-sn-info-label {
color: #909399;
}
.outer-sn-info-value {
color: #303133;
font-weight: 500;
}
.outer-sn-stats {
display: flex;
align-items: center;
@ -1449,14 +1433,6 @@ export default {
color: #909399;
}
.outer-sn-summary {
margin-bottom: 12px;
}
.outer-sn-warehouse-table {
margin-bottom: 12px;
}
.stocking-status {
display: inline-flex;
align-items: center;
@ -1488,66 +1464,6 @@ export default {
border: 1px solid #d9ecff;
}
.stocking-status--green {
color: #67c23a;
background: #f0f9eb;
border: 1px solid #e1f3d8;
}
.stocking-status--green {
color: #67c23a;
background: #f0f9eb;
border: 1px solid #e1f3d8;
}
</style>
9399;
}
.outer-sn-summary {
margin-bottom: 12px;
}
.outer-sn-warehouse-table {
margin-bottom: 12px;
}
.stocking-status {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 64px;
height: 24px;
padding: 0 10px;
border-radius: 12px;
font-size: 12px;
line-height: 1;
font-weight: 500;
}
.stocking-status--yellow {
color: #e6a23c;
background: #fdf6ec;
border: 1px solid #faecd8;
}
.stocking-status--purple {
color: #8a4f83;
background: #f6f0f7;
border: 1px solid #eadfec;
}
.stocking-status--blue {
color: #409eff;
background: #ecf5ff;
border: 1px solid #d9ecff;
}
.stocking-status--green {
color: #67c23a;
background: #f0f9eb;
border: 1px solid #e1f3d8;
}
.stocking-status--green {
color: #67c23a;
background: #f0f9eb;

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
<title>紫光汇智售后查询系统</title>
</head>
<body>
<noscript>

View File

@ -357,7 +357,6 @@ export default {
}
},
created() {
document.title = '紫光汇智售后查询'
const sn = (this.$route.query.sn || '').trim()
if (sn) {
this.queryMode = 'single'

View File

@ -113,6 +113,11 @@
<groupId>cn.hutool</groupId>
<artifactId>hutool-extra</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>

View File

@ -42,15 +42,15 @@ public class TemplateMailUtil {
* @Date 2025/07/29 09:55
*/
public static void sendTemplateMail(List<String> toEmail, String title, MailTemplate path, Dict dict) {
sendTemplateMail(toEmail, title, path, dict, null, true);
sendTemplateMail(toEmail, title, path, dict, null, Boolean.TRUE);
}
public static void sendTemplateMail(List<String> toEmail, String title, MailTemplate path, Dict dict, List<String> toCssEmail) {
sendTemplateMail(toEmail, title, path, dict, toCssEmail, true);
sendTemplateMail(toEmail, title, path, dict, toCssEmail, Boolean.TRUE);
}
public static void sendTemplateMailNotImage(List<String> toEmail, String title, MailTemplate path, Dict dict) {
sendTemplateMail(toEmail, title, path, dict, null, false);
sendTemplateMail(toEmail, title, path, dict, null, Boolean.FALSE);
}
public static void sendTemplateMail(List<String> toEmail, String title, MailTemplate path, Dict dict, List<String> toCssEmail, Boolean addImage) {

View File

@ -1683,12 +1683,23 @@ public class ExcelUtil<T>
Cell cell = row.getCell(column);
if (StringUtils.isNotNull(cell))
{
if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA)
if (cell.getCellType() == CellType.FORMULA)
{
try
{
val = cell.getStringCellValue();
}
catch (IllegalStateException e)
{
val = String.valueOf(cell.getNumericCellValue());
}
}
else if (cell.getCellType() == CellType.NUMERIC)
{
val = cell.getNumericCellValue();
if (DateUtil.isCellDateFormatted(cell))
{
val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换
val = DateUtil.getJavaDate((Double) val);
}
else
{

View File

@ -10,6 +10,7 @@ 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.BindOrderSnCodesDto;
import com.ruoyi.sip.dto.OrderProductMatchBindDto;
import com.ruoyi.sip.dto.OrderProductMatchDto;
import com.ruoyi.sip.flowable.domain.Todo;
@ -198,11 +199,8 @@ public class VueProjectOrderInfoController extends BaseController {
* 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));
public AjaxResult bindOrderSnCodes(@RequestBody BindOrderSnCodesDto params) {
return toAjax(projectOrderInfoService.bindOrderSnCodes(params));
}
}

View File

@ -0,0 +1,31 @@
package com.ruoyi.sip.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BindOrderSnCodesDto {
/** 合同编号 */
private String orderCode;
/** 产品编码 */
private String productCode;
/** 采购单号 */
private String purchaseNo;
/** 订单主键 */
private Long orderId;
/** 采购单主键 */
private Long purchaseId;
/** SN码列表 */
private List<String> productSnList;
}

View File

@ -87,4 +87,6 @@ public interface InventoryInfoMapper
int clearOrderCodeByOrderCodeAndProductCode(@Param("orderCode") String orderCode, @Param("productCode") String productCode);
int updateOrderCodeByProductSnList(@Param("productSnList") List<String> productSnList, @Param("orderCode") String orderCode);
int countByOrderCodeAndPurchaseNo(@Param("orderCode") String orderCode, @Param("purchaseNo") String purchaseNo);
}

View File

@ -10,4 +10,6 @@ public interface OmsPurchaseOrderMapMapper {
int insertOmsPurchaseOrderMap(OmsPurchaseOrderMap omsPurchaseOrderMap);
int updateOmsPurchaseOrderMap(OmsPurchaseOrderMap omsPurchaseOrderMap);
int initOmsPurchaseOrderMapBindNum(@Param("orderId") Long orderId);
}

View File

@ -6,6 +6,7 @@ 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.BindOrderSnCodesDto;
import com.ruoyi.sip.dto.OrderProductMatchBindDto;
import com.ruoyi.sip.dto.OrderProductMatchDto;
import com.ruoyi.sip.dto.OrderProductMatchSnDto;
@ -119,6 +120,6 @@ public interface IProjectOrderInfoService
OrderProductMatchSnDto selectPurchaseSnList(String purchaseNo, String orderCode);
int bindOrderSnCodes(String orderCode, String productCode, List<String> productSnList);
int bindOrderSnCodes(BindOrderSnCodesDto params);
}

View File

@ -10,6 +10,8 @@ import com.ruoyi.sip.dto.inventory.ProductDetail;
import com.ruoyi.sip.dto.inventory.ProductWarehouseInfo;
import com.ruoyi.sip.flowable.service.TodoService;
import com.ruoyi.sip.mapper.InventoryDeliveryMapper;
import com.ruoyi.sip.mapper.InventoryInfoMapper;
import com.ruoyi.sip.mapper.OmsPurchaseOrderMapMapper;
import com.ruoyi.sip.mapper.ProjectOrderInfoMapper;
import com.ruoyi.sip.service.*;
import com.ruoyi.sip.vo.DeliveryApproveVo;
@ -56,11 +58,15 @@ public class ExecutionTrackServiceImpl implements IExecutionTrackService {
@Autowired
private InventoryDeliveryMapper deliveryMapper;
@Autowired
private InventoryInfoMapper inventoryInfoMapper;
@Autowired
private TodoService todoService;
@Autowired
private IProjectProductInfoBakService projectProductInfoBakService;
@Autowired
private IProjectOrderInfoRecallService projectOrderInfoRecallService;
@Autowired
private OmsPurchaseOrderMapMapper omsPurchaseOrderMapMapper;
@Override
public ExecutionOrderVo selectInfo(Long id) {
ExecutionOrderVo vo = new ExecutionOrderVo();
@ -263,6 +269,7 @@ public class ExecutionTrackServiceImpl implements IExecutionTrackService {
updateOrder.setVersionCode(String.valueOf(Integer.parseInt(projectOrderInfo.getVersionCode())+1));
updateOrder.setOrderStatus(ProjectOrderInfo.OrderStatus.APPROVE_REJECT.getCode());
updateOrder.setActualPurchaseAmount(projectOrderInfo.getShipmentAmount());
updateOrder.setOrderStockingStatus(ProjectOrderInfo.OrderStockingStatusEnum.PHZ.getCode());
updateOrder.setUpdateTime(new Date());
updateOrder.setId(id);
projectOrderInfoMapper.updateProjectOrderInfo(updateOrder);
@ -278,6 +285,14 @@ public class ExecutionTrackServiceImpl implements IExecutionTrackService {
//还原库存
inventoryInfoService.recallByOrderCode(Collections.singletonList(projectOrderInfo.getOrderCode()));
//解除订单与SN码的绑定
List<ProjectProductInfo> recallProductInfos = projectProductInfoService.selectProjectProductInfoListByProjectId(Collections.singletonList(projectOrderInfo.getProjectId()));
recallProductInfos.stream()
.map(ProjectProductInfo::getProductBomCode)
.distinct()
.forEach(productCode -> inventoryInfoMapper.clearOrderCodeByOrderCodeAndProductCode(projectOrderInfo.getOrderCode(), productCode));
//初始化订单与采购单的绑定数量bindNum = 0
omsPurchaseOrderMapMapper.initOmsPurchaseOrderMapBindNum(id);
//累计发货
List<InventoryDelivery> inventoryDeliveries = deliveryMapper.selectQuantityByOrderCodeStatus(projectOrderInfo.getOrderCode(), InventoryDelivery.DeliveryStatusEnum.CONFIRM_DELIVERY.getCode());

View File

@ -2909,7 +2909,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
}
ProjectOrderInfo projectOrderInfo = projectOrderInfoMapper.selectProjectOrderInfoById(omsPurchaseOrderMap.getOrderId());
if (projectOrderInfo != null) {
refreshOrderStockingStatus(projectOrderInfo.getOrderCode());
this.refreshOrderStockingStatus(projectOrderInfo.getOrderCode());
}
return result;
}
@ -2935,19 +2935,40 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
}
@Override
public int bindOrderSnCodes(String orderCode, String productCode, List<String> productSnList) {
if (StringUtils.isEmpty(orderCode) || StringUtils.isEmpty(productCode)) {
public int bindOrderSnCodes(BindOrderSnCodesDto params) {
if (StringUtils.isEmpty(params.getOrderCode()) || StringUtils.isEmpty(params.getProductCode())) {
return 0;
}
inventoryInfoMapper.clearOrderCodeByOrderCodeAndProductCode(orderCode, productCode);
inventoryInfoMapper.clearOrderCodeByOrderCodeAndProductCode(params.getOrderCode(), params.getProductCode());
int result = 1;
if (CollUtil.isNotEmpty(productSnList)) {
result = inventoryInfoMapper.updateOrderCodeByProductSnList(productSnList, orderCode);
if (CollUtil.isNotEmpty(params.getProductSnList())) {
result = inventoryInfoMapper.updateOrderCodeByProductSnList(params.getProductSnList(), params.getOrderCode());
}
refreshOrderStockingStatus(orderCode);
//根据实际绑定的sn码修改订单与采购单的绑定数
if (params.getOrderId() != null && params.getPurchaseId() != null && StringUtils.isNotEmpty(params.getPurchaseNo())) {
int actualBindNum = inventoryInfoMapper.countByOrderCodeAndPurchaseNo(params.getOrderCode(), params.getPurchaseNo());
OmsPurchaseOrderMap map = omsPurchaseOrderMapMapper.selectByOrderIdAndPurchaseId(params.getOrderId(), params.getPurchaseId());
if (map == null) {
map = new OmsPurchaseOrderMap();
map.setOrderId(params.getOrderId());
map.setPurchaseId(params.getPurchaseId());
map.setBindNum(actualBindNum);
omsPurchaseOrderMapMapper.insertOmsPurchaseOrderMap(map);
} else {
map.setBindNum(actualBindNum);
omsPurchaseOrderMapMapper.updateOmsPurchaseOrderMap(map);
}
}
//更新订单的备货状态
this.refreshOrderStockingStatus(params.getOrderCode());
return result;
}
/**
*
*
* @param orderCode
*/
private void refreshOrderStockingStatus(String orderCode) {
if (StringUtils.isEmpty(orderCode)) {
return;

View File

@ -201,7 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<update id="clearOutInfo">
update oms_inventory_info
set inventory_status = 0,outer_code=null,order_code=null
set inventory_status = 0,outer_code=null
where id in
<foreach item="id" collection="list" separator="," open="(" close=")">
#{id}
@ -209,7 +209,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<update id="recallByOrderCode">
update oms_inventory_info
set inventory_status = 0,outer_code=null
set inventory_status = 0, outer_code = null, order_code = null
where outer_code in (select outer_code from oms_inventory_outer where order_code in <foreach item="orderCode" collection="list" separator="," open="(" close=")">
#{orderCode}
</foreach>)
@ -233,6 +233,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</update>
<select id="countByOrderCodeAndPurchaseNo" resultType="int">
select count(1)
from oms_inventory_info t1
inner join oms_inventory_inner t2 on t1.inner_code = t2.inner_code
where t1.order_code = #{orderCode}
and t2.purchase_no = #{purchaseNo}
</select>
<delete id="deleteInventoryInfoById" parameterType="Long">
delete from oms_inventory_info where id = #{id}
</delete>

View File

@ -15,7 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, order_id, purchase_id, bind_num
from oms_purchase_order_map
where order_id = #{orderId}
and purchase_id = #{purchaseId}
and purchase_id = #{purchaseId}
limit 1
</select>
@ -30,4 +30,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<update id="initOmsPurchaseOrderMapBindNum">
update oms_purchase_order_map
set bind_num = 0
where order_id = #{orderId}
</update>
</mapper>