/***文档注释***********************************************
 * 作者            ：
 * 创建日期     ：2020-01-16
 * 描述            ：null
 * 注意事项     ：
 * 遗留BUG   ：
 * 修改日期     ：
 * 修改人员     ：
 * 修改内容     ：
***********************************************************/
package market.Mes.anneal.impl;
import market.Com.vo.CommonPage;
import market.Com.vo.ResultModel;
import market.Mes.anneal.mapper.WorkReportTempMapper;
import market.Mes.anneal.service.WorkReportTempService;
import market.Mes.anneal.vo.WorkReportTemp;

import org.springframework.transaction.annotation.Transactional;

import com.hnshituo.basic.service.impl.BaseServiceImpl;
import com.hnshituo.basic.spring.remoting.annotation.RemoteService;
import com.hnshituo.core.auth.service.HomeService;

@RemoteService(path="WorkReportTempService")
public class WorkReportTempServiceImpl extends BaseServiceImpl<WorkReportTemp,Object> implements WorkReportTempService {

	/**
	 * 各机组经济填报日志
	 * ----
	 * object:
	 * machine_code:机台代码 
	 * wrk_date:日期    2018-05-10
	 * 
	 * */
	public ResultModel doWorkReportQueryWeb(CommonPage<WorkReportTemp> oci){
		ResultModel rm=new ResultModel();
		try{
			rm.setData(this.getMapper(WorkReportTempMapper.class).doDiaoduQueryWeb(oci.getObject(),oci.getMemo1()));
			rm.setState("200");
		}catch(Exception ex){
			ex.printStackTrace();
			rm.setState("500");
			rm.setMsgInfo("查询失败!"+ex.getMessage());
		}
		return rm;
	}
	
	
	/**
	 * 调度日志
	 * 修改
	 * objectList:
	 * machine_code：机台号代码
	 * 。。。。.。。
	 * */
	@Transactional(value = "tm", rollbackFor = Exception.class)
	public ResultModel doDiaoduUpdate(CommonPage<WorkReportTemp> oci) throws Exception{
		ResultModel rm=new ResultModel();
		try{
			String vOprName = (String) this.getSession().getAttribute(HomeService.SESSION_USER_NAME);
			if(vOprName==null){
				vOprName="";
			}
			if(oci.getObjectList()==null || oci.getObjectList().size()<=0){
				rm.setState("500");
				rm.setMsgInfo("请输入参数");
				return rm;
			}
			//this.getMapper(PlnSchedulingMchMapper.class).doDeleteJindu(oci.getObjectList().get(0),oci.getObjectList().get(0).getWrk_date().substring(0, 7));
			for(WorkReportTemp pscp:oci.getObjectList()){
				pscp.setMachine_code(oci.getMemo1());
				pscp.setWrk_date(oci.getMemo2());
				pscp.setCreate_time(pscp.getCreate_time());
				pscp.setCreate_emp(vOprName);
				WorkReportTemp pscp11=new WorkReportTemp();
				pscp11.setWrk_date(pscp.getWrk_date());
				pscp11.setWrk_ord(pscp.getWrk_ord());
				pscp11.setWrk_grp(pscp.getWrk_grp());
				pscp11.setMachine_code(pscp.getMachine_code());
				this.getMapper(WorkReportTempMapper.class).doDelete(pscp11,"");
				this.getMapper(WorkReportTempMapper.class).insert(pscp);
				
				Double param1Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param1");
				Double param1Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param1");
				pscp.setParam1_month(param1Month==null?null:param1Month+"");
				pscp.setParam1_year(param1Year==null?null:param1Year+"");
				Double param2Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param2");
				Double param2Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param2");
				pscp.setParam2_month(param2Month==null?null:param2Month+"");
				pscp.setParam2_year(param2Year==null?null:param2Year+"");
				Double param3Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param3");
				Double param3Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param3");
				pscp.setParam3_month(param3Month==null?null:param3Month+"");
				pscp.setParam3_year(param3Year==null?null:param3Year+"");
				
//				Double param4Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param4");
//				Double param4Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param4");
//				pscp.setParam4_month(param4Month==null?null:param4Month+"");
//				pscp.setParam4_year(param4Year==null?null:param4Year+"");
				
				Double param5Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param5");
				Double param5Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param5");
				pscp.setParam5_month(param5Month==null?null:param5Month+"");
				pscp.setParam5_year(param5Year==null?null:param5Year+"");
				Double param6Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param6");
				Double param6Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param6");
				pscp.setParam6_month(param6Month==null?null:param6Month+"");
				pscp.setParam6_year(param6Year==null?null:param6Year+"");
				Double param7Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param7");
				Double param7Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param7");
				pscp.setParam7_month(param7Month==null?null:param7Month+"");
				pscp.setParam7_year(param7Year==null?null:param7Year+"");
				Double param8Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param8");
				Double param8Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param8");
				pscp.setParam8_month(param8Month==null?null:param8Month+"");
				pscp.setParam8_year(param8Year==null?null:param8Year+"");
				//机时产量 
				//Double param10Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param10");
				//Double param10Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param10");
				//pscp.setParam10_month(param10Month==null?null:param10Month+"");
				//pscp.setParam10_year(param10Year==null?null:param10Year+"");
				Double param11Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param11");
				Double param11Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param11");
				pscp.setParam11_month(param11Month==null?null:param11Month+"");
				pscp.setParam11_year(param11Year==null?null:param11Year+"");
				Double param12Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param12");
				Double param12Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param12");
				pscp.setParam12_month(param12Month==null?null:param12Month+"");
				pscp.setParam12_year(param12Year==null?null:param12Year+"");
				Double param13Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param13");
				Double param13Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param13");
				pscp.setParam13_month(param13Month==null?null:param13Month+"");
				pscp.setParam13_year(param13Year==null?null:param13Year+"");
				Double param14Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param14");
				Double param14Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param14");
				pscp.setParam14_month(param14Month==null?null:param14Month+"");
				pscp.setParam14_year(param14Year==null?null:param14Year+"");
				Double param15Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param15");
				Double param15Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param15");
				pscp.setParam15_month(param15Month==null?null:param15Month+"");
				pscp.setParam15_year(param15Year==null?null:param15Year+"");
				Double param16Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param16");
				Double param16Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param16");
				pscp.setParam16_month(param16Month==null?null:param16Month+"");
				pscp.setParam16_year(param16Year==null?null:param16Year+"");
				Double param17Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param17");
				Double param17Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param17");
				pscp.setParam17_month(param17Month==null?null:param17Month+"");
				pscp.setParam17_year(param17Year==null?null:param17Year+"");
				Double param18Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param18");
				Double param18Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param18");
				pscp.setParam18_month(param18Month==null?null:param18Month+"");
				pscp.setParam18_year(param18Year==null?null:param18Year+"");
				Double param19Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param19");
				Double param19Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param19");
				pscp.setParam19_month(param19Month==null?null:param19Month+"");
				pscp.setParam19_year(param19Year==null?null:param19Year+"");
				Double param20Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param20");
				Double param20Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param20");
				pscp.setParam20_month(param20Month==null?null:param20Month+"");
				pscp.setParam20_year(param20Year==null?null:param20Year+"");
				
				
				
				Double param21Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param21");
				Double param21Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param21");
				pscp.setParam21_month(param21Month==null?null:param21Month+"");
				pscp.setParam21_year(param21Year==null?null:param21Year+"");
				Double param22Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param22");
				Double param22Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param22");
				pscp.setParam22_month(param22Month==null?null:param22Month+"");
				pscp.setParam22_year(param22Year==null?null:param22Year+"");
				Double param23Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param23");
				Double param23Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param23");
				pscp.setParam23_month(param23Month==null?null:param23Month+"");
				pscp.setParam23_year(param23Year==null?null:param23Year+"");
				Double param24Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param24");
				Double param24Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param24");
				pscp.setParam24_month(param24Month==null?null:param24Month+"");
				pscp.setParam24_year(param24Year==null?null:param24Year+"");
				Double param25Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param25");
				Double param25Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param25");
				pscp.setParam25_month(param25Month==null?null:param25Month+"");
				pscp.setParam25_year(param25Year==null?null:param25Year+"");
				Double param26Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param26");
				Double param26Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param26");
				pscp.setParam26_month(param26Month==null?null:param26Month+"");
				pscp.setParam26_year(param26Year==null?null:param26Year+"");
				Double param27Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param27");
				Double param27Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param27");
				pscp.setParam27_month(param27Month==null?null:param27Month+"");
				pscp.setParam27_year(param27Year==null?null:param27Year+"");
				Double param28Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param28");
				Double param28Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param28");
				pscp.setParam28_month(param28Month==null?null:param28Month+"");
				pscp.setParam28_year(param28Year==null?null:param28Year+"");
				Double param29Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param29");
				Double param29Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param29");
				pscp.setParam29_month(param29Month==null?null:param29Month+"");
				pscp.setParam29_year(param29Year==null?null:param29Year+"");
				Double param30Month=this.getMapper(WorkReportTempMapper.class).doQueryYueLei(pscp,"param30");
				Double param30Year=this.getMapper(WorkReportTempMapper.class).doQueryYearLei(pscp,"param30");
				pscp.setParam30_month(param30Month==null?null:param30Month+"");
				pscp.setParam30_year(param30Year==null?null:param30Year+"");
				
				this.getMapper(WorkReportTempMapper.class).update(pscp);
				
			}
			rm.setMsgInfo("保存成功！");
			rm.setState("200");
		}catch(Exception ex){
			throw new Exception(ex.getMessage());
		}
		return rm;
	}
	
	
	
