作者 tangxuhui

修正 数据同步的sql语句错误

@@ -114,7 +114,7 @@ func (d *MaterialK3cloudDao) SyncDataProudct(version int64) error { @@ -114,7 +114,7 @@ func (d *MaterialK3cloudDao) SyncDataProudct(version int64) error {
114 ) 114 )
115 SELECT 0,use_org_id,"join_product_id","number","name","material_group_name", 115 SELECT 0,use_org_id,"join_product_id","number","name","material_group_name",
116 json_build_object('unit',specification),now(),now() 116 json_build_object('unit',specification),now(),now()
117 - FROM "manufacture"."material_k3cloud" WHERE "data_version"=? AND "material_group_number" LIKE '05%' 117 + FROM "manufacture"."material_k3cloud" WHERE "data_version">=? AND "material_group_number" LIKE '05%'
118 ON conflict ( product_id ) DO 118 ON conflict ( product_id ) DO
119 UPDATE 119 UPDATE
120 SET ( 120 SET (
@@ -124,15 +124,15 @@ func (d *PrdMoK3cloudDao) SyncDataProductPlan(version int64) error { @@ -124,15 +124,15 @@ func (d *PrdMoK3cloudDao) SyncDataProductPlan(version int64) error {
124 ) 124 )
125 SELECT prd_mo_k3cloud."join_product_plan_id",prd_mo_k3cloud."bill_no", 125 SELECT prd_mo_k3cloud."join_product_plan_id",prd_mo_k3cloud."bill_no",
126 prd_mo_k3cloud."plan_start_date", 126 prd_mo_k3cloud."plan_start_date",
127 - json_build_object('workshopId',"workshop"."workshop_id",'workshopName',prd_mo_k3cloud."work_shop_name"), 127 + json_build_object('workshopId',COALESCE("workshop"."workshop_id",0),'workshopName',prd_mo_k3cloud."work_shop_name"),
128 prd_mo_k3cloud."material_name", json_build_object('unit',prd_mo_k3cloud."unit_name",'quantity',prd_mo_k3cloud."qty"), 128 prd_mo_k3cloud."material_name", json_build_object('unit',prd_mo_k3cloud."unit_name",'quantity',prd_mo_k3cloud."qty"),
129 2,prd_mo_k3cloud."description", 129 2,prd_mo_k3cloud."description",
130 json_build_object('productPlanExt',json_build_object('productId',prd_mo_k3cloud."join_product_plan_id",'productCode',prd_mo_k3cloud."material_number",'productName',prd_mo_k3cloud."material_name")), 130 json_build_object('productPlanExt',json_build_object('productId',prd_mo_k3cloud."join_product_plan_id",'productCode',prd_mo_k3cloud."material_number",'productName',prd_mo_k3cloud."material_name")),
131 now(),now() 131 now(),now()
132 FROM "manufacture"."prd_mo_k3cloud" 132 FROM "manufacture"."prd_mo_k3cloud"
133 - LEFT JOIN "material_k3cloud" ON "prd_mo_k3cloud"."material_number"="material_k3cloud"."number"  
134 - LEFT JOIN "workshop" ON "workshop"."workshop_name" = "prd_mo_k3cloud"."work_shop_name"  
135 - WHERE prd_mo_k3cloud."data_version"=? 133 + LEFT JOIN "manufacture"."material_k3cloud" ON "prd_mo_k3cloud"."material_id"="material_k3cloud"."material_id"
  134 + LEFT JOIN "manufacture"."workshop" ON "workshop"."workshop_name" = "prd_mo_k3cloud"."work_shop_name"
  135 + WHERE prd_mo_k3cloud."data_version">=?
136 ON conflict ("product_plan_id") DO 136 ON conflict ("product_plan_id") DO
137 UPDATE 137 UPDATE
138 SET ( 138 SET (
@@ -6,7 +6,7 @@ import ( @@ -6,7 +6,7 @@ import (
6 ) 6 )
7 7
8 func init() { 8 func init() {
9 - web.Router("/TestController/PullMaterialNewest", &controllers.TestController{}, "Get:InvokPullMaterialNewest")  
10 - web.Router("/TestController/PullMaterialGroup", &controllers.TestController{}, "Get:InvokPullMaterialGroup")  
11 - web.Router("/TestController/InvokPullPrdMoNewest", &controllers.TestController{}, "Get:InvokPullPrdMoNewest") 9 + web.Router("/TestController/PullMaterialNewest", &controllers.TestController{}, "Get:InvokPullMaterialNewest") //拉取物料
  10 + web.Router("/TestController/PullMaterialGroup", &controllers.TestController{}, "Get:InvokPullMaterialGroup") //拉取物料分组
  11 + web.Router("/TestController/InvokPullPrdMoNewest", &controllers.TestController{}, "Get:InvokPullPrdMoNewest") //拉取生产订单
12 } 12 }