1.修复采购退货单缺陷:采购退货时没有传门店id导致判断门店权限有误;已修改为后端查询后补充。

This commit is contained in:
chenlin 2025-01-09 17:02:55 +08:00
parent a33e339bd0
commit 278f1591b8

View File

@ -50,6 +50,18 @@ func ErpPurchaseCreate(c *gin.Context) {
return
}
// 如果是采购退货则门店改为采购退货单的门店ID
if req.PurchaseType == model.ErpRejectOrder && req.PurchaseOrderSn != "" {
var erpPurchaseOrder model.ErpPurchaseOrder
err = orm.Eloquent.Table("erp_purchase_order").Where("serial_number=?", req.PurchaseOrderSn).Find(&erpPurchaseOrder).Error
if err != nil {
app.Error(c, http.StatusInternalServerError, err, "新增失败:"+err.Error())
return
}
req.StoreId = erpPurchaseOrder.StoreId
}
// 校验入参门店是否包含在用户所有门店中,是否过期
if !(tools.GetRoleName(c) == "admin" || tools.GetRoleName(c) == "系统管理员") {
if !model.CheckUserStore(req.StoreId, sysUser) {