📄 modifyaudittableaction.java
字号:
for(int i=0;i<listresult.size();i++){
Outstoreproduct product=(Outstoreproduct) listresult.get(i);
//判断库存,是否存在,并增加库存
OutStory(document.getStoretype(),product.getProductid(),product.getNumbers());
System.out.println("单据:buydocument"+" 单据编号:"+table.getOrderid()+" 所属仓库:"+document.getStoretype()+" 单据产品编号:"+product.getProductid());
}
}
// 判断当前审核人,是否最后一位
// if(AudittableManagerFactory.getAudittableManager().isgreat(table.getAudittype(),table.getAuditstaffid())){
// System.out.println(table.getOrderid()+"================"+table.getAudittype()+"==============="+table.getFeedback());
// System.out.println("最后一位,结束");
// //更新单据状态
Information information=(Information) AudittableManagerFactory.getAudittableManager().getInformation(table.getAudittype(), table.getOrderid());
new codeDao().updateState(table.getOrderid(),information.getTablename(),"3");
//更新审核状态
table.setState("3");
// table.setFeedback(uForm.getFeedback());
// //更新消息栏显示
// information.setIsaudit("1");
InformationManagerFactory.getInformationManager().deleteInformation(information.getId());
//发送至采购
if("prodction".equals(table.getAudittype())){
// 添加审核消息
String stock=request.getParameter("stock");//得到采购
String inforget=new codeDao().getColumes("Staffinfo", "staffname", "staffcnname", stock);
String orderexplain=new codeDao().getColumes("Auditorder", "orderexplain", "ordername", table.getAudittype());
new codeDao().insertInfor(uForm.getOrderid(),orderexplain,uForm.getAudittype(), uForm.getRemark(), new codeDao().getDate().toString(),uForm.getStaffid(),inforget,"Producenote","1");
// 更新消息栏显示
// information.setIsaudit("1");
//InformationManagerFactory.getInformationManager().modfilyInformation(information);
}
//增加或减少库存
// }else{
// System.out.println("后面还有,插入一条");
// //插入审核表,下一个审核人任务
// Audittable audittable=new Audittable(table.getStaffid(),""+(Integer.parseInt(table.getAuditstaffid())+1),table.getAudittype(),table.getOrderid(),"0",new codeDao().getDate(),table.getRemark(),"");
// AudittableManagerFactory.getAudittableManager().addAudittable(audittable);
//// 得到审核人
// String Auditname=new codeDao().getAuditname(""+(Integer.parseInt(table.getAuditstaffid())+1));
// //将下一审核人增加消息
// Information infor=(Information) AudittableManagerFactory.getAudittableManager().getInformation(table.getAudittype(), table.getOrderid());
// new codeDao().insertInfor(infor.getInforid(),infor.getInfortype(),infor.getInforcontent(),infor.getInforurl(), new codeDao().getDate().toString(),infor.getInforman(),Auditname,infor.getTablename(),"0");
//// 删除消息栏显示
// //infor.setIsaudit("1");
// InformationManagerFactory.getInformationManager().deleteInformation(infor.getId());
// }
// 更新审核表
AudittableManagerFactory.getAudittableManager().modfilyAudittable(table);
}
if("不通过".equals(uForm.getState())){//结束审核
//更新审核消息,插入不通过原因
table.setState("2");
table.setFeedback(uForm.getFeedback());
Information information=(Information) AudittableManagerFactory.getAudittableManager().getInformation(table.getAudittype(), table.getOrderid());
// System.out.println(information.getTablename()+"========="+information.getInforid()+"======="+table.getOrderid());
//更新单据表
new codeDao().updateAuditState(table.getOrderid(),information.getTablename(),"2");
//删除消息栏显示
//information.setIsaudit("1");
InformationManagerFactory.getInformationManager().deleteInformation(information.getId());
}
} catch (Exception e) {
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("edu.system.excption", e.getMessage()));
this.saveErrors(request, errors);
tx.rollback();
e.printStackTrace();
} finally {
try {
if (null != conn) {
conn.close();
}
} catch (Exception ex) {
ex.printStackTrace();
}
HibernateSessionFactory.closeSession();
}
return mapping.findForward(returnStr);
}
public void InsertoStory(String types,String productid,String totals) throws BwayHibernateException{
PageListVO rvo = null;
// 查找产品
Productmanage pro=(Productmanage) ProductmanageManagerFactory.getProductmanageManager().getProductmanage(productid);
Product product=new Product();
//判断库存是否存在该产品
rvo=(PageListVO) ProductManagerFactory.getProductManager().queryProduct(types,pro.getId());
ArrayList ListResult= (ArrayList) rvo.getretVO();
if(ListResult.size()<1){//不存在
//增加库存
product.setCodes(""+pro.getId());
product.setNames(pro.getNames());
product.setPrice(pro.getPrice());
product.setSpec(pro.getSpec());
product.setCraftwork(pro.getCraftwork());
product.setColor(pro.getColor());
product.setStuff(pro.getStuff());
product.setProvide(pro.getProvide());
product.setProductionperiod(pro.getProductionperiod());
product.setQc(pro.getQc());
product.setTypes(types);
product.setNumbers(totals);
ProductManagerFactory.getProductManager().addProduct(product);
}else{//存在库存
for(int i=0;i<ListResult.size();i++){
product=(Product) ListResult.get(i);
Integer pr=Integer.parseInt(product.getNumbers());
System.out.println(pr+"---------------存在的数量");
product.setNumbers(""+(Integer.parseInt(totals)+pr));
ProductManagerFactory.getProductManager().modfilyProduct(product);
}
}
}
public void OutStory(String types,String productid,String totals) throws BwayHibernateException{
PageListVO rvo = null;
// 查找产品
Productmanage pro=(Productmanage) ProductmanageManagerFactory.getProductmanageManager().getProductmanage(productid);
Product product=new Product();
//判断库存是否存在该产品
rvo=(PageListVO) ProductManagerFactory.getProductManager().queryProduct(types,pro.getId());
ArrayList ListResult= (ArrayList) rvo.getretVO();
if(ListResult.size()<1){//不存在
//增加库存
product.setCodes(""+pro.getId());
product.setNames(pro.getNames());
product.setPrice(pro.getPrice());
product.setSpec(pro.getSpec());
product.setCraftwork(pro.getCraftwork());
product.setColor(pro.getColor());
product.setStuff(pro.getStuff());
product.setProvide(pro.getProvide());
product.setProductionperiod(pro.getProductionperiod());
product.setQc(pro.getQc());
product.setTypes(types);
product.setNumbers(totals);
ProductManagerFactory.getProductManager().addProduct(product);
}else{//存在库存
for(int i=0;i<ListResult.size();i++){
product=(Product) ListResult.get(i);
Integer pr=Integer.parseInt(product.getNumbers());
System.out.println(pr+"---------------存在的数量");
product.setNumbers(""+(pr-(Integer.parseInt(totals))));
ProductManagerFactory.getProductManager().modfilyProduct(product);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -