作者 tangxuhui

拉取 生产订单数据

@@ -18,18 +18,24 @@ func NewCrontabService(options map[string]interface{}) *CrontabService { @@ -18,18 +18,24 @@ func NewCrontabService(options map[string]interface{}) *CrontabService {
18 } 18 }
19 19
20 func (crontabService *CrontabService) initTask() { 20 func (crontabService *CrontabService) initTask() {
21 - //PullDataK3Cloud 晚上0时10分执行 21 + //拉取物料数据 晚上0时10分执行
22 pullMaterialK3cloud := task.NewTask("pullMaterialK3cloud", "0 10 0 * * *", func(ctx context.Context) error { 22 pullMaterialK3cloud := task.NewTask("pullMaterialK3cloud", "0 10 0 * * *", func(ctx context.Context) error {
23 srv := syncdata.PullDataK3CloudService{} 23 srv := syncdata.PullDataK3CloudService{}
24 return srv.PullMaterialNewest() 24 return srv.PullMaterialNewest()
25 }) 25 })
26 task.AddTask("pullMaterialK3cloud", pullMaterialK3cloud) 26 task.AddTask("pullMaterialK3cloud", pullMaterialK3cloud)
27 - //PullDataK3Cloud 晚上0时10分执行 27 + //拉取物料分组数据 晚上0时10分执行
28 pullMaterialGroupK3cloud := task.NewTask("pullMaterialGroupK3cloud", "0 10 0 * * *", func(ctx context.Context) error { 28 pullMaterialGroupK3cloud := task.NewTask("pullMaterialGroupK3cloud", "0 10 0 * * *", func(ctx context.Context) error {
29 srv := syncdata.PullDataK3CloudService{} 29 srv := syncdata.PullDataK3CloudService{}
30 return srv.PullMaterialGroup() 30 return srv.PullMaterialGroup()
31 }) 31 })
32 task.AddTask("pullMaterialGroupK3cloud", pullMaterialGroupK3cloud) 32 task.AddTask("pullMaterialGroupK3cloud", pullMaterialGroupK3cloud)
  33 + //拉取订生产订单数据 晚上0时10分执行
  34 + PullPrdMoK3cloud := task.NewTask("PullPrdMoK3cloud", "0 10 0 * * *", func(ctx context.Context) error {
  35 + srv := syncdata.PullDataK3CloudService{}
  36 + return srv.PullPrdMoNewest()
  37 + })
  38 + task.AddTask("PullPrdMoK3cloud", PullPrdMoK3cloud)
33 } 39 }
34 40
35 func (crontabService *CrontabService) StartCrontabTask() { 41 func (crontabService *CrontabService) StartCrontabTask() {
@@ -276,3 +276,156 @@ func (srv *PullDataK3CloudService) PullMaterialGroup() error { @@ -276,3 +276,156 @@ func (srv *PullDataK3CloudService) PullMaterialGroup() error {
276 } 276 }
277 return nil 277 return nil
278 } 278 }
  279 +
  280 +//PullPrdMoNewest 拉取生产订单数据
  281 +func (srv *PullDataK3CloudService) PullPrdMoNewest() error {
  282 + var (
  283 + err error
  284 + prdMoDao *dao.PrdMoK3cloudDao
  285 + )
  286 + transactionContext, err := factory.CreateTransactionContext(nil)
  287 + if err != nil {
  288 + return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  289 + }
  290 + if err := transactionContext.StartTransaction(); err != nil {
  291 + return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  292 + }
  293 + defer func() {
  294 + transactionContext.RollbackTransaction()
  295 + }()
  296 + prdMoDao, err = dao.NewPrdMoK3cloudDao(transactionContext.(*pgTransaction.TransactionContext))
  297 + if err != nil {
  298 + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  299 + }
  300 + version, err := prdMoDao.GetLastVersion()
  301 + if err != nil {
  302 + return application.ThrowError(application.BUSINESS_ERROR, err.Error())
  303 + }
  304 + if err = transactionContext.CommitTransaction(); err != nil {
  305 + return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  306 + }
  307 + var timeFilter time.Time
  308 + if version > 0 {
  309 + timeFilter = time.Unix(version, 0)
  310 + }
  311 + err = srv.PullPrdMo(timeFilter)
  312 + if err != nil {
  313 + return err
  314 + }
  315 + return err
  316 +}
  317 +
  318 +//PullPrdMo 拉取生产订单数据
  319 +func (srv *PullDataK3CloudService) PullPrdMo(timeFilter time.Time) error {
  320 + //拉取数据
  321 + var filterString []string
  322 + if !timeFilter.IsZero() {
  323 + str := timeFilter.Format("2006-01-02T15:04:05")
  324 + filterString = append(filterString, "FModifyDate>='"+str+"'")
  325 + }
  326 + client, err := newK3cloudClient()
  327 + if err != nil {
  328 + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  329 + }
  330 + fieldKeys := []string{
  331 + "FID", "FBillNo", "FWorkShopID", "FWorkShopID.FName", "FMaterialId", "FMaterialId.FName",
  332 + "FMaterialId.FNumber", "FPlanStartDate", "FPlanFinishDate", "FDate", "FQty",
  333 + "FCreateDate", "FModifyDate", "FPrdOrgId", "FPrdOrgId.FName",
  334 + }
  335 + var (
  336 + startRow int
  337 + allResult []map[string]string
  338 + queryErr error
  339 + )
  340 + for {
  341 + result, err := client.ExecuteBillQuery(k3cloud.RequestExecuteBillQuery{
  342 + FormId: "PRD_MO",
  343 + Data: k3cloud.ExecuteBillQueryData{
  344 + FormId: "PRD_MO",
  345 + FieldKeys: strings.Join(fieldKeys, ","), //查询的字段
  346 + StartRow: startRow,
  347 + Limit: 1000,
  348 + FilterString: strings.Join(filterString, " and "),
  349 + },
  350 + })
  351 + if err != nil {
  352 + queryErr = err
  353 + break
  354 + }
  355 + mp := result.ToMapString()
  356 + if len(mp) == 0 {
  357 + break
  358 + }
  359 + allResult = append(allResult, mp...)
  360 + startRow += 1000
  361 + }
  362 + if queryErr != nil {
  363 + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  364 + }
  365 + var (
  366 + prdMoModels []models.PrdMoK3cloud
  367 + prdMoTemp models.PrdMoK3cloud
  368 + )
  369 + nowTime := time.Now()
  370 + for _, item := range allResult {
  371 + id, err := strconv.Atoi(item["FID"])
  372 + if err != nil {
  373 + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  374 + }
  375 + workShopID, _ := strconv.Atoi(item["WorkShopID"])
  376 + materialId, _ := strconv.Atoi(item["MaterialId"])
  377 + qty, _ := strconv.ParseFloat(item["Qty"], 64)
  378 + fPrdOrgId, _ := strconv.Atoi(item["FPrdOrgId"])
  379 + planStartDate, _ := time.Parse("2006-01-02T15:04:05", item["FPlanStartDate"])
  380 + planFinishDate, _ := time.Parse("2006-01-02T15:04:05", item["FPlanFinishDate"])
  381 + fDate, _ := time.Parse("2006-01-02T15:04:05", item["FDate"])
  382 + fCreateDate, _ := time.Parse("2006-01-02T15:04:05.999", item["FCreateDate"])
  383 + fModifyDate, _ := time.Parse("2006-01-02T15:04:05.999", item["FModifyDate"])
  384 + prdMoTemp = models.PrdMoK3cloud{
  385 + Id: id,
  386 + WorkShopID: workShopID,
  387 + MaterialId: materialId,
  388 + Qty: qty,
  389 + PlanStartDate: planStartDate,
  390 + PlanFinishDate: planFinishDate,
  391 + FDate: fDate,
  392 + CreateDate: fCreateDate,
  393 + ModifyDate: fModifyDate,
  394 + BillNo: item["FBillNo"],
  395 + WorkShopName: item["FWorkShopID.FName"],
  396 + MaterialName: item["FMaterialId.FName"],
  397 + MaterialNumber: item["FMaterialId.FNumber"],
  398 + DataVersion: nowTime.Unix(),
  399 + PrdOrgId: fPrdOrgId,
  400 + PrdOrgName: item["FPrdOrgId.FName"],
  401 + }
  402 + prdMoModels = append(prdMoModels, prdMoTemp)
  403 + }
  404 + var (
  405 + prdMoDao *dao.PrdMoK3cloudDao
  406 + )
  407 + transactionContext, err := factory.CreateTransactionContext(nil)
  408 + if err != nil {
  409 + return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  410 + }
  411 + if err := transactionContext.StartTransaction(); err != nil {
  412 + return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  413 + }
  414 + defer func() {
  415 + transactionContext.RollbackTransaction()
  416 + }()
  417 + prdMoDao, err = dao.NewPrdMoK3cloudDao(transactionContext.(*pgTransaction.TransactionContext))
  418 + if err != nil {
  419 + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  420 + }
  421 + //同步PrdMoK3cloud表数据
  422 + err = prdMoDao.SyncDataPrdMoK3cloud(prdMoModels)
  423 + if err != nil {
  424 + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  425 + }
  426 +
  427 + if err = transactionContext.CommitTransaction(); err != nil {
  428 + return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  429 + }
  430 + return nil
  431 +}
