-- 安全库存预警监控方案
-- t_warn_schedule
IF NOT EXISTS (SELECT 1 FROM t_warn_schedule WHERE FID = '854807346223055872')
INSERT INTO t_warn_schedule(FMODIFYDATE,FTYPE,FEARLYWARNID,FISV,FDATA,FINHERITPATH,FMASTERID,FMONITORFREQUENCY,FPLANID,FMONITORRANGE,FENABLE,FJOBID,FMODELTYPE,FID,FVERSION,FISTEMPLATE,FSTARTDATE,FCREATEDATE,FLASTSYNCTIME,FPARENTID,FNUMBER,FPLANNUMBER,FMODIFIERID,FBIZAPPID,FENDDATE,FCREATORID) VALUES ({ts'2020-03-25  10:44:47'},'0','854360866437464064','kingdee',
'<?xml version="1.0" encoding="UTF-8"?>
<WarnScheduleMetadata>
  <DevType>0</DevType>
  <WarnSchedule>
    <WarnSchedule>
      <LastSyncTime>1585104287000</LastSyncTime>
      <RunCycle>
        <RunCycle>
          <RangeType>from_start_date</RangeType>
          <EndDate>2020-03-25</EndDate>
          <Description>从2020-03-25开始，每天 00:00:00执行</Description>
          <PeriodType>day</PeriodType>
          <StartDate>2020-03-25</StartDate>
        </RunCycle>
      </RunCycle>
      <WarnCondition>
        <WarnCondition>
          <CustomDataJson>{"customFilterString":""}</CustomDataJson>
        </WarnCondition>
      </WarnCondition>
      <BizAppId>=9Q86DR2P+Q</BizAppId>
      <JobId>854807844615322624</JobId>
      <Number>IM_SAFETYINVWARN_SKDJ_S</Number>
      <MessageConfig>
        <WarnMessageConfig>
          <MergeContent></MergeContent>
          <Title>物料安全库存预警消息</Title>
          <SendTypes>
            <WarnMessageSendType>
              <Name>消息中心</Name>
              <Value>message_center</Value>
            </WarnMessageSendType>
          </SendTypes>
          <SingleContent>库存组织[{org.name}]中的物料[{material.number}/{material.name}]现有库存基本数量为[{avbbaseqty}]，小于安全库存量[{warnqty}]。</SingleContent>
        </WarnMessageConfig>
      </MessageConfig>
      <Name>安全库存预警</Name>
      <PlanId>854835117439648768</PlanId>
      <Id>854807346223055872</Id>
      <EarlyWarnId>854360866437464064</EarlyWarnId>
    </WarnSchedule>
  </WarnSchedule>
  <ModelType>WarnScheduleModel</ModelType>
  <Isv>kingdee</Isv>
  <ParentId></ParentId>
  <MasterId>854807346223055872</MasterId>
  <Number>IM_SAFETYINVWARN_EW_S</Number>
  <BizappId>=9Q86DR2P+Q</BizappId>
  <Id>854807346223055872</Id>
  <InheritPath>854807346223055872</InheritPath>
</WarnScheduleMetadata>','854807346223055872','854807346223055872','每天-00:00:00','854835117439648768','从2020-03-25开始','0','854807844615322624','WarnScheduleModel','854807346223055872',1585104287060,'0',{ts'2020-03-25  00:00:00'},{ts'2020-03-25  09:50:35'},{ts'2020-03-25  10:44:47'},' ','IM_SAFETYINVWARN_EW_S',' ',853353486505814016,'=9Q86DR2P+Q',{ts'2020-03-25  00:00:00'},853353486505814016); 


-- 安全库存预警监控方案多语言
-- t_warn_schedule_l
IF NOT EXISTS (SELECT 1 FROM t_warn_schedule_l WHERE FPKID = '0O+E8VQX3PZ4')
INSERT INTO t_warn_schedule_l(FID,FPKID,FLOCALEID,FDATA,FNAME) VALUES ('854807346223055872','0O+E8VQX3PZ4','en_US','<?xml version="1.0" encoding="UTF-8"?>

<WarnScheduleMetadata/>
',' '); 
IF NOT EXISTS (SELECT 1 FROM t_warn_schedule_l WHERE FPKID = '0O+E8VQTH=RM')
INSERT INTO t_warn_schedule_l(FID,FPKID,FLOCALEID,FDATA,FNAME) VALUES ('854807346223055872','0O+E8VQTH=RM','zh_CN','<?xml version="1.0" encoding="UTF-8"?>

<WarnScheduleMetadata/>
','安全库存预警'); 
IF NOT EXISTS (SELECT 1 FROM t_warn_schedule_l WHERE FPKID = '0O+E8VQTFHQZ')
INSERT INTO t_warn_schedule_l(FID,FPKID,FLOCALEID,FDATA,FNAME) VALUES ('854807346223055872','0O+E8VQTFHQZ','zh_TW','<?xml version="1.0" encoding="UTF-8"?>

<WarnScheduleMetadata>
  <WarnSchedule>
    <WarnSchedule>
      <Name>安全庫存預警</Name>
    </WarnSchedule>
  </WarnSchedule>
</WarnScheduleMetadata>
','安全庫存預警'); 


-- 调度作业  t_sch_job
IF NOT EXISTS (SELECT 1 FROM t_sch_job WHERE FID = '854807844615322624')
INSERT INTO t_sch_job(FID,FTASKCLASSNAME,FTASKDEFINEID,FRUNBYUSERID,FJOBTYPE,FTIMEOUT,FRUNBYLANG,FSTATUS,FPARAMS,FRUNBYORGID,FNUMBER,FCONCURRENT) VALUES ('854807844615322624','kd.bos.service.earlywarn.EarlyWarnScheduleTask','854835117036889088',1,'BIZ',0,'zh-CN','0','{"warnScheduleId":"854807346223055872"}',0,'IM_SAFETYINVWARN_SKDJ_S','1'); 

-- 调度作业多语言  t_sch_job_l
IF NOT EXISTS (SELECT 1 FROM t_sch_job_l WHERE FPKID = '0O+E8VJ+XEKJ')
INSERT INTO t_sch_job_l(FID,FPKID,FLOCALEID,FNAME) VALUES ('854807844615322624','0O+E8VJ+XEKJ','zh_CN','安全库存预警'); 

-- 调度计划  t_sch_schedule
IF NOT EXISTS (SELECT 1 FROM t_sch_schedule WHERE FID = '854835117439648768')
INSERT INTO t_sch_schedule(FTWENTY,FFIVE,FELEVEN,FNINE,FNO,FSUN,FTWO,FEIGHT,FNOV,FPLAN,FWED,FHOST,FTWENTYTWO,FFOUR,FMAR,FSEP,FENDTIME,FSIX,FMAY,FREPEATMODE,FTHIRTYONE,FBYDAYORWEEK,FTWENTYSEVEN,FTWENTYSIX,FTHIRTEEN,FAUG,FDESC,FFIFTEEN,FTWENTYONE,FBYWEEK,FTUES,FSEVENTEEN,FSEVEN,FTWENTYFOUR,FMON,FTHIRTY,FTHREE,FFOURTEEN,FJAN,FNINETEEN,FTHUR,FTEN,FFRI,FJOBID,FSTARTTIME,FOCT,FAPR,FSIXTEEN,FID,FSAT,FONE,FTWENTYEIGHT,FTWENTYTHREE,FTWELVE,FNOWEEK,FSTATUS,FNUMBER,FTWENTYFIVE,FEIGHTEEN,FCYCLENUM,FTWENTYNINE,FJUL,FDEC,FJUN,FFEB) VALUES ('0','0','0','0',null,'0','0','0','0','0 0 0 ? * * *','0','172.19.90.143','0','0','0','0',{ts'2120-03-25  00:00:00'},'0','0','d','0',null,'0','0','0','0','事件将每1天重复','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','854807844615322624',{ts'2020-03-25  00:00:00'},'0','0','0','854835117439648768','0','0','0','0','0',null,'0','IM_SAFETYINVWARN_SKDP_S','0','0',1,'0','0','0','0','0'); 

-- 调度计划多语言  t_sch_schedule_l
IF NOT EXISTS (SELECT 1 FROM t_sch_schedule_l WHERE FPKID = '854835117598925824')
INSERT INTO t_sch_schedule_l(FID,FPKID,FLOCALEID,FNAME) VALUES ('854835117439648768','854835117598925824','zh_CN','安全库存预警'); 

-- 调度任务  t_sch_taskdefine
IF NOT EXISTS (SELECT 1 FROM T_SCH_TASKDEFINE WHERE FID = '854807844615322625')
INSERT INTO T_SCH_TASKDEFINE(FID,FCLASSNAME,FAPPID,FNUMBER) VALUES ('854807844615322625','kd.bos.service.earlywarn.EarlyWarnScheduleTask','im','IM_SAFETYINVWARN_SKDP_S'); 
