作者 tangxuhui

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

... ... @@ -114,7 +114,7 @@ func (d *MaterialK3cloudDao) SyncDataProudct(version int64) error {
)
SELECT 0,use_org_id,"join_product_id","number","name","material_group_name",
json_build_object('unit',specification),now(),now()
FROM "manufacture"."material_k3cloud" WHERE "data_version"=? AND "material_group_number" LIKE '05%'
FROM "manufacture"."material_k3cloud" WHERE "data_version">=? AND "material_group_number" LIKE '05%'
ON conflict ( product_id ) DO
UPDATE
SET (
... ...
... ... @@ -124,15 +124,15 @@ func (d *PrdMoK3cloudDao) SyncDataProductPlan(version int64) error {
)
SELECT prd_mo_k3cloud."join_product_plan_id",prd_mo_k3cloud."bill_no",
prd_mo_k3cloud."plan_start_date",
json_build_object('workshopId',"workshop"."workshop_id",'workshopName',prd_mo_k3cloud."work_shop_name"),
json_build_object('workshopId',COALESCE("workshop"."workshop_id",0),'workshopName',prd_mo_k3cloud."work_shop_name"),
prd_mo_k3cloud."material_name", json_build_object('unit',prd_mo_k3cloud."unit_name",'quantity',prd_mo_k3cloud."qty"),
2,prd_mo_k3cloud."description",
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")),
now(),now()
FROM "manufacture"."prd_mo_k3cloud"
LEFT JOIN "material_k3cloud" ON "prd_mo_k3cloud"."material_number"="material_k3cloud"."number"
LEFT JOIN "workshop" ON "workshop"."workshop_name" = "prd_mo_k3cloud"."work_shop_name"
WHERE prd_mo_k3cloud."data_version"=?
LEFT JOIN "manufacture"."material_k3cloud" ON "prd_mo_k3cloud"."material_id"="material_k3cloud"."material_id"
LEFT JOIN "manufacture"."workshop" ON "workshop"."workshop_name" = "prd_mo_k3cloud"."work_shop_name"
WHERE prd_mo_k3cloud."data_version">=?
ON conflict ("product_plan_id") DO
UPDATE
SET (
... ...
... ... @@ -6,7 +6,7 @@ import (
)
func init() {
web.Router("/TestController/PullMaterialNewest", &controllers.TestController{}, "Get:InvokPullMaterialNewest")
web.Router("/TestController/PullMaterialGroup", &controllers.TestController{}, "Get:InvokPullMaterialGroup")
web.Router("/TestController/InvokPullPrdMoNewest", &controllers.TestController{}, "Get:InvokPullPrdMoNewest")
web.Router("/TestController/PullMaterialNewest", &controllers.TestController{}, "Get:InvokPullMaterialNewest") //拉取物料
web.Router("/TestController/PullMaterialGroup", &controllers.TestController{}, "Get:InvokPullMaterialGroup") //拉取物料分组
web.Router("/TestController/InvokPullPrdMoNewest", &controllers.TestController{}, "Get:InvokPullPrdMoNewest") //拉取生产订单
}
... ...