1.解决产品入库,库存增加时串码可以重复的缺陷,增加判断;

2.修复库存调拨反审核失败的缺陷,在待发货,待收货状态反审核查找库存时门店id需使用调出门店id;
This commit is contained in:
chenlin 2024-07-17 10:56:16 +08:00
parent b7472787c0
commit 6c65d3940b
3 changed files with 22 additions and 1 deletions

View File

@ -843,7 +843,7 @@ func cancelAllotAuditAndUpdateStock(gdb *gorm.DB, allotOrder ErpInventoryAllotOr
for _, v := range trimCommodities {
var stockCommodity []ErpStockCommodity
err := orm.Eloquent.Table("erp_stock_commodity").Where("erp_commodity_id = ? AND store_id = ? "+
"AND state = ? AND imei = ?", v.CommodityId, allotOrder.ReceiveStoreId, InAllot, v.IMEI).
"AND state = ? AND imei = ?", v.CommodityId, allotOrder.DeliverStoreId, InAllot, v.IMEI).
Find(&stockCommodity).Error
if err != nil {
return fmt.Errorf("查询商品库存失败:[%s]", err.Error())

View File

@ -215,6 +215,17 @@ func checkChangeInventoryParam(req *InventoryChangeAddReq, editFlag bool) error
if stockCount < int64(item.Count) {
return fmt.Errorf("商品[%s]库存数量[%d]少于库存减少数量[%d]", item.CommodityName, stockCount, item.Count)
}
} else { // 库存增加
// 如果该商品是串码商品,判断其串码是否会重复
if item.IMEI != "" {
exist, err := QueryRecordExist(fmt.Sprintf("SELECT * FROM erp_stock_commodity WHERE FIND_IN_SET('%s', imei) > 0", item.IMEI))
if err != nil {
logger.Error("exist sn err")
}
if exist {
return fmt.Errorf("串码有重复项请修改[%s]", item.IMEI)
}
}
}
}

View File

@ -213,6 +213,16 @@ func CheckProductInventoryParam(req *ProductInventoryAddReq, editFlag bool) erro
} else {
_, ok := IMEICommodityMap[item.IMEI]
if !ok {
// 如果该商品是串码商品,判断其串码是否会重复
if item.IMEI != "" {
exist, err := QueryRecordExist(fmt.Sprintf("SELECT * FROM erp_stock_commodity WHERE FIND_IN_SET('%s', imei) > 0", item.IMEI))
if err != nil {
logger.Error("exist sn err")
}
if exist {
return fmt.Errorf("串码有重复项请修改[%s]", item.IMEI)
}
}
IMEICommodityMap[item.IMEI] = true
} else {
return fmt.Errorf("串码[%s]有重复项", item.IMEI)