fix:订单配备货
parent
02f4c47383
commit
8bab6d7d17
|
|
@ -123,10 +123,10 @@ export function purchaseSnList(purchaseNo, orderCode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 订单绑定SN码
|
// 订单绑定SN码
|
||||||
export function bindOrderSnCodes(orderCode, productCode, productSnList) {
|
export function bindOrderSnCodes(orderCode, productCode, purchaseNo, orderId, purchaseId, productSnList) {
|
||||||
return request({
|
return request({
|
||||||
url: '/project/order/vue/bindOrderSnCodes',
|
url: '/project/order/vue/bindOrderSnCodes',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: { orderCode, productCode, productSnList }
|
data: { orderCode, productCode, purchaseNo, orderId, purchaseId, productSnList }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -277,10 +277,10 @@
|
||||||
type="number"
|
type="number"
|
||||||
:disabled="String(scope.row.status) === '0'"
|
:disabled="String(scope.row.status) === '0'"
|
||||||
:min="scope.row.bhNum || 0"
|
:min="scope.row.bhNum || 0"
|
||||||
:max="scope.row.cgNum || 0"
|
:max="calculateMaxPhNum(scope.row, item)"
|
||||||
size="small"
|
size="small"
|
||||||
class="stocking-bind-input"
|
class="stocking-bind-input"
|
||||||
@input="handleBindNumInput(scope.row)"
|
@input="handleBindNumInput(scope.row, item)"
|
||||||
@change="handleBindNumChange(scope.row, item)"
|
@change="handleBindNumChange(scope.row, item)"
|
||||||
></el-input>
|
></el-input>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -321,7 +321,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-button @click="stockingDetailVisible = false">关 闭</el-button>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
@ -664,7 +664,7 @@ export default {
|
||||||
},
|
},
|
||||||
/** 撤单按钮操作 */
|
/** 撤单按钮操作 */
|
||||||
handleRecall(row) {
|
handleRecall(row) {
|
||||||
this.$modal.confirm('撤回此单后,该合同下所有出库单以及关联的发货纪录将同步删除,操作不可恢复,请确认后执行!').then(function() {
|
this.$modal.confirm('撤回此单后,该合同绑定的采购单和SN码信息将同步解除,该合同所有出库单以及关联的发货纪录将同步删除,操作不可恢复,请确认后执行!').then(function() {
|
||||||
return recallExecution(row.id);
|
return recallExecution(row.id);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
|
|
@ -711,8 +711,36 @@ export default {
|
||||||
}
|
}
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
},
|
},
|
||||||
handleBindNumInput(row) {
|
handleBindNumInput(row, item) {
|
||||||
this.$set(this.stockingBindDraftMap, row.purchaseId, row.phNum);
|
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) {
|
loadBindPageData(orderCode, item) {
|
||||||
return productMatchBindList(orderCode, item.productCode, {
|
return productMatchBindList(orderCode, item.productCode, {
|
||||||
|
|
@ -756,50 +784,20 @@ export default {
|
||||||
},
|
},
|
||||||
handleBindNumChange(row, item) {
|
handleBindNumChange(row, item) {
|
||||||
const rawValue = row.phNum === '' || row.phNum === null || row.phNum === undefined ? 0 : Number(row.phNum);
|
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 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 nextValue = Math.max(minValue, Math.min(rawValue, maxValue));
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
row.phNum = nextValue;
|
row.phNum = nextValue;
|
||||||
|
|
||||||
const diff = nextValue - originalPhNum;
|
const diff = nextValue - originalPhNum;
|
||||||
row.kyNum = originalKyNum - diff;
|
row.kyNum = originalKyNum - diff;
|
||||||
|
|
||||||
this.$set(this.stockingBindDraftMap, row.purchaseId, nextValue); },
|
this.$set(this.stockingBindDraftMap, row.purchaseId, nextValue);
|
||||||
|
},
|
||||||
handleSaveStockingBind() {
|
handleSaveStockingBind() {
|
||||||
const changedList = [];
|
const changedList = [];
|
||||||
this.stockingDetailList.forEach(item => {
|
this.stockingDetailList.forEach(item => {
|
||||||
|
|
@ -1032,7 +1030,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
saveQuotaPromise.then(() => {
|
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 => {
|
}).then(response => {
|
||||||
loading.close();
|
loading.close();
|
||||||
this.$message.success(`成功分配 ${this.outerSnSelectedList.length} 个SN码` + (changedList.length > 0 ? ',并同步保存了配额修改' : ''));
|
this.$message.success(`成功分配 ${this.outerSnSelectedList.length} 个SN码` + (changedList.length > 0 ? ',并同步保存了配额修改' : ''));
|
||||||
|
|
@ -1282,20 +1280,6 @@ export default {
|
||||||
margin-bottom: 8px;
|
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 {
|
.outer-sn-stats {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -1449,14 +1433,6 @@ export default {
|
||||||
color: #909399;
|
color: #909399;
|
||||||
}
|
}
|
||||||
|
|
||||||
.outer-sn-summary {
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.outer-sn-warehouse-table {
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stocking-status {
|
.stocking-status {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -1488,66 +1464,6 @@ export default {
|
||||||
border: 1px solid #d9ecff;
|
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 {
|
.stocking-status--green {
|
||||||
color: #67c23a;
|
color: #67c23a;
|
||||||
background: #f0f9eb;
|
background: #f0f9eb;
|
||||||
|
|
|
||||||
|
|
@ -42,15 +42,15 @@ public class TemplateMailUtil {
|
||||||
* @Date 2025/07/29 09:55
|
* @Date 2025/07/29 09:55
|
||||||
*/
|
*/
|
||||||
public static void sendTemplateMail(List<String> toEmail, String title, MailTemplate path, Dict dict) {
|
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) {
|
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) {
|
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) {
|
public static void sendTemplateMail(List<String> toEmail, String title, MailTemplate path, Dict dict, List<String> toCssEmail, Boolean addImage) {
|
||||||
|
|
|
||||||
|
|
@ -1683,12 +1683,23 @@ public class ExcelUtil<T>
|
||||||
Cell cell = row.getCell(column);
|
Cell cell = row.getCell(column);
|
||||||
if (StringUtils.isNotNull(cell))
|
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();
|
val = cell.getNumericCellValue();
|
||||||
if (DateUtil.isCellDateFormatted(cell))
|
if (DateUtil.isCellDateFormatted(cell))
|
||||||
{
|
{
|
||||||
val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换
|
val = DateUtil.getJavaDate((Double) val);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.sip.domain.OmsPurchaseOrderMap;
|
import com.ruoyi.sip.domain.OmsPurchaseOrderMap;
|
||||||
import com.ruoyi.sip.domain.ProjectOrderFileLog;
|
import com.ruoyi.sip.domain.ProjectOrderFileLog;
|
||||||
import com.ruoyi.sip.domain.ProjectOrderInfo;
|
import com.ruoyi.sip.domain.ProjectOrderInfo;
|
||||||
|
import com.ruoyi.sip.dto.BindOrderSnCodesDto;
|
||||||
import com.ruoyi.sip.dto.OrderProductMatchBindDto;
|
import com.ruoyi.sip.dto.OrderProductMatchBindDto;
|
||||||
import com.ruoyi.sip.dto.OrderProductMatchDto;
|
import com.ruoyi.sip.dto.OrderProductMatchDto;
|
||||||
import com.ruoyi.sip.flowable.domain.Todo;
|
import com.ruoyi.sip.flowable.domain.Todo;
|
||||||
|
|
@ -198,11 +199,8 @@ public class VueProjectOrderInfoController extends BaseController {
|
||||||
* 订单绑定SN码
|
* 订单绑定SN码
|
||||||
*/
|
*/
|
||||||
@PostMapping("/bindOrderSnCodes")
|
@PostMapping("/bindOrderSnCodes")
|
||||||
public AjaxResult bindOrderSnCodes(@RequestBody Map<String, Object> params) {
|
public AjaxResult bindOrderSnCodes(@RequestBody BindOrderSnCodesDto params) {
|
||||||
String orderCode = (String) params.get("orderCode");
|
return toAjax(projectOrderInfoService.bindOrderSnCodes(params));
|
||||||
String productCode = (String) params.get("productCode");
|
|
||||||
List<String> productSnList = (List<String>) params.get("productSnList");
|
|
||||||
return toAjax(projectOrderInfoService.bindOrderSnCodes(orderCode, productCode, productSnList));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -87,4 +87,6 @@ public interface InventoryInfoMapper
|
||||||
int clearOrderCodeByOrderCodeAndProductCode(@Param("orderCode") String orderCode, @Param("productCode") String productCode);
|
int clearOrderCodeByOrderCodeAndProductCode(@Param("orderCode") String orderCode, @Param("productCode") String productCode);
|
||||||
|
|
||||||
int updateOrderCodeByProductSnList(@Param("productSnList") List<String> productSnList, @Param("orderCode") String orderCode);
|
int updateOrderCodeByProductSnList(@Param("productSnList") List<String> productSnList, @Param("orderCode") String orderCode);
|
||||||
|
|
||||||
|
int countByOrderCodeAndPurchaseNo(@Param("orderCode") String orderCode, @Param("purchaseNo") String purchaseNo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,6 @@ public interface OmsPurchaseOrderMapMapper {
|
||||||
int insertOmsPurchaseOrderMap(OmsPurchaseOrderMap omsPurchaseOrderMap);
|
int insertOmsPurchaseOrderMap(OmsPurchaseOrderMap omsPurchaseOrderMap);
|
||||||
|
|
||||||
int updateOmsPurchaseOrderMap(OmsPurchaseOrderMap omsPurchaseOrderMap);
|
int updateOmsPurchaseOrderMap(OmsPurchaseOrderMap omsPurchaseOrderMap);
|
||||||
|
|
||||||
|
int initOmsPurchaseOrderMapBindNum(@Param("orderId") Long orderId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.ruoyi.sip.domain.OmsPurchaseOrderMap;
|
||||||
import com.ruoyi.sip.domain.ProjectOrderFileLog;
|
import com.ruoyi.sip.domain.ProjectOrderFileLog;
|
||||||
import com.ruoyi.sip.domain.ProjectOrderInfo;
|
import com.ruoyi.sip.domain.ProjectOrderInfo;
|
||||||
import com.ruoyi.sip.dto.ApiDataQueryDto;
|
import com.ruoyi.sip.dto.ApiDataQueryDto;
|
||||||
|
import com.ruoyi.sip.dto.BindOrderSnCodesDto;
|
||||||
import com.ruoyi.sip.dto.OrderProductMatchBindDto;
|
import com.ruoyi.sip.dto.OrderProductMatchBindDto;
|
||||||
import com.ruoyi.sip.dto.OrderProductMatchDto;
|
import com.ruoyi.sip.dto.OrderProductMatchDto;
|
||||||
import com.ruoyi.sip.dto.OrderProductMatchSnDto;
|
import com.ruoyi.sip.dto.OrderProductMatchSnDto;
|
||||||
|
|
@ -119,6 +120,6 @@ public interface IProjectOrderInfoService
|
||||||
|
|
||||||
OrderProductMatchSnDto selectPurchaseSnList(String purchaseNo, String orderCode);
|
OrderProductMatchSnDto selectPurchaseSnList(String purchaseNo, String orderCode);
|
||||||
|
|
||||||
int bindOrderSnCodes(String orderCode, String productCode, List<String> productSnList);
|
int bindOrderSnCodes(BindOrderSnCodesDto params);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ import com.ruoyi.sip.dto.inventory.ProductDetail;
|
||||||
import com.ruoyi.sip.dto.inventory.ProductWarehouseInfo;
|
import com.ruoyi.sip.dto.inventory.ProductWarehouseInfo;
|
||||||
import com.ruoyi.sip.flowable.service.TodoService;
|
import com.ruoyi.sip.flowable.service.TodoService;
|
||||||
import com.ruoyi.sip.mapper.InventoryDeliveryMapper;
|
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.mapper.ProjectOrderInfoMapper;
|
||||||
import com.ruoyi.sip.service.*;
|
import com.ruoyi.sip.service.*;
|
||||||
import com.ruoyi.sip.vo.DeliveryApproveVo;
|
import com.ruoyi.sip.vo.DeliveryApproveVo;
|
||||||
|
|
@ -56,11 +58,15 @@ public class ExecutionTrackServiceImpl implements IExecutionTrackService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private InventoryDeliveryMapper deliveryMapper;
|
private InventoryDeliveryMapper deliveryMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private InventoryInfoMapper inventoryInfoMapper;
|
||||||
|
@Autowired
|
||||||
private TodoService todoService;
|
private TodoService todoService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IProjectProductInfoBakService projectProductInfoBakService;
|
private IProjectProductInfoBakService projectProductInfoBakService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IProjectOrderInfoRecallService projectOrderInfoRecallService;
|
private IProjectOrderInfoRecallService projectOrderInfoRecallService;
|
||||||
|
@Autowired
|
||||||
|
private OmsPurchaseOrderMapMapper omsPurchaseOrderMapMapper;
|
||||||
@Override
|
@Override
|
||||||
public ExecutionOrderVo selectInfo(Long id) {
|
public ExecutionOrderVo selectInfo(Long id) {
|
||||||
ExecutionOrderVo vo = new ExecutionOrderVo();
|
ExecutionOrderVo vo = new ExecutionOrderVo();
|
||||||
|
|
@ -278,6 +284,14 @@ public class ExecutionTrackServiceImpl implements IExecutionTrackService {
|
||||||
|
|
||||||
//还原库存
|
//还原库存
|
||||||
inventoryInfoService.recallByOrderCode(Collections.singletonList(projectOrderInfo.getOrderCode()));
|
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());
|
List<InventoryDelivery> inventoryDeliveries = deliveryMapper.selectQuantityByOrderCodeStatus(projectOrderInfo.getOrderCode(), InventoryDelivery.DeliveryStatusEnum.CONFIRM_DELIVERY.getCode());
|
||||||
|
|
|
||||||
|
|
@ -2909,7 +2909,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
|
||||||
}
|
}
|
||||||
ProjectOrderInfo projectOrderInfo = projectOrderInfoMapper.selectProjectOrderInfoById(omsPurchaseOrderMap.getOrderId());
|
ProjectOrderInfo projectOrderInfo = projectOrderInfoMapper.selectProjectOrderInfoById(omsPurchaseOrderMap.getOrderId());
|
||||||
if (projectOrderInfo != null) {
|
if (projectOrderInfo != null) {
|
||||||
refreshOrderStockingStatus(projectOrderInfo.getOrderCode());
|
this.refreshOrderStockingStatus(projectOrderInfo.getOrderCode());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -2935,19 +2935,40 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int bindOrderSnCodes(String orderCode, String productCode, List<String> productSnList) {
|
public int bindOrderSnCodes(BindOrderSnCodesDto params) {
|
||||||
if (StringUtils.isEmpty(orderCode) || StringUtils.isEmpty(productCode)) {
|
if (StringUtils.isEmpty(params.getOrderCode()) || StringUtils.isEmpty(params.getProductCode())) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
inventoryInfoMapper.clearOrderCodeByOrderCodeAndProductCode(orderCode, productCode);
|
inventoryInfoMapper.clearOrderCodeByOrderCodeAndProductCode(params.getOrderCode(), params.getProductCode());
|
||||||
int result = 1;
|
int result = 1;
|
||||||
if (CollUtil.isNotEmpty(productSnList)) {
|
if (CollUtil.isNotEmpty(params.getProductSnList())) {
|
||||||
result = inventoryInfoMapper.updateOrderCodeByProductSnList(productSnList, orderCode);
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新订单的备货状态
|
||||||
|
*
|
||||||
|
* @param orderCode
|
||||||
|
*/
|
||||||
private void refreshOrderStockingStatus(String orderCode) {
|
private void refreshOrderStockingStatus(String orderCode) {
|
||||||
if (StringUtils.isEmpty(orderCode)) {
|
if (StringUtils.isEmpty(orderCode)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</update>
|
</update>
|
||||||
<update id="clearOutInfo">
|
<update id="clearOutInfo">
|
||||||
update oms_inventory_info
|
update oms_inventory_info
|
||||||
set inventory_status = 0,outer_code=null,order_code=null
|
set inventory_status = 0,outer_code=null
|
||||||
where id in
|
where id in
|
||||||
<foreach item="id" collection="list" separator="," open="(" close=")">
|
<foreach item="id" collection="list" separator="," open="(" close=")">
|
||||||
#{id}
|
#{id}
|
||||||
|
|
@ -209,7 +209,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</update>
|
</update>
|
||||||
<update id="recallByOrderCode">
|
<update id="recallByOrderCode">
|
||||||
update oms_inventory_info
|
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=")">
|
where outer_code in (select outer_code from oms_inventory_outer where order_code in <foreach item="orderCode" collection="list" separator="," open="(" close=")">
|
||||||
#{orderCode}
|
#{orderCode}
|
||||||
</foreach>)
|
</foreach>)
|
||||||
|
|
@ -233,6 +233,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</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 id="deleteInventoryInfoById" parameterType="Long">
|
||||||
delete from oms_inventory_info where id = #{id}
|
delete from oms_inventory_info where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select id, order_id, purchase_id, bind_num
|
select id, order_id, purchase_id, bind_num
|
||||||
from oms_purchase_order_map
|
from oms_purchase_order_map
|
||||||
where order_id = #{orderId}
|
where order_id = #{orderId}
|
||||||
and purchase_id = #{purchaseId}
|
and purchase_id = #{purchaseId}
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -30,4 +30,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="initOmsPurchaseOrderMapBindNum">
|
||||||
|
update oms_purchase_order_map
|
||||||
|
set bind_num = 0
|
||||||
|
where order_id = #{orderId}
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue