insert into eam_properties_item_available (ItemNo, ValueNo, AvailableValue, CreatedDate, CreatedBy, ItemType, site, bu_no) values(#{itemNo}, #{valueNo}, #{availableValue}, GetDate(), #{createdBy}, #{itemType}, #{site}, #{buNo}) update eam_properties_item_available set AvailableValue = #{availableValue} where itemNo = #{itemNo} and ItemType = #{itemType} and ValueNo = #{valueNo} and site = #{site} and bu_no = #{buNo} delete from eam_properties_item_available where itemNo = #{itemNo} and ItemType = #{itemType} and ValueNo = #{valueNo} and site = #{site} and bu_no = #{buNo} insert into eam_properties_model_header (function_type, code_no, code_desc, active, created_date, created_by, delflag, version, update_date, update_by, site, bu_no) values (#{functionType}, #{codeNo}, #{codeDesc}, #{active}, GetDate(), #{userId}, 'N', 0, getDate(), #{updateBy}, #{site}, #{buNo}) update eam_properties_model_header set version = version + 1, code_desc = #{codeDesc}, active = #{active}, update_by = #{updateBy}, update_date = GetDate() where function_type = #{functionType} and code_no = #{codeNo} and site = #{site} and bu_no = #{buNo} delete from eam_properties_model_detail where function_type = #{functionType} and code_no = #{codeNo} and site = #{site} and bu_no = #{buNo} delete from eam_properties_model_header where function_type = #{functionType} and code_no = #{codeNo} and site = #{site} and bu_no = #{buNo} insert into eam_properties_model_detail (function_type, code_no, properties_item_no, seq_no, created_date, created_by, delflag, version, site, bu_no) values (#{functionType}, #{codeNo}, #{itemNo}, #{seqNo}, GetDate(), #{userId}, 'N', 0, #{site}, #{buNo}) delete from eam_properties_model_detail where function_type = #{functionType} and code_no = #{codeNo} and properties_item_no = #{itemNo} and site = #{site} and bu_no = #{buNo} 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} and ObjectID = #{objectID} and bu_no = #{buNo} 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, ObjectID, bu_no) values(#{site}, #{planID}, #{itemNo}, #{valueNo}, #{availableValue}, GetDate(), #{createdBy}, #{itemType}, #{objectID}, #{buNo}) 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} and ObjectID = #{objectID} and bu_no = #{buNo} delete from eam_workPlan_item_available where itemNo = #{itemNo} and ItemType = #{itemType} and ValueNo = #{valueNo} AND site = #{site} and planID = #{planID} and ObjectID = #{objectID} and bu_no = #{buNo} update eam_defect_feedBack set Status = #{result}, FinishDate = GetDate(), DefectID = #{defectID} where Site = #{site} and FeedBackID = #{planID} and bu_no = #{buNo} update eam_workOrder set Status = '待审核', ActualOperator = #{actualOperator}, ActualDate = #{actualDate}, Remark = #{remark}, disposal_measures = #{disposalMeasures}, WorkTime = CASE WHEN (DATEDIFF(SECOND, reach_date, #{actualDate}) 60) THEN DATEDIFF(SECOND, reach_date, #{actualDate}) / 60.0 ELSE ceiling(floor(DATEDIFF(SECOND, reach_date, #{actualDate}) * 1.0 / 30) / 2) END, result = #{result,jdbcType=VARCHAR}, checkResult = #{checkResult}, handling_method = #{handlingMethod}, fault_reason = #{faultReason}, preventive_measure = #{preventiveMeasure} where site = #{site} and orderNo = #{orderNo} and FunctionType = #{functionType} and bu_no = #{buNo} update eam_workOrder set Status = '待审核', ActualOperator = #{actualOperator}, reach_date = #{reachDate}, ActualDate = #{actualDate}, Remark = #{remark}, disposal_measures = #{disposalMeasures}, WorkTime = #{workTime}, result = #{result,jdbcType=VARCHAR}, checkResult = #{checkResult}, handling_method = #{handlingMethod}, check_remark = #{checkRemark} where site = #{site} and orderNo = #{orderNo} and FunctionType = #{functionType} and bu_no = #{buNo} update eam_workOrder set Status = '已完工', ActualOperator = #{actualOperator}, ActualDate = GetDate(), Remark = #{remark}, disposal_measures = #{disposalMeasures}, WorkTime = #{workTime}, result = #{result,jdbcType=VARCHAR}, checkResult = #{checkResult} where site = #{site} and orderNo = #{orderNo} INSERT into eam_workOrder_item (Site, bu_no, OrderNo, ItemNo, ItemDesc, DefaultValue, ValueType, ValueType_DB, ValueChooseFlag, MaxValue, MinValue, ItemRemark, ItemType, TextValue, NumberValue, CreatedDate, CreatedBy, FinishFlag, itemResult, item_notes) values (#{site}, #{buNo}, #{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}, #{itemResult}, #{itemNotes}) update eam_workPlan set status = '已结束' where site = #{site} and PlanID = #{planID} and ObjectID = #{objectID} and GetDate() > PlanEndDate update eam_workPlan_overview set next_work_date = (select top 1 PlanDate from eam_workOrder where site = #{site} and bu_no = #{buNo} and PlanID = #{planID} and PlanDate > GetDate() and status = '未开工' order by PlanDate) where site = #{site} and plan_id = #{planID} and bu_no = #{buNo} update eam_workOrder set Status = '已取消' where site = #{site} and orderNo = #{orderNo} and FunctionType = #{functionType} and bu_no = #{buNo} update eam_workOrder set Status = '已取消' where site = #{site} and PlanID = #{planID} and FunctionType = #{functionType} and ObjectID = #{objectID} and Status = #{status} and bu_no = #{buNo} update eam_workPlan set Status = '已计划', NextWorkDate = null where site = #{site} and PlanID = #{planID} and deleteFlag = 'N' and bu_no = #{buNo} update eam_workPlan_overview set status = '已取消', next_work_date = null where site = #{site} and plan_id = #{planID} and delete_flag = 'N' and bu_no = #{buNo} update eam_workPlan set Status = '已取消', NextWorkDate = null where Site = #{site} and PlanID = #{planID} and deleteFlag = 'N' and bu_no = #{buNo} update eam_workOrder set Status = '已取消' where site = #{site} and PlanID = #{planID} and status = '未开工' and bu_no = #{buNo} delete from eam_workOrder_item where site = #{site} and bu_no = #{buNo} 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 bu_no = #{buNo} 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} and bu_no = #{buNo} update eam_defect_feedBack set status = '已下达', PlanOperator = #{planOperator}, UpdateDate = GetDate(), UpdateBy = #{updateBy} where FeedBackID = #{feedBackID} and site = #{site} and bu_no = #{buNo} INSERT INTO eam_workOrder (Site, bu_no, OrderNo, PlanID, PropertiesCode, ObjectID, Status, PlanOperator, PlanDate, FunctionType, CreateDate, CreateBy) values(#{site}, #{buNo}, (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' and bu_no = #{buNo}), #{feedBackID}, '', #{objectID}, '未开工', #{planOperator}, #{planDate}, 'C', GetDate(), #{userId}) delete from sys_oss where id = #{id} UPDATE eam_workOrder SET Status = '已完工' WHERE Site = #{site} AND OrderNo = #{orderNo} and bu_no = #{buNo} UPDATE eam_workOrder SET Status = '待审核' WHERE Site = #{site} AND OrderNo = #{orderNo} and bu_no = #{buNo} UPDATE eam_workPlan_overview SET status = '已结束' WHERE site = #{site} AND plan_id = #{planID} and bu_no = #{buNo} INSERT INTO eam_workPlan_overview (site, plan_id, plan_desc, status, plan_start_date, plan_end_date, created_date, created_by, update_date, update_by, remark, delete_flag, operator, operator_name, checker, checker_name, function_type, properties_code, plan_period, work_order_rule, plan_cycle, task_start_date, plan_halt_date, auto_renewal, bu_no) VALUES (#{site}, #{planID}, #{planDesc}, '已计划', #{planStartDate}, #{planEndDate}, getDate(), #{createdBy}, getDate(), #{updateBy}, #{remark}, 'N', #{operator}, #{operatorName}, #{checker}, #{checkerName}, #{functionType}, #{propertiesCode}, #{planPeriod}, #{workOrderRule}, #{planCycle}, #{taskStartDate}, #{planHaltDate}, #{autoRenewal}, #{buNo}) DELETE FROM eam_workPlan WHERE Site = #{site} AND PlanID = #{planID} AND ObjectID = #{objectID} INSERT INTO eam_workPlan (Site,PlanID,PlanDesc,ObjectID,FunctionType,PropertiesCode,Operator,OperatorName,checker,checkerName,PlanPeriod,Status,PlanStartDate,PlanEndDate,CreatedDate,CreatedBy,Version,Remark,DeleteFlag) values (#{site},#{planID},#{planDesc},#{objectID},#{functionType},#{propertiesCode},#{operator},#{operatorName},#{checker},#{checkerName},#{planPeriod},#{status},#{planStartDate},#{planEndDate},GetDate(),#{createdBy},0,#{remark},'N') UPDATE eam_workPlan_overview SET plan_desc = #{planDesc}, properties_code = #{propertiesCode}, plan_start_date = #{planStartDate}, plan_end_date = #{planEndDate}, plan_period = #{planPeriod}, remark = #{remark}, operator = #{operator}, operator_name = #{operatorName}, checker = #{checker}, checker_name = #{checkerName}, work_order_rule = #{workOrderRule}, task_start_date = #{taskStartDate}, plan_cycle = #{planCycle}, plan_halt_date = #{planHaltDate}, auto_renewal = #{autoRenewal} WHERE site = #{site} AND plan_id = #{planID} AND function_type = #{functionType} and bu_no = #{buNo} DELETE FROM eam_workPlan WHERE Site = #{site} AND PlanID = #{planID} and bu_no = #{buNo} DELETE FROM eam_workPlan_item WHERE Site = #{site} AND PlanID = #{planID} and bu_no = #{buNo} DELETE FROM eam_workPlan_item_available WHERE Site = #{site} AND PlanID = #{planID} AND ObjectID = #{objectID} UPDATE eam_workPlan_overview SET status = '进行中', next_work_date = plan_start_date WHERE site = #{site} AND plan_id = #{planID} and bu_no = #{buNo} INSERT INTO eam_actual_operator (site, order_no, function_type, operator, bu_no) VALUES (#{site}, #{orderNo}, #{functionType}, #{operator}, #{buNo}) INSERT INTO eam_workOrder (Site, bu_no, OrderNo, PlanID, PropertiesCode, ObjectID, Status, PlanDate, FunctionType, CreateDate, CreateBy, check_work_plan_id, check_item_no, document_source) VALUES (#{site}, #{buNo}, #{orderNo}, #{planID}, '', #{objectID}, '未开工', getDate(), 'C', getDate(), #{createBy}, #{checkWorkPlanId}, #{checkItemNo}, #{documentSource}) INSERT INTO eam_workOrder_count (Site, bu_no, OrderNo, PlanID, PropertiesCode, ObjectID, Status, PlanDate, FunctionType, CreateDate, CreateBy, check_work_plan_id, check_item_no) VALUES (#{site}, #{buNo}, #{orderNo}, #{planID}, '', #{objectID}, '未开工', getDate(), 'C', getDate(), #{createBy}, #{checkWorkPlanId}, #{checkItemNo}) INSERT INTO eam_workOrder (Site, bu_no, OrderNo, PlanID, PlanDesc, PropertiesCode, ObjectID, Status, PlanOperator, PlanDate, FunctionType, CreateDate, CreateBy, checker, PlanOperatorName, checkerName) VALUES (#{site}, #{buNo}, #{orderNo}, #{planID}, #{planDesc}, #{propertiesCode}, #{objectID}, '未开工', #{planOperator}, Dateadd(dd, Datediff(dd,0,Getdate()), 0), #{functionType}, getDate(), #{createBy}, #{checker}, #{planOperatorName}, #{checkerName}) UPDATE eam_workOrder SET Status = #{status}, difficulty_level = #{difficultyLevel}, difficulty_remark = #{difficultyRemark} WHERE Site = #{site} AND OrderNo = #{orderNo} and bu_no = #{buNo} INSERT INTO eam_admin_dept (Site, admin_id, dept_id) VALUES (#{site}, #{adminID}, #{deptId}) DELETE FROM eam_admin_dept WHERE site = #{site} AND admin_id = #{adminID} DELETE FROM sys_oss WHERE id = #{id} INSERT INTO eam_workOrder (Site, bu_no, OrderNo, PlanID, PlanDesc, PropertiesCode, ObjectID, Status, PlanOperator, PlanDate, FunctionType,CreateDate, CreateBy, checker, PlanOperatorName, checkerName) VALUES (#{site}, #{buNo}, #{orderNo}, #{planID}, #{planDesc}, #{propertiesCode}, #{objectID}, '未开工', #{operator}, #{planStartDate}, #{functionType}, getDate(), #{userId}, #{checker}, #{operatorName}, #{checkerName}) INSERT INTO eam_workOrder (Site, bu_no, OrderNo, PlanID, PlanDesc, PropertiesCode, ObjectID, Status, PlanOperator, PlanDate, FunctionType,CreateDate, CreateBy, checker, PlanOperatorName, checkerName) VALUES (#{site}, #{buNo}, #{orderNo}, #{planID}, #{planDesc}, #{propertiesCode}, #{objectID}, '未开工', #{operator}, #{orderDate}, #{functionType}, getDate(), #{userId}, #{checker}, #{operatorName}, #{checkerName}) update eam_workPlan set status = '进行中', NextWorkDate = PlanStartDate where site = #{site} and PlanID = #{planID} and FunctionType = #{functionType} and ObjectID = #{objectID} and bu_no = #{buNo} DELETE FROM eam_workPlan_item WHERE site = #{site} and PlanID = #{planID} and ItemType = #{itemType} and ObjectID = #{objectID} and bu_no = #{buNo} DELETE FROM eam_workPlan_item_available WHERE site = #{site} and PlanID = #{planID} and ItemType = #{itemType} and ObjectID = #{objectID} and bu_no = #{buNo} INSERT INTO eam_workPlan_item (Site, bu_no, PlanID, ObjectID, ItemNo, ItemDesc, DefaultValue, ValueType, ValueType_DB, ValueChooseFlag, MaxValue, MinValue, ItemRemark, ItemType, CreatedDate, CreatedBy, image_flag, produce_control_flag) select #{site}, #{buNo}, #{planID}, #{objectID}, a.ItemNo, a.ItemDesc, case when c.site is not null then c.DefaultValue else a.DefaultValue end, case when c.site is not null then c.ValueType else a.ValueType end, case when c.site is not null then c.ValueType_DB else a.ValueType_DB end, case when c.site is not null then c.ValueChooseFlag else a.ValueChooseFlag end, case when c.site is not null then c.MaxValue else a.MaxValue end, case when c.site is not null then c.MinValue else a.MinValue end, a.ItemRemark, a.ItemType, GetDate(), #{userId}, a.image_flag, a.produce_control_flag from eam_properties_item a left join eam_properties_model_detail b on a.ItemType = b.function_type and a.ItemNo = b.properties_item_no and a.site = b.site and a.bu_no = b.bu_no left join eam_object_item c on a.ItemType = c.ItemType and a.ItemNo = c.ItemNo and c.objectID = #{objectID} where a.ItemType = #{itemType} and b.code_no = #{propertiesCode} and a.site = #{site} and a.bu_no = #{buNo} INSERT INTO eam_workPlan_item_available (Site, bu_no, PlanID, ObjectID, ItemNo, ItemType, ValueNo, AvailableValue, CreatedDate, CreatedBy) SELECT DISTINCT #{site}, #{buNo}, #{planID}, #{objectID}, a.ItemNo, a.ItemType, case when c.ValueNo is not null then c.ValueNo else a.ValueNo end, case when c.ValueNo is not null then c.AvailableValue else a.AvailableValue end, GetDate(), #{userId} FROM eam_properties_item_available a LEFT JOIN eam_properties_model_detail b on a.ItemType = b.function_type and a.ItemNo = b.properties_item_no and a.site = b.site and a.bu_no = b.bu_no LEFT JOIN eam_object_item_available c on a.ItemNo = c.ItemNo and a.ItemType = c.ItemType and c.ObjectID = #{objectID} WHERE a.ItemType = #{itemType} and b.code_no = #{propertiesCode} and a.site = #{site} and a.bu_no = #{buNo} INSERT INTO eam_defect_feedBack (Site, bu_no, FeedBackID, FeedBackDesc, ObjectID, DefectID, FunctionType, PlanOperator, Status, PlanDate, Remark, deleteFlag, CreatedDate, CreatedBy, Version, DefectDate, urgency) VALUES (#{site}, #{buNo}, #{feedBackID}, #{feedBackDesc}, #{objectID}, #{defectID}, #{functionType}, #{planOperator}, #{status}, #{planDate}, #{remark}, #{deleteFlag}, getDate(), #{createdBy}, #{version}, #{defectDate}, #{urgency}) UPDATE eam_defect_feedBack SET Status = '已下达' WHERE Site = #{site} AND FeedBackID = #{feedBackID} and bu_no = #{buNo} INSERT INTO eam_workOrder (Site, bu_no, OrderNo, PlanID, PropertiesCode, ObjectID, Status, PlanDate, FunctionType, CreateDate, CreateBy, PlanDesc, document_source) VALUES (#{site}, #{buNo}, #{orderNo}, #{feedBackID}, '', #{objectID}, '未开工', getDate(), 'C', getDate(), #{createdBy}, #{feedBackDesc}, #{documentSource}) INSERT INTO eam_workOrder_count (Site, bu_no, OrderNo, PlanID, PropertiesCode, ObjectID, Status, PlanDate, FunctionType, CreateDate, CreateBy, PlanDesc) VALUES (#{site}, #{buNo}, #{orderNo}, #{feedBackID}, '', #{objectID}, '未开工', getDate(), 'C', getDate(), #{createdBy}, #{feedBackDesc}) update eam_workOrder set update_by = #{mesUser}, update_date = GetDate(), Remark = #{remark}, reach_date = #{reachDate}, ActualDate = #{actualDate}, WorkTime = #{workTime}, disposal_measures = '', disposal_measures = #{disposalMeasures}, checkResult = #{checkResult}, check_remark = #{checkRemark}, fault_reason = #{faultReason}, preventive_measure = #{preventiveMeasure} where site = #{site} and orderNo = #{orderNo} and bu_no = #{buNo} update eam_workOrder_item set update_by = #{updateBy}, update_date = GetDate(), TextValue = #{textValue}, NumberValue = #{numberValue}, itemResult = #{itemResult} where site = #{site} and OrderNo = #{orderNo} and ItemNo = #{itemNo} and bu_no = #{buNo} DELETE FROM eam_actual_operator WHERE site = #{site} and order_no = #{orderNo} and function_type = #{functionType} and bu_no = #{buNo} update eam_workOrder set Status = #{status}, reach_date = GetDate(), reach_operator = #{reachOperator}, reach_operator_name = #{reachOperatorName} where site = #{site} and OrderNo = #{orderNo} and FunctionType = #{functionType} and bu_No = #{buNo} update eam_knowledge_base set update_date = getDate(), update_by = #{updateBy} where site = #{site} and order_no = #{orderNo} and bu_no = #{buNo} INSERT INTO eam_knowledge_base (site, bu_no, num, file_type, defect_describe, disposal_measures, create_date, create_by, object_id, defect_id, order_no) VALUES (#{site}, #{buNo}, (select 'ZS'+ Right('0000000000' + convert(VARCHAR(10), isnull(max(convert(INT, SUBSTRING(num, 3, 10))), 0) + 1), 8) from eam_knowledge_base where site = #{site}), '维修', #{planDesc}, #{disposalMeasures}, getDate(), #{createBy}, #{objectID}, #{defectID}, #{orderNo}) UPDATE eam_defect_feedBack SET Status = '已取消' WHERE Site = #{site} AND FeedBackID = #{planID} and bu_no = #{buNo} DELETE FROM eam_family WHERE site = #{site} and bu_no = #{buNo} and FamilyID = #{familyID} and son_id like #{sonId} + '%' update eam_workOrder set ActualDate = #{actualDate}, reach_date = #{reachDate}, fault_reason = #{faultReason}, handling_method = #{handlingMethod}, preventive_measure = #{preventiveMeasure}, Remark = #{remark}, WorkTime = #{workTime} where site = #{site} and orderNo = #{orderNo} and FunctionType = #{functionType} and bu_no = #{buNo} INSERT INTO send_message_record (site, bu_no, plan_id, object_id, defect_id, feed_back_desc, sender, recipient, phone, send_date) VALUES (#{site}, #{buNo}, #{planId}, #{objectId}, #{defectId}, #{feedBackDesc}, #{sender}, #{recipient}, #{phone}, getDate())