Bläddra i källkod

fix:导出验证合同没有客户名称

zoie 3 månader sedan
förälder
incheckning
706c7730e9
3 ändrade filer med 6 tillägg och 3 borttagningar
  1. 1 1
      controllers/Contract.go
  2. 4 1
      models/Contract/Contract.go
  3. 1 1
      models/Stock/Stock.go

+ 1 - 1
controllers/Contract.go

@@ -1008,7 +1008,7 @@ func (c *ContractController) VerifyContract_Excel() {
 
 	userList, _ := NatsServer.Read_User_List_All()
 	Account.Read_User_All_Map(userList)
-
+	Contract.Read_VerifyContract_All_Map()
 	ContractDao := Contract.NewContract(orm.NewOrm())
 	R_List := ContractDao.Read_VerifyContract_Excel(T_state, T_name, T_start_date, T_end_date)
 	f := excelize.NewFile() //设置单元格值

+ 4 - 1
models/Contract/Contract.go

@@ -243,6 +243,9 @@ func ContractToContract_Detail(t Contract, productList []ContractProduct_R) (r C
 	r.Id = t.Id
 	r.T_number = t.T_number
 	r.T_customer = t.T_customer
+	if len(t.T_customer_id) > 0 {
+		r.T_customer = Read_VerifyContract_Get(t.T_customer_id)
+	}
 	r.T_money = t.T_money
 	r.T_discount = t.T_discount
 	r.T_project = t.T_project
@@ -503,7 +506,7 @@ func (dao *ContractDaoImpl) Read_VerifyContract_List(T_name, T_customer_id strin
 func (dao *ContractDaoImpl) Read_VerifyContract_Excel(T_state int, T_name, T_start_date, T_end_date string) (r_ []Contract_Detail) {
 
 	var maps []Contract
-	sql := "SELECT vc.t_customer as t_customer,vc.t__state, contract.*" +
+	sql := "SELECT vc.t__state, contract.*" +
 		" FROM contract LEFT JOIN verify_contract vc ON vc.t_customer_id=contract.t_customer_id" +
 		" WHERE vc.t__state>0 AND contract.t__state>0"
 	if T_state > 0 {

+ 1 - 1
models/Stock/Stock.go

@@ -185,8 +185,8 @@ func (dao *StockDaoImpl) AddOrUpdate_Occupy_Stock(T_depot_id, T_product_id, T_pr
 
 	_, err = dao.orm.Update(&stock, "T_occupy")
 	if err != nil {
-		err = errors.New(fmt.Sprintf("修改占用库存失败%s,%s", T_product_name, T_product_model))
 		logs.Error(lib.FuncName(), err)
+		err = errors.New(fmt.Sprintf("修改占用库存失败%s,%s", T_product_name, T_product_model))
 		return
 	}