@@ -25,30 +25,6 @@ func NewMaterialK3cloudDao(transactionContext *pgTransaction.TransactionContext) @@ -25,30 +25,6 @@ func NewMaterialK3cloudDao(transactionContext *pgTransaction.TransactionContext)
25 25
26 //SyncDataMaterialK3cloud 同步MaterialK3cloud表数据 26 //SyncDataMaterialK3cloud 同步MaterialK3cloud表数据
27 func (d *MaterialK3cloudDao) SyncDataMaterialK3cloud(data []models.MaterialK3cloud) error { 27 func (d *MaterialK3cloudDao) SyncDataMaterialK3cloud(data []models.MaterialK3cloud) error {
28 - // -- 插入或者更新  
29 - // INSERT INTO "manufacture"."material_k3cloud" (  
30 - // "material_id","name","number","specification","forbid_status",  
31 - // "erp_cls_id","base_unit_id","base_unit_name","create_date",  
32 - // "modify_date","forbid_date","approve_date","material_group",  
33 - // "material_group_number","material_group_name","ref_status ",  
34 - // "join_product_id","data_version" )  
35 - // VALUES  
36 - // (  
37 - // '1',2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,  
38 - // NULL,NULL,NULL,NULL,nextval( 'manufacture.manufacture_seq_id_seq' ),NULL  
39 - // ) ON conflict ( material_id ) DO  
40 - // UPDATE  
41 - // SET (  
42 - // "name","number","specification","forbid_status","erp_cls_id",  
43 - // "base_unit_id","base_unit_name","create_date","modify_date",  
44 - // "forbid_date","approve_date","material_group","material_group_number",  
45 - // "material_group_name","ref_status ","data_version" ) = (  
46 - // EXCLUDED."name",EXCLUDED."number",EXCLUDED."specification",  
47 - // EXCLUDED."forbid_status",EXCLUDED."erp_cls_id",EXCLUDED."base_unit_id",  
48 - // EXCLUDED."base_unit_name",EXCLUDED."create_date",EXCLUDED."modify_date",  
49 - // EXCLUDED."forbid_date",EXCLUDED."approve_date",EXCLUDED."material_group",  
50 - // EXCLUDED."material_group_number",EXCLUDED."material_group_name",  
51 - // EXCLUDED."ref_status ",EXCLUDED."data_version" )  
52 sqlValues := []string{} 28 sqlValues := []string{}
53 var strTemp []string 29 var strTemp []string
54 for i := range data { 30 for i := range data {
  1 +package dao
  2 +
  3 +import (
  4 + "fmt"
  5 + "strconv"
  6 + "strings"
  7 +
  8 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
  10 +)
  11 +
  12 +//
  13 +type PrdMoK3cloudDao struct {
  14 + transactionContext *pgTransaction.TransactionContext
  15 +}
  16 +
  17 +func NewPrdMoK3cloudDao(transactionContext *pgTransaction.TransactionContext) (*PrdMoK3cloudDao, error) {
  18 + if transactionContext == nil {
  19 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  20 + } else {
  21 + return &PrdMoK3cloudDao{
  22 + transactionContext: transactionContext,
  23 + }, nil
  24 + }
  25 +}
  26 +
  27 +//SyncDataPrdMoK3cloud 同步PrdMoK3cloud表数据
  28 +func (d *PrdMoK3cloudDao) SyncDataPrdMoK3cloud(data []models.PrdMoK3cloud) error {
  29 + //插入或者更新
  30 + sqlValues := []string{}
  31 + var strTemp []string
  32 + for i := range data {
  33 + strTemp = make([]string, 0, 5)
  34 + strTemp = append(strTemp, strconv.Itoa(data[i].Id))
  35 + strTemp = append(strTemp, `'`+data[i].BillNo+`'`)
  36 + strTemp = append(strTemp, strconv.Itoa(data[i].WorkShopID))
  37 + strTemp = append(strTemp, `'`+data[i].WorkShopName+`'`)
  38 + strTemp = append(strTemp, strconv.Itoa(data[i].MaterialId))
  39 + strTemp = append(strTemp, `'`+data[i].MaterialName+`'`)
  40 + strTemp = append(strTemp, `'`+data[i].MaterialNumber+`'`)
  41 + strTemp = append(strTemp, `'`+data[i].PlanStartDate.Format("2006-01-02 15:04:05.999")+`'`)
  42 + strTemp = append(strTemp, `'`+data[i].PlanFinishDate.Format("2006-01-02 15:04:05.999")+`'`)
  43 + strTemp = append(strTemp, `'`+data[i].FDate.Format("2006-01-02 15:04:05.999")+`'`)
  44 + strTemp = append(strTemp, fmt.Sprintf("%.10f", data[i].Qty)) //15.5000000000
  45 + strTemp = append(strTemp, `'`+data[i].CreateDate.Format("2006-01-02 15:04:05.999")+`'`)
  46 + strTemp = append(strTemp, `'`+data[i].ModifyDate.Format("2006-01-02 15:04:05.999")+`'`)
  47 + strTemp = append(strTemp, strconv.Itoa(int(data[i].DataVersion)))
  48 + sqlValues = append(sqlValues, "("+strings.Join(strTemp, ",")+")")
  49 + }
  50 + var valueTemp []string
  51 + for i := 0; i < len(sqlValues); i += 100 {
  52 + if i <= len(sqlValues)-100 {
  53 + valueTemp = sqlValues[i : i+100]
  54 + } else {
  55 + valueTemp = sqlValues[i:]
  56 + }
  57 + sql := `INSERT INTO "manufacture"."prd_mo_k3cloud" (
  58 + "id","bill_no","work_shop_id","work_shop_name",
  59 + "material_id","material_name","material_number",
  60 + "plan_start_date","plan_finish_date","f_date",
  61 + "qty","create_date","modify_date","data_version" )
  62 + VALUES ` +
  63 + strings.Join(valueTemp, ",") +
  64 + ` ON conflict ( "id" ) DO
  65 + UPDATE
  66 + SET (
  67 + "bill_no","work_shop_id","work_shop_name",
  68 + "material_id","material_name","material_number",
  69 + "plan_start_date","plan_finish_date","f_date",
  70 + "qty","create_date","modify_date","data_version") = (
  71 + EXCLUDED."bill_no",EXCLUDED."work_shop_id",
  72 + EXCLUDED."work_shop_name",EXCLUDED."material_id",
  73 + EXCLUDED."material_name",EXCLUDED."material_number",
  74 + EXCLUDED."plan_start_date",EXCLUDED."plan_finish_date",
  75 + EXCLUDED."f_date",EXCLUDED."qty",EXCLUDED."create_date",
  76 + EXCLUDED."modify_date",EXCLUDED."data_version"
  77 + )`
  78 + _, err := d.transactionContext.PgTx.Exec(sql)
  79 + if err != nil {
  80 + return err
  81 + }
  82 + }
  83 +
  84 + return nil
  85 +}
  86 +
  87 +func (d *PrdMoK3cloudDao) GetLastVersion() (int64, error) {
  88 + var prdMoData []models.PrdMoK3cloud
  89 + err := d.transactionContext.PgTx.Model(&prdMoData).
  90 + Order("data_version DESC").
  91 + Limit(1).
  92 + Select()
  93 + if err != nil {
  94 + return 0, err
  95 + }
  96 + if len(prdMoData) == 0 {
  97 + return 0, nil
  98 + }
  99 + return prdMoData[0].DataVersion, nil
  100 +}
@@ -38,6 +38,7 @@ func init() { @@ -38,6 +38,7 @@ func init() {
38 (*models.Workshop)(nil), 38 (*models.Workshop)(nil),
39 (*models.MaterialK3cloud)(nil), 39 (*models.MaterialK3cloud)(nil),
40 (*models.MaterialGroupK3cloud)(nil), 40 (*models.MaterialGroupK3cloud)(nil),
  41 + (*models.PrdMoK3cloud)(nil),
41 } { 42 } {
42 err := DB.Model(model).CreateTable(&orm.CreateTableOptions{ 43 err := DB.Model(model).CreateTable(&orm.CreateTableOptions{
43 Temp: false, 44 Temp: false,
@@ -13,10 +13,10 @@ type MaterialK3cloud struct { @@ -13,10 +13,10 @@ type MaterialK3cloud struct {
13 ErpClsId int `comment:"物料属性" pg:"erp_cls_id"` 13 ErpClsId int `comment:"物料属性" pg:"erp_cls_id"`
14 BaseUnitId int `comment:"基本单位" pg:"base_unit_id"` 14 BaseUnitId int `comment:"基本单位" pg:"base_unit_id"`
15 BaseUnitName string `comment:"基本单位名称" pg:"base_unit_name"` 15 BaseUnitName string `comment:"基本单位名称" pg:"base_unit_name"`
16 - CreateDate time.Time `comment:"创建时间" pg:"create_date,type:timestamp"`  
17 - ModifyDate time.Time `comment:"修改时间" pg:"modify_date,type:timestamp"`  
18 - ForbidDate time.Time `comment:"禁用时间" pg:"forbid_date,type:timestamp"`  
19 - ApproveDate time.Time `comment:"审核时间" pg:"approve_date,type:timestamp"` 16 + CreateDate time.Time `comment:"创建时间" pg:"create_date"`
  17 + ModifyDate time.Time `comment:"修改时间" pg:"modify_date"`
  18 + ForbidDate time.Time `comment:"禁用时间" pg:"forbid_date"`
  19 + ApproveDate time.Time `comment:"审核时间" pg:"approve_date"`
20 MaterialGroup int `comment:"物料分组" pg:"material_group"` 20 MaterialGroup int `comment:"物料分组" pg:"material_group"`
21 MaterialGroupNumber string `comment:"物料分组编码" pg:"material_group_number"` 21 MaterialGroupNumber string `comment:"物料分组编码" pg:"material_group_number"`
22 MaterialGroupName string `comment:"物料分组名称" pg:"material_group_name"` 22 MaterialGroupName string `comment:"物料分组名称" pg:"material_group_name"`
  1 +package models
  2 +
  3 +import "time"
  4 +
  5 +//计划订单
  6 +//PrdMoK3cloud ..
  7 +type PrdMoK3cloud struct {
  8 + tableName string `comment:"采集自金蝶k3cloud计划订单" pg:"manufacture.prd_mo_k3cloud,alias:prd_mo_k3cloud"`
  9 + Id int `pg:",pk"`
  10 + BillNo string `comment:"订单编号" pg:"bill_no"`
  11 + WorkShopID int `comment:"生产车间" pg:"work_shop_id"`
  12 + WorkShopName string `comment:"生产车间名称" pg:"work_shop_name"`
  13 + MaterialId int `comment:"物料" pg:"material_id"`
  14 + MaterialName string `comment:"物料名称" pg:"material_name"`
  15 + MaterialNumber string `comment:"物料名称" pg:"material_number"`
  16 + PlanStartDate time.Time `comment:"计划开工时间" pg:"plan_start_date"`
  17 + PlanFinishDate time.Time `comment:"计划完工时间" pg:"plan_finish_date"`
  18 + FDate time.Time `comment:"单据日期" pg:"f_date"`
  19 + Qty float64 `comment:"数量" pg:"qty"`
  20 + CreateDate time.Time `comment:"创建时间" pg:"create_date"`
  21 + ModifyDate time.Time `comment:"修改时间" pg:"modify_date"`
  22 + DataVersion int64 `comment:"数据版本" pg:"data_version"`
  23 + PrdOrgId int `comment:"生产组织" pg:"data_version"`
  24 + PrdOrgName string `comment:"生产组织名称" pg:"data_version"`
  25 +}
@@ -56,5 +56,31 @@ func TestExecuteBillQuery(t *testing.T) { @@ -56,5 +56,31 @@ func TestExecuteBillQuery(t *testing.T) {
56 t.Error(err) 56 t.Error(err)
57 return 57 return
58 } 58 }
59 - // t.Logf("tomap===>%v \n", result.ToMapString()) 59 +}
  60 +
  61 +func TestExecuteBillQuery2(t *testing.T) {
  62 + client, err := NewClient(hostUrl, acctID, username, password)
  63 + if err != nil {
  64 + t.Error(err)
  65 + return
  66 + }
  67 + fieldKeys := []string{
  68 + "FID", "FBillNo", "FWorkShopID", "FWorkShopID.FName", "FMaterialId", "FMaterialId.FName",
  69 + "FMaterialId.FNumber", "FPlanStartDate", "FPlanFinishDate", "FDate", "FQty",
  70 + "FCreateDate", "FModifyDate", "FPrdOrgId", "FPrdOrgId.FName",
  71 + }
  72 + result, err := client.ExecuteBillQuery(RequestExecuteBillQuery{
  73 + FormId: "PRD_MO",
  74 + Data: ExecuteBillQueryData{
  75 + FormId: "PRD_MO",
  76 + FieldKeys: strings.Join(fieldKeys, ","), //查询的字段
  77 + TopRowCount: 2,
  78 + FilterString: "",
  79 + },
  80 + })
  81 + t.Logf("result buf===> %s \n", string(result.Buf))
  82 + if err != nil {
  83 + t.Error(err)
  84 + return
  85 + }
60 } 86 }
@@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
14 | :---------------- | --------------------------- | ---- | 14 | :---------------- | --------------------------- | ---- |
15 | BD_MATERIAL | 基础管理-基础资料-物料 | | 15 | BD_MATERIAL | 基础管理-基础资料-物料 | |
16 | SAL_MATERIALGROUP | 基础管理-基础资料-物料-分组 | | 16 | SAL_MATERIALGROUP | 基础管理-基础资料-物料-分组 | |
  17 +| PRD_MO | 生产制造-生产订单 | |
17 | | | | 18 | | | |
18 19
19 ## 物料字段描述(部分) 20 ## 物料字段描述(部分)
@@ -46,4 +47,20 @@ @@ -46,4 +47,20 @@
46 | FNumber | 分组编码 | 字符串 | 47 | FNumber | 分组编码 | 字符串 |
47 | FName | 分组名称 | 字符串 | 48 | FName | 分组名称 | 字符串 |
48 | FParentId | 上级分组 | 字符串 | 49 | FParentId | 上级分组 | 字符串 |
49 -| | | | 50 +
  51 +### 生产订单字段描述(部分)
  52 +
  53 +| 字段名 | 备注 | 类型 |
  54 +| ------------------- | ------------------------------------- | ------ |
  55 +| FBillNo | 订单编号 | 字符串 |
  56 +| FWorkShopID | 生产车间 | 数字 |
  57 +| FWorkShopID.FName | 生产车间 | 字符串 |
  58 +| FMaterialId | 物料 | 数字 |
  59 +| FPlanStartDate | 计划开工时间,如"2021-12-20T00:00:00" | 字符串 |
  60 +| FPlanFinishDate | 计划完工时间,如"2021-12-20T00:00:00" | 字符串 |
  61 +| FMaterialId.FName | 物料名称 | 字符串 |
  62 +| FMaterialId.FNumber | 物料编码 | 字符串 |
  63 +| FDate | 单据日期,如"2021-12-20T00:00:00" | 字符串 |
  64 +| FQty | 数量,如 15.5000000000 | 小数 |
  65 +| FID | id | 数字 |
  66 +| FPrdOrgId | 生产组织 | 数字 |
@@ -20,3 +20,9 @@ func (c *TestController) InvokPullMaterialGroup() { @@ -20,3 +20,9 @@ func (c *TestController) InvokPullMaterialGroup() {
20 err := srv.PullMaterialGroup() 20 err := srv.PullMaterialGroup()
21 c.Response(nil, err) 21 c.Response(nil, err)
22 } 22 }
  23 +
  24 +func (c *TestController) InvokPullPrdMoNewest() {
  25 + srv := syncdata.PullDataK3CloudService{}
  26 + err := srv.PullPrdMoNewest()
  27 + c.Response(nil, err)
  28 +}
@@ -8,4 +8,5 @@ import ( @@ -8,4 +8,5 @@ import (
8 func init() { 8 func init() {
9 web.Router("/TestController/PullMaterialNewest", &controllers.TestController{}, "Get:InvokPullMaterialNewest") 9 web.Router("/TestController/PullMaterialNewest", &controllers.TestController{}, "Get:InvokPullMaterialNewest")
10 web.Router("/TestController/PullMaterialGroup", &controllers.TestController{}, "Get:InvokPullMaterialGroup") 10 web.Router("/TestController/PullMaterialGroup", &controllers.TestController{}, "Get:InvokPullMaterialGroup")
  11 + web.Router("/TestController/InvokPullPrdMoNewest", &controllers.TestController{}, "Get:InvokPullPrdMoNewest")
11 } 12 }