Parcourir la source

Merge branch 'master' of 192.168.30.132:MTP2.0/MTP20_IF

zhou.xiaoning il y a 4 ans
Parent
commit
414c868e24
6 fichiers modifiés avec 91 ajouts et 5 suppressions
  1. 24 0
      docs/docs.go
  2. 24 0
      docs/swagger.json
  3. 18 0
      docs/swagger.yaml
  4. 7 1
      models/ermcp.go
  5. 1 1
      models/ermcpOPApply.go
  6. 17 3
      models/ermcpReport.go

+ 24 - 0
docs/docs.go

@@ -10164,6 +10164,10 @@ var doc = `{
                     "description": "所属机构T",
                     "type": "integer"
                 },
+                "buyinqty": {
+                    "description": "采购入库量",
+                    "type": "number"
+                },
                 "enumdicname": {
                     "description": "现货商品单位名称",
                     "type": "string"
@@ -10172,6 +10176,10 @@ var doc = `{
                     "description": "日照时期(yyyyMMdd)",
                     "type": "string"
                 },
+                "selloutqty": {
+                    "description": "销售出库量",
+                    "type": "number"
+                },
                 "todaybuyreckonqty": {
                     "description": "采购确定量",
                     "type": "number"
@@ -10209,6 +10217,10 @@ var doc = `{
                     "description": "所属机构T",
                     "type": "integer"
                 },
+                "buyinqty": {
+                    "description": "采购入库量",
+                    "type": "number"
+                },
                 "cycletime": {
                     "description": "周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】",
                     "type": "string"
@@ -10221,6 +10233,10 @@ var doc = `{
                     "description": "现货商品单位名称",
                     "type": "string"
                 },
+                "selloutqty": {
+                    "description": "销售出库量",
+                    "type": "number"
+                },
                 "todaybuyreckonqty": {
                     "description": "采购确定量",
                     "type": "number"
@@ -10258,6 +10274,10 @@ var doc = `{
                     "description": "所属机构T",
                     "type": "integer"
                 },
+                "buyinqty": {
+                    "description": "采购入库量",
+                    "type": "number"
+                },
                 "enumdicname": {
                     "description": "现货商品单位名称",
                     "type": "string"
@@ -10266,6 +10286,10 @@ var doc = `{
                     "description": "日照时期(yyyyMMdd)",
                     "type": "string"
                 },
+                "selloutqty": {
+                    "description": "销售出库量",
+                    "type": "number"
+                },
                 "todaybuyreckonqty": {
                     "description": "采购确定量",
                     "type": "number"

+ 24 - 0
docs/swagger.json

@@ -10148,6 +10148,10 @@
                     "description": "所属机构T",
                     "type": "integer"
                 },
+                "buyinqty": {
+                    "description": "采购入库量",
+                    "type": "number"
+                },
                 "enumdicname": {
                     "description": "现货商品单位名称",
                     "type": "string"
@@ -10156,6 +10160,10 @@
                     "description": "日照时期(yyyyMMdd)",
                     "type": "string"
                 },
+                "selloutqty": {
+                    "description": "销售出库量",
+                    "type": "number"
+                },
                 "todaybuyreckonqty": {
                     "description": "采购确定量",
                     "type": "number"
@@ -10193,6 +10201,10 @@
                     "description": "所属机构T",
                     "type": "integer"
                 },
+                "buyinqty": {
+                    "description": "采购入库量",
+                    "type": "number"
+                },
                 "cycletime": {
                     "description": "周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】",
                     "type": "string"
@@ -10205,6 +10217,10 @@
                     "description": "现货商品单位名称",
                     "type": "string"
                 },
+                "selloutqty": {
+                    "description": "销售出库量",
+                    "type": "number"
+                },
                 "todaybuyreckonqty": {
                     "description": "采购确定量",
                     "type": "number"
@@ -10242,6 +10258,10 @@
                     "description": "所属机构T",
                     "type": "integer"
                 },
+                "buyinqty": {
+                    "description": "采购入库量",
+                    "type": "number"
+                },
                 "enumdicname": {
                     "description": "现货商品单位名称",
                     "type": "string"
@@ -10250,6 +10270,10 @@
                     "description": "日照时期(yyyyMMdd)",
                     "type": "string"
                 },
+                "selloutqty": {
+                    "description": "销售出库量",
+                    "type": "number"
+                },
                 "todaybuyreckonqty": {
                     "description": "采购确定量",
                     "type": "number"

+ 18 - 0
docs/swagger.yaml

@@ -2407,12 +2407,18 @@ definitions:
       areauserid:
         description: 所属机构T
         type: integer
+      buyinqty:
+        description: 采购入库量
+        type: number
       enumdicname:
         description: 现货商品单位名称
         type: string
       reckondate:
         description: 日照时期(yyyyMMdd)
         type: string
+      selloutqty:
+        description: 销售出库量
+        type: number
       todaybuyreckonqty:
         description: 采购确定量
         type: number
@@ -2440,6 +2446,9 @@ definitions:
       areauserid:
         description: 所属机构T
         type: integer
+      buyinqty:
+        description: 采购入库量
+        type: number
       cycletime:
         description: 周期时间 月(YYYYMM)  季(YYYYQ) 年(YYYY) 周(YYYYIW) 全(0)【原值】
         type: string
@@ -2449,6 +2458,9 @@ definitions:
       enumdicname:
         description: 现货商品单位名称
         type: string
+      selloutqty:
+        description: 销售出库量
+        type: number
       todaybuyreckonqty:
         description: 采购确定量
         type: number
@@ -2476,12 +2488,18 @@ definitions:
       areauserid:
         description: 所属机构T
         type: integer
+      buyinqty:
+        description: 采购入库量
+        type: number
       enumdicname:
         description: 现货商品单位名称
         type: string
       reckondate:
         description: 日照时期(yyyyMMdd)
         type: string
+      selloutqty:
+        description: 销售出库量
+        type: number
       todaybuyreckonqty:
         description: 采购确定量
         type: number

+ 7 - 1
models/ermcp.go

@@ -217,7 +217,13 @@ type ErmcpModel struct {
 
 func (r *ErmcpModel) calc() {
 	r.TotalAmount = r.LoanAmount + r.ReckonOtherAmount + r.Margin
-	r.UnpayAmount = r.TotalAmount - r.ReckonedAmount
+	if r.Contracctstatus == 3 {
+		// 已完结的合同, 不再计算待支收额,=0
+		r.UnpayAmount = 0
+	} else {
+		r.UnpayAmount = r.TotalAmount - r.ReckonedAmount
+	}
+
 	if r.Contracttype == 1 {
 		//采购合同, 取销售方名称
 		r.AccountName = mtpcache.GetUserNameByUserId(r.SELLUSERID)

+ 1 - 1
models/ermcpOPApply.go

@@ -84,7 +84,7 @@ func (r *ErmcpOPApplyModel) buildSql(opType int32) string {
 		"  left join useraccount u2" +
 		"    on s.selluserid = u2.userid" +
 		"  left join enumdicitem e" +
-		"    on e.enumitemname = g.goodunitid" +
+		"    on e.enumitemname = w.unitid" +
 		"   and e.enumdiccode = 'goodsunit'" +
 		" where t.operateapplytype = %v" +
 		"   and s.userid = %v"

+ 17 - 3
models/ermcpReport.go

@@ -402,6 +402,8 @@ type ErmcpReportDaySpot struct {
 	WRSTANDARDNAME     string  `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'"`         // 现货商品名称
 	WRSTANDARDCODE     string  `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`         // 现货商品代码
 	UNITID             int32   `json:"-"  xorm:"'UNITID'"`                              // 现货商品单位id
+	BUYINQTY           float64 `json:"buyinqty"  xorm:"'BUYINQTY'"`                     // 采购入库量
+	SELLOUTQTY         float64 `json:"selloutqty"  xorm:"'SELLOUTQTY'"`                 // 销售出库量
 
 	ENUMDICNAME        string  `json:"enumdicname"`        // 现货商品单位名称
 	TOTALBUYPRICEDQTY  float64 `json:"totalbuypricedqty"`  // 采购定价量 = 期末 - 期初
@@ -418,7 +420,8 @@ func (r *ErmcpReportDaySpot) Calc() {
 }
 
 func (r *ErmcpReportDaySpot) buildSql() string {
-	var sqlId utils.SQLVal = "select t.BUYPRICEDQTY," +
+	var sqlId utils.SQLVal = "select t.reckondate," +
+		"       t.BUYPRICEDQTY," +
 		"       t.SELLPRICEDQTY," +
 		"       t.Oribuypricedqty," +
 		"       t.Orisellpricedqty," +
@@ -429,8 +432,12 @@ func (r *ErmcpReportDaySpot) buildSql() string {
 		"       t.AREAUSERID," +
 		"       w.wrstandardname," +
 		"       w.wrstandardcode," +
-		"       w.unitid" +
+		"       w.unitid," +
+		"       s.todaybuyinqty      buyinqty," +
+		"       s.todayselloutqty    selloutqty" +
 		"  from RECKON_ERMCP_AREASPOT t" +
+		"  left join Reckon_ERMCP_AreaStock s" +
+		"    on t.reckondate = s.reckondate" +
 		"  left join wrstandard w" +
 		"    on t.wrstandardid = w.wrstandardid" +
 		" where 1 = 1"
@@ -479,6 +486,8 @@ type ErmcpReportMonSpot struct {
 	WRSTANDARDNAME     string  `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'"`         // 现货商品名称
 	WRSTANDARDCODE     string  `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`         // 现货商品代码
 	UNITID             int32   `json:"-"  xorm:"'UNITID'"`                              // 现货商品单位id
+	BUYINQTY           float64 `json:"buyinqty"  xorm:"'BUYINQTY'"`                     // 采购入库量
+	SELLOUTQTY         float64 `json:"selloutqty"  xorm:"'SELLOUTQTY'"`                 // 销售出库量
 
 	ENUMDICNAME        string  `json:"enumdicname"`        // 现货商品单位名称
 	TOTALBUYPRICEDQTY  float64 `json:"totalbuypricedqty"`  // 采购定价量 = 期末 - 期初
@@ -505,8 +514,13 @@ func (r *ErmcpReportMonSpot) buildSql() string {
 		"       t.AREAUSERID," +
 		"       w.wrstandardname," +
 		"       w.wrstandardcode," +
-		"       w.unitid" +
+		"       w.unitid," +
+		"       s.todaybuyinqty      buyinqty," +
+		"       s.todayselloutqty    selloutqty" +
 		"  from Report_ERMCP_AreaSpot t" +
+		"  left join Report_ERMCP_AreaStock s" +
+		"    on t.cycletime = s.cycletime" +
+		"   and t.cycletype = s.cycletype" +
 		"  left join wrstandard w" +
 		"    on t.wrstandardid = w.wrstandardid" +
 		" where t.cycletype = 1"