package com.system.dqfn.action;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.system.action.SystemAction;
import com.system.common.PageParam;
import com.system.db.C3P0Utils;
import com.system.dqfn.model.DQFNBom;
import com.system.dqfn.model.DQFNFtzk;
import com.system.dqfn.model.DQFNPlan;
import com.system.dqfn.model.DQFNPlanBom;
import com.system.dqfn.model.DQFNTcline;
import com.system.dqfn.model.DQFNWP6;
import com.system.dqfn.model.FTLabel;
import com.system.dqfn.model.TBFtLog;
import com.system.dqfn.util.DQFNValidate;
import com.system.dqfn.util.ReflectUtils;
import com.system.dqfn.util.TclineUtils;
import com.system.dqfn.util.ToSendZKThread;
import com.system.dqfn.util.ValidateResult;
import com.system.model.Encfor;
import com.system.model.Protype;
import com.system.utils.UserUtils;
import com.system.utils.UuidUtil;
@SuppressWarnings(“serial”)
public class DQFNFtAction extends SystemAction {
private PageParam page;
public PageParam getPage() {
return page;
}
/**
* 批量删除
* */
@SuppressWarnings("unchecked")
public void toDel(){
String tf_lot=res.getParameter(request, "tf_lot", "");
String tf_id=res.getParameter(request, "tf_id", "");
String hql = "from TBFtLog l where l.tf_lot = '"+ tf_lot+"'";
System.out.println(hql);
String sql="from TBFtLog l where l.tf_lot = '"+ tf_id+"'";
System.out.println(sql);
List<TBFtLog> listlog = (List<TBFtLog>) dqfnService.findByHql(hql);
for(TBFtLog log: listlog){
dqfnService.delete(log);
}
try {
response.sendRedirect("dqfnAction!dqfnLotDetailUI.action?flag=&page.name="
+ res.getParameter(request, "className", "") + "&tf_id=" + tf_id);
} catch (Exception e) {
}
}
// 中转到添加确认页面
@SuppressWarnings("unchecked")
public void toAdd() {
String className = res.getParameter(request, "className", "");
String tf_id = res.getParameter(request, "tf_id", "");
String flag = res.getParameter(request, "flag", "");
String tf_lot = res.getParameter(request, "tf_lot", "");
if ("bat".equals(flag)) {
// 添加01-12片信息
TBFtLog log = new TBFtLog();
String str = "";
for (int i = 1; i < 13; i++) {
str = "00" + i;
str = str.substring(str.length() - 2);
log.setTf_id(UuidUtil.get32UUID());
log.setTf_lot(tf_lot);
log.setTf_p1(str);
// 保存之前须判断
try {
Object obj = Class.forName("com.system.dqfn.model." + className).newInstance();
obj = systemService.findObjectByHql("from " + className + " where tf_lot= '" + tf_lot + "'");
String tf_dingdan = ReflectUtils.invokeGetter(obj, "tf_dingdan");
DQFNPlan plan = dqfnPlanService.findById("from DQFNPlan where tf_id='" + tf_dingdan + "'");
DQFNBom bom = (DQFNBom) systemService
.findObjectByHql("from DQFNBom where tf_id='" + plan.getTf_bom() + "' ");
DQFNPlanBom _bom = (DQFNPlanBom) systemService
.findObjectByHql("from DQFNPlanBom where tf_id='" + plan.getTf_bom() + "'");
Protype protype = protypeService
.findById(_bom != null ? _bom.getTf_protype() : bom.getTf_protype());
String hql = "from TBFtLog l where l.tf_lot = '" + tf_lot + "' and l.tf_p1 = '" + str + "'";
List<TBFtLog> listlog = (List<TBFtLog>) dqfnService.findByHql(hql);
if (listlog.size() > 0) {
log = listlog.get(0);
dqfnService.update(log);
} else {
log.setTf_id(UuidUtil.get32UUID());
log.setTf_tr("");
log.setTf_protype(protype.getTf_name());
log.setTf_cc("");
log.setTf_p2("");
log.setTf_p3("");
log.setTf_p4("");
log.setTf_p5("");
log.setTf_ng1("0");
log.setTf_ng2("0");
log.setTf_ng3("0");
log.setTf_ng4("0");
log.setTf_ng5("0");