优化项目管理
This commit is contained in:
@@ -146,6 +146,13 @@ func (c *BackendCrmProductController) Create() {
|
||||
if lineType != "dev" {
|
||||
lineType = "product"
|
||||
}
|
||||
// 非开发行不保留开发字段,避免残留(如 dev_tree="[]")导致清单调用时被误判为软件开发行
|
||||
devUnitPrice := p.DevUnitPrice
|
||||
devTree := string(p.DevTree)
|
||||
if lineType != "dev" {
|
||||
devUnitPrice = 0
|
||||
devTree = ""
|
||||
}
|
||||
now := time.Now()
|
||||
row := models.TenantCrmProduct{
|
||||
TenantID: pipelineTenantID(claims),
|
||||
@@ -158,8 +165,8 @@ func (c *BackendCrmProductController) Create() {
|
||||
CostPrice: p.CostPrice,
|
||||
TaxRate: p.TaxRate,
|
||||
LineType: lineType,
|
||||
DevUnitPrice: p.DevUnitPrice,
|
||||
DevTree: string(p.DevTree),
|
||||
DevUnitPrice: devUnitPrice,
|
||||
DevTree: devTree,
|
||||
Status: status,
|
||||
Remark: p.Remark,
|
||||
CreateUserID: pipelineUID(claims),
|
||||
@@ -212,24 +219,31 @@ func (c *BackendCrmProductController) Update() {
|
||||
if lineType != "dev" {
|
||||
lineType = "product"
|
||||
}
|
||||
// 非开发行清空开发字段,避免残留导致清单调用时被误判为软件开发行
|
||||
devUnitPrice := p.DevUnitPrice
|
||||
devTree := string(p.DevTree)
|
||||
if lineType != "dev" {
|
||||
devUnitPrice = 0
|
||||
devTree = ""
|
||||
}
|
||||
now := time.Now()
|
||||
_, err = models.Orm.QueryTable(new(models.TenantCrmProduct)).
|
||||
Filter("id", id).Filter("tenant_id", tenantID).
|
||||
Update(orm.Params{
|
||||
"product_no": strings.TrimSpace(p.ProductNo),
|
||||
"product_name": strings.TrimSpace(p.ProductName),
|
||||
"category": strings.TrimSpace(p.Category),
|
||||
"unit": strings.TrimSpace(p.Unit),
|
||||
"spec": strings.TrimSpace(p.Spec),
|
||||
"price": p.Price,
|
||||
"cost_price": p.CostPrice,
|
||||
"tax_rate": p.TaxRate,
|
||||
"line_type": lineType,
|
||||
"dev_unit_price": p.DevUnitPrice,
|
||||
"dev_tree": p.DevTree,
|
||||
"status": status,
|
||||
"remark": p.Remark,
|
||||
"update_time": now,
|
||||
"product_no": strings.TrimSpace(p.ProductNo),
|
||||
"product_name": strings.TrimSpace(p.ProductName),
|
||||
"category": strings.TrimSpace(p.Category),
|
||||
"unit": strings.TrimSpace(p.Unit),
|
||||
"spec": strings.TrimSpace(p.Spec),
|
||||
"price": p.Price,
|
||||
"cost_price": p.CostPrice,
|
||||
"tax_rate": p.TaxRate,
|
||||
"line_type": lineType,
|
||||
"dev_unit_price": devUnitPrice,
|
||||
"dev_tree": devTree,
|
||||
"status": status,
|
||||
"remark": p.Remark,
|
||||
"update_time": now,
|
||||
})
|
||||
if err != nil {
|
||||
pipelineErr(&c.Controller, 500, 500, "更新失败: "+err.Error())
|
||||
|
||||
Reference in New Issue
Block a user