insert into eam_properties_item_available (ItemNo,ValueNo,AvailableValue,CreatedDate,CreatedBy,ItemType) values(#{itemNo},#{valueNo},#{availableValue},GetDate(),#{createdBy},#{itemType}) update eam_properties_item_available set AvailableValue=#{availableValue} where itemNo=#{itemNo} and ItemType=#{itemType} and ValueNo=#{valueNo} delete from eam_properties_item_available where itemNo=#{itemNo} and ItemType=#{itemType} and ValueNo=#{valueNo} insert into eam_properties_model_header (function_type,code_no,code_desc,active,created_date,created_by,delflag,version) values(#{functionType},#{codeNo},#{codeDesc},#{active},GetDate(),#{userId},'N',0) update eam_properties_model_header set version=version+1,code_desc=#{codeDesc},active=#{active},created_by=#{userId},created_date=GetDate() where function_type=#{functionType} and code_no=#{codeNo} delete from eam_properties_model_header where function_type=#{functionType} and code_no=#{codeNo} insert into eam_properties_model_detail (function_type,code_no,properties_item_no,seq_no,created_date,created_by,delflag,version) values(#{functionType},#{codeNo},#{itemNo},#{seqNo},GetDate(),#{userId},'N',0) delete from eam_properties_model_detail where function_type=#{functionType} and code_no=#{codeNo} and properties_item_no=#{itemNo} update eam_workPlan_item set DefaultValue=#{defaultValue},ValueType=#{valueType},ValueType_DB=#{valueTypeDb} ,ValueChooseFlag=#{valueChooseFlag},UpdateDate=GetDate(),UpdateBy=#{createdBy},MaxValue=#{maxValue,jdbcType=FLOAT},MinValue=#{minValue,jdbcType=FLOAT}, ItemRemark=#{itemRemark} where site=#{site} and planID=#{planID} and ItemType=#{itemType} and ItemNo=#{itemNo} update eam_workPlan_item set DefaultValue=#{defaultValue},ValueType=#{valueType},ValueType_DB=#{valueTypeDb} ,ValueChooseFlag=#{valueChooseFlag},UpdateDate=GetDate(),UpdateBy=#{createdBy},MaxValue=null,MinValue=null, ItemRemark=#{itemRemark} where site=#{site} and planID=#{planID} and ItemType=#{itemType} and ItemNo=#{itemNo} insert into eam_workPlan_item_available (Site,PlanID,ItemNo,ValueNo,AvailableValue,CreatedDate,CreatedBy,ItemType) values(#{site},#{planID},#{itemNo},#{valueNo},#{availableValue},GetDate(),#{createdBy},#{itemType}) update eam_workPlan_item_available set AvailableValue=#{availableValue},updateBy=#{createdBy},updateDate=GetDate() where itemNo=#{itemNo} and ItemType=#{itemType} and ValueNo=#{valueNo} AND site=#{site} and planID=#{planID} delete from eam_workPlan_item_available where itemNo=#{itemNo} and ItemType=#{itemType} and ValueNo=#{valueNo} AND site=#{site} and planID=#{planID} update eam_defect_feedBack set Status=#{result},FinishDate=GetDate() where Site=#{site} and FeedBackID=#{planID} update eam_workOrder set Status='已完工' ,ActualOperator=#{actualOperator},ActualDate=GetDate(),Remark=#{remark}, WorkTime=#{workTime},result=#{result,jdbcType=VARCHAR} where site=#{site} and orderNo=#{orderNo} INSERT into eam_workOrder_item (Site,OrderNo,ItemNo,ItemDesc,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,MaxValue,MinValue,ItemRemark,ItemType, TextValue,NumberValue,CreatedDate,CreatedBy,FinishFlag)values (#{site},#{orderNo},#{itemNo},#{itemDesc},#{defaultValue},#{valueType},#{valueTypeDb}, #{valueChooseFlag},#{maxValue,jdbcType=DOUBLE},#{minValue,jdbcType=DOUBLE},#{itemRemark,jdbcType=VARCHAR},#{itemType} ,#{textValue,jdbcType=VARCHAR},#{numberValue,jdbcType=DOUBLE},GetDate(),#{createdBy},#{finishFlag}) update eam_workPlan set status='已结束' where site=#{site} and PlanID=#{planID} and GetDate() > PlanEndDate update eam_workPlan set NextWorkDate=(select top 1 PlanDate from eam_workOrder where site =#{site} and PlanID=#{planID} and PlanDate>GetDate() and status='未开工' order by PlanDate) where site=#{site} and PlanID=#{planID} update eam_workOrder set Status='已取消' where site=#{site} and orderNo=#{orderNo} update eam_workPlan set Status='已计划',NextWorkDate=null where site=#{site} and PlanID=#{planID} and deleteFlag='N' update eam_workPlan set Status='已取消',NextWorkDate=null where site=#{site} and PlanID=#{planID} and deleteFlag='N' update eam_workOrder set Status='已取消' where site=#{site} and PlanID=#{planID} and status='未开工' delete from eam_workOrder_item where site=#{site} and OrderNo in (select OrderNo from eam_workOrder where site=#{site} and PlanID=#{planID} and status='未开工' and PlanDate > GetDate() - 1 ) delete from eam_workOrder where site=#{site} and PlanID=#{planID} and status='未开工' and PlanDate > GetDate() - 1 update eam_workOrder set PlanOperator=#{planOperator} where site=#{site} and orderNo=#{orderNo} INSERT Into resource_spare (resource_id,part_no,delflag,version,site) values(#{objectID},#{partNo},'',0,#{site}) delete from resource_spare where resource_id=#{objectID} and site=#{site} INSERT Into resource_spare (resource_id,part_no,delflag,version,site) select #{objectID},part_no,delflag,0,site from resource_spare where resource_id=#{oldObjectID} and site=#{site} insert into eam_object_item (site,objectID,ItemNo,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,CreatedDate,CreatedBy,MaxValue,MinValue, ItemType) values(#{site},#{objectID},#{itemNo},#{defaultValue},#{valueType},#{valueTypeDb},#{valueChooseFlag},GetDate(),#{userId},#{maxValue,jdbcType=DOUBLE},#{minValue,jdbcType=DOUBLE},#{itemType}) update eam_object_item set DefaultValue=#{defaultValue},ValueType=#{valueType},ValueType_DB=#{valueTypeDb} ,ValueChooseFlag=#{valueChooseFlag},MaxValue=#{maxValue,jdbcType=FLOAT},MinValue=#{minValue,jdbcType=FLOAT} where site=#{site} and objectID=#{objectID} and ItemType=#{itemType} and ItemNo=#{itemNo} delete from eam_object_item where site=#{site} and objectID=#{objectID} and ItemType=#{itemType} and ItemNo=#{itemNo} insert into eam_object_item_available (Site,ObjectID,ItemNo,ItemType,ValueNo,AvailableValue,CreatedDate,CreatedBy) select #{site},#{objectID},ItemNo,ItemType,ValueNo,AvailableValue,GetDate() ,#{userId} from eam_properties_item_available where ItemNo=#{itemNo} and ItemType=#{itemType} delete from eam_object_item_available where site=#{site} and objectID=#{objectID} and ItemType=#{itemType} and ItemNo=#{itemNo} insert into eam_object_item_available(Site,ObjectID,ItemNo,ItemType,ValueNo,AvailableValue,CreatedDate,CreatedBy) values(#{site},#{objectID},#{itemNo},#{itemType},#{valueNo},#{availableValue},GetDate(),#{createdBy}) update eam_object_item_available set AvailableValue=#{availableValue},updateDate=GetDate(),updateBy=#{createdBy} where site=#{site} and objectID=#{objectID} and ItemType=#{itemType} and ItemNo=#{itemNo} and ValueNo=#{valueNo} delete from eam_object_item_available where site=#{site} and objectID=#{objectID} and ItemType=#{itemType} and ItemNo=#{itemNo} and ValueNo=#{valueNo} delete from eam_object_item where site=#{site} and objectID=#{objectID} and ItemType=#{itemType} delete from eam_object_item_available where site=#{site} and objectID=#{objectID} and ItemType=#{itemType} insert into eam_object_item (site,objectID,ItemNo,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,CreatedDate,CreatedBy,MaxValue,MinValue, ItemType) select #{site},#{objectID},ItemNo,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,GetDate(),#{createBy},MaxValue,MinValue,ItemType from eam_object_item where site=#{site} and objectID=#{oldObjectID} and ItemType=#{itemType} insert into eam_object_item_available(Site,ObjectID,ItemNo,ItemType,ValueNo,AvailableValue,CreatedDate,CreatedBy) select #{site},#{objectID},ItemNo,ItemType,ValueNo,AvailableValue,GetDate(),#{createBy} from eam_object_item_available where site=#{site} and objectID=#{oldObjectID} and ItemType=#{itemType} delete from eam_object_defect where site=#{site} and objectID=#{objectID} insert into eam_object_defect(site,ObjectID,DefectID,Active) select #{site},#{objectID},DefectID,Active from eam_object_defect where site=#{site} and objectID=#{oldObjectID} update eam_defect_feedBack set status='已取消' where FeedBackID=#{feedBackID} and site=#{site} update eam_defect_feedBack set status='已下达',PlanOperator=#{planOperator},UpdateDate=GetDate(),UpdateBy=#{updateBy} where FeedBackID=#{feedBackID} and site=#{site} INSERT INTO eam_workOrder(Site,OrderNo,PlanID,PropertiesCode,ObjectID,Status,PlanOperator,PlanDate,FunctionType,CreateDate,CreateBy) values( #{site} ,( select 'X'+ Right( '0000000000'+ convert(VARCHAR(10),isnull(max(convert(INT,SUBSTRING(OrderNo,3,10))),0)+1),8) from eam_workOrder where site=#{site} and FunctionType='C' ) ,#{feedBackID},'',#{objectID},'未开工',#{planOperator},#{planDate},'C',GetDate(),#{userId} ) delete from sys_oss where id=#{id}