	/**
	 * 调度日志
	 * 修改
	 * objectList:
	 * machine_code：表一，或者表二
	 * 。。。。.。。
	 * */
	@Transactional(value = "tm", rollbackFor = Exception.class)
	public ResultModel doDiaoduUpdate_ZL(CommonPage<WorkReportTemp> oci) throws Exception{
		ResultModel rm=new ResultModel();
		try{
			String vOprName = (String) this.getSession().getAttribute(HomeService.SESSION_USER_NAME);
			if(vOprName==null){
				vOprName="";
			}
			if(oci.getObjectList()==null || oci.getObjectList().size()<=0){
				rm.setState("500");
				rm.setMsgInfo("请输入参数");
				return rm;
			}
			this.getMapper(WorkReportTempMapper.class).doDeleteWrk(oci.getObjectList().get(0).getMachine_code(),oci.getObjectList().get(0).getWrk_date());
			for(WorkReportTemp pscp:oci.getObjectList()){
				this.getMapper(WorkReportTempMapper.class).insert(pscp);
			}
			rm.setMsgInfo("保存成功！");
			rm.setState("200");
		}catch(Exception ex){
			throw new Exception(ex.getMessage());
		}
		return rm;
	}

	
	public static void main(String[] args){
		
	}
	
	
	
	
	
	
}
