package com.cxstock.action.kucun;


import java.util.Date;

import com.cxstock.action.BaseAction;
import com.cxstock.biz.kucun.BsyBiz;
import com.cxstock.pojo.Bsd;
import com.cxstock.pojo.Byd;

@SuppressWarnings("serial")
public class BsyAction extends BaseAction  {
	
	private BsyBiz bsyBiz;
	
	private String djid;
	private Date riqi;
	private String bz;
	
	private String tab;
	private String ymd;
	private String djsps; //单据商品集合字符串
	
	private String startdate;
	private String enddate;
	private String search;
	
	/**
	 * 生成单据编号
	 */
	public String getDjCode(){
		try {
			String code = bsyBiz.getDjCode(tab,ymd);
			this.outString(code);
		} catch (Exception e) {
			e.printStackTrace();
			this.outError();
		}
		return null;
	}
	
	/**
	 * 保存/修改报损单
	 */
	public String saveOrUpdateBsd() {
		try {
			Bsd pojo = new Bsd();
			pojo.setDjid(djid);
			pojo.setRiqi(riqi);
			pojo.setUserid(this.getUserDTO().getUserid());
			pojo.setUsername(this.getUserDTO().getUsername());
			pojo.setBz(bz);
			bsyBiz.saveOrUpdateBsd(pojo,djsps);
			this.outString("{success:true}");
		} catch (Exception e) {
			 e.printStackTrace();
			 this.outError();
		}
		return null;
	}
	
	/**
	 * 保存/修改报溢单
	 */
	public String saveOrUpdateByd() {
		try {
			Byd pojo = new Byd();
			pojo.setDjid(djid);
			pojo.setRiqi(riqi);
			pojo.setUserid(this.getUserDTO().getUserid());
			pojo.setUsername(this.getUserDTO().getUsername());
			pojo.setBz(bz);
			bsyBiz.saveOrUpdateByd(pojo,djsps);
			this.outString("{success:true}");
		} catch (Exception e) {
			 e.printStackTrace();
			 this.outError();
		}
		return null;
	}
	
    
	/**
	 * 删除报损单
	 */
	public String deleteJhd() {
		try {
			//jhdBiz.deleteJhd(kcid);
			this.outString("{success:true}");
		} catch (Exception e) {
			e.printStackTrace();
			this.outError();
		}
		return null;
	}
	
	/**
	 * 按条件查询单据
	 */
	public String findDjByParams(){
		try {
			StringBuffer wheres = new StringBuffer(" where 1=1");
			if(startdate!=null&&enddate!=null){
				wheres.append(" and t.riqi between '");
				wheres.append(startdate);
				wheres.append("' and '");
				wheres.append(enddate);
				wheres.append("'");
			}
			if(search!=null&&!"".equals(search)){
				wheres.append(" and (t.djid like '%");
				wheres.append(search);
				wheres.append("%'");
				wheres.append(" or t.gysname like '%");
				wheres.append(search);
				wheres.append("%')");
			}else if(djid!=null){
				wheres.append(" and t.djid='");
				wheres.append(djid);
				wheres.append("'");
			}
			startdate=null;
			enddate=null;
			search=null;
			djid=null;
			this.outListString(bsyBiz.findDjByParams(tab,wheres.toString()));
		} catch (Exception e) {
			e.printStackTrace();
			this.outError();
		}
		return null;
	}


	public void setBsyBiz(BsyBiz bsyBiz) {
		this.bsyBiz = bsyBiz;
	}

	public void setDjid(String djid) {
		this.djid = djid;
	}

	public void setRiqi(Date riqi) {
		this.riqi = riqi;
	}

	public void setBz(String bz) {
		this.bz = bz;
	}

	public void setTab(String tab) {
		this.tab = tab;
	}

	public void setYmd(String ymd) {
		this.ymd = ymd;
	}

	public void setDjsps(String djsps) {
		this.djsps = djsps;
	}

	public void setStartdate(String startdate) {
		this.startdate = startdate;
	}

	public void setEnddate(String enddate) {
		this.enddate = enddate;
	}

	public void setSearch(String search) {
		this.search = search;
	}
	

}
最近下载更多
sunlea  LV17 3月21日
过桥次米线  LV2 2月25日
小屁孩  LV7 2023年4月30日
bluesky2016  LV15 2022年7月4日
testuser1234567  LV24 2022年6月30日
guoyan  LV12 2022年4月22日
粉娇你几  LV3 2022年4月9日
1029162867  LV13 2022年4月2日
wanglinddad  LV54 2022年3月22日
and123456  LV11 2022年2月14日
最近浏览更多
 LV7 3月25日
sunlea  LV17 3月21日
过桥次米线  LV2 2月25日
952773464 1月15日
暂无贡献等级
codeshare  LV3 1月3日
WBelong  LV7 2023年12月25日
ziv5466123  LV7 2023年12月14日
陆程江  LV2 2023年5月29日
hihhhh  LV6 2023年4月6日
北方菜  LV11 2022年12月31日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友