|
|
@@ -18,270 +18,267 @@ import java.util.Iterator;
|
|
|
import java.util.Vector;
|
|
|
|
|
|
public class hyworkorder extends PaoCust {
|
|
|
- /**
|
|
|
- * 构造函数
|
|
|
- *
|
|
|
- * @param arg0
|
|
|
- */
|
|
|
- public hyworkorder(PaoSet arg0) {
|
|
|
- super(arg0);
|
|
|
- }
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 构造函数
|
|
|
+ *
|
|
|
+ * @param arg0
|
|
|
+ */
|
|
|
+ public hyworkorder(PaoSet arg0) {
|
|
|
+ super(arg0);
|
|
|
+ }
|
|
|
|
|
|
- @Override
|
|
|
+ @Override
|
|
|
public void canDelete() throws P2Exception {
|
|
|
// TODO Auto-generated method stub
|
|
|
super.canDelete();
|
|
|
- if (!"作废".equals(getString("fstatus"))) {
|
|
|
- throw new P2AppException("", "非作废状态不可删除");
|
|
|
- }
|
|
|
+ if (!"作废".equals(getString("fstatus"))) {
|
|
|
+ throw new P2AppException("", "非作废状态不可删除");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public void init() throws P2Exception {
|
|
|
+ super.init();
|
|
|
+ if (!toBeAdded() && !getString("fstatus").equals("待开始")) {
|
|
|
+ setFieldFlag(new GetFieldsName(getName()).getFields(), READONLY, true);
|
|
|
+ setFieldFlag("fisperiod", READONLY, false);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void add() throws P2Exception {
|
|
|
+ super.add();
|
|
|
+
|
|
|
+ setValue("fworknum", getBillNum("HYORDER"), 11l);
|
|
|
+ setValue("fstatus", "待开始", 11l);
|
|
|
+ setValue("progress", 0, 11l);
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
- public void init() throws P2Exception {
|
|
|
- super.init();
|
|
|
- if(!toBeAdded()&&!getString("fstatus").equals("待开始")){
|
|
|
- setFieldFlag(new GetFieldsName(getName()).getFields(), READONLY,true);
|
|
|
- setFieldFlag("fisperiod", READONLY,false);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void add() throws P2Exception {
|
|
|
- super.add();
|
|
|
-
|
|
|
- setValue("fworknum", getBillNum("HYORDER"),11l);
|
|
|
- setValue("fstatus","待开始",11l);
|
|
|
- setValue("progress",0,11l);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Override
|
|
|
- public void fieldValidate(Object paoField, String fieldname) throws P2Exception {
|
|
|
- super.fieldValidate(paoField, fieldname);
|
|
|
- if(fieldname.equalsIgnoreCase("ProjectLeader")){
|
|
|
+ public void fieldValidate(Object paoField, String fieldname) throws P2Exception {
|
|
|
+ super.fieldValidate(paoField, fieldname);
|
|
|
+ if (fieldname.equalsIgnoreCase("ProjectLeader")) {
|
|
|
// System.out.println("test:"+getString("ProjectLeader"));
|
|
|
- PaoSetRemote hyWorkorder = P2Server.getP2Server().getPaoSet("hyWorkorder", P2Server.getP2Server().getSystemUserInfo());
|
|
|
- hyWorkorder.setInsertSite(getSite());
|
|
|
- hyWorkorder.setWhere("servernum='"+getString("servernum")+"' and ProjectLeader='"+getString("ProjectLeader")+"' and FADDRESS='"+getString("FADDRESS")+"' and fstatus !='作废'");
|
|
|
- hyWorkorder.reset();
|
|
|
- if(!hyWorkorder.isEmpty()){
|
|
|
- throw new P2AppException("","不能指定该人员,该服务人员已经有指派工单");
|
|
|
- }
|
|
|
- }else if(fieldname.equalsIgnoreCase("FTYPE")) {
|
|
|
- String ftype=getString("ftype");
|
|
|
- PaoSetRemote hyWorkorder = P2Server.getP2Server().getPaoSet("hyWorkorder", P2Server.getP2Server().getSystemUserInfo());
|
|
|
- hyWorkorder.setInsertSite(getSite());
|
|
|
- hyWorkorder.setWhere("servernum='"+getString("servernum")+"' and HYWORKORDERID!="+getUniqueIDValue()+" and fstatus !='作废'");
|
|
|
- hyWorkorder.reset();
|
|
|
- int i=0;
|
|
|
- PaoRemote paoRemote=null;
|
|
|
- while ((paoRemote=hyWorkorder.getPao(i))!=null) {
|
|
|
- if(paoRemote.getString("ftype").equals(ftype)) {
|
|
|
- throw new P2AppException("","对应的服务单已存在此类型的工单,无法再次新建");
|
|
|
- }
|
|
|
- i++;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void fieldAction(Object paoField, String fieldname) throws P2Exception {
|
|
|
- super.fieldAction(paoField, fieldname);
|
|
|
- if(fieldname.equalsIgnoreCase("templatenum")){
|
|
|
- System.out.println(111);
|
|
|
- //新增节点之前先删除原先的节点
|
|
|
- if(!getPaoSet("hyordernode").isEmpty()){
|
|
|
- PaoSetRemote ordernode = getPaoSet("hyordernode");
|
|
|
- ordernode.deleteAll();
|
|
|
- ordernode.save();
|
|
|
- }
|
|
|
- //新增节点
|
|
|
- PaoSetRemote ordernode = getPaoSet("hyordernode");
|
|
|
- PaoSetRemote workordertemplate = getPaoSet("hyWorkordertemplate");
|
|
|
- if(!workordertemplate.isEmpty()){
|
|
|
-
|
|
|
- PaoRemote templatepao = workordertemplate.getPao(0);
|
|
|
- PaoSetRemote templatenode = templatepao.getPaoSet("hytemplatenode");
|
|
|
- if(!templatenode.isEmpty()){
|
|
|
-
|
|
|
- int index=0;
|
|
|
- for(int i=0;i<templatenode.count();i++){
|
|
|
- PaoRemote pao = templatenode.getPao(i);
|
|
|
- PaoSetRemote templatenode2 = pao.getPaoSet("hytemplatenode2");
|
|
|
- if(templatenode2.isEmpty()){
|
|
|
- PaoRemote remote = ordernode.addAtEnd();
|
|
|
- remote.setValue("FROWNUM",++index,11l);
|
|
|
- remote.setValue("oneprocessname",pao.getString("oneprocessname"),11l);
|
|
|
- remote.setValue("Operating",pao.getString("Operating"),11l);
|
|
|
-
|
|
|
- remote.setValue("fisupload",pao.getString("fisupload"),11l);
|
|
|
+ PaoSetRemote hyWorkorder = P2Server.getP2Server().getPaoSet("hyWorkorder",
|
|
|
+ P2Server.getP2Server().getSystemUserInfo());
|
|
|
+ hyWorkorder.setInsertSite(getSite());
|
|
|
+ hyWorkorder.setWhere("servernum='" + getString("servernum") + "' and ProjectLeader='"
|
|
|
+ + getString("ProjectLeader") + "' and FADDRESS='" + getString("FADDRESS") + "' and fstatus !='作废'");
|
|
|
+ hyWorkorder.reset();
|
|
|
+ if (!hyWorkorder.isEmpty()) {
|
|
|
+ throw new P2AppException("", "不能指定该人员,该服务人员已经有指派工单");
|
|
|
+ }
|
|
|
+ } else if (fieldname.equalsIgnoreCase("FTYPE")) {
|
|
|
+ String ftype = getString("ftype");
|
|
|
+ PaoSetRemote hyWorkorder = P2Server.getP2Server().getPaoSet("hyWorkorder",
|
|
|
+ P2Server.getP2Server().getSystemUserInfo());
|
|
|
+ hyWorkorder.setInsertSite(getSite());
|
|
|
+ hyWorkorder.setWhere("servernum='" + getString("servernum") + "' and HYWORKORDERID!=" + getUniqueIDValue()
|
|
|
+ + " and fstatus !='作废'");
|
|
|
+ hyWorkorder.reset();
|
|
|
+ int i = 0;
|
|
|
+ PaoRemote paoRemote = null;
|
|
|
+ while ((paoRemote = hyWorkorder.getPao(i)) != null) {
|
|
|
+ if (paoRemote.getString("ftype").equals(ftype)) {
|
|
|
+ throw new P2AppException("", "对应的服务单已存在此类型的工单,无法再次新建");
|
|
|
+ }
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void fieldAction(Object paoField, String fieldname) throws P2Exception {
|
|
|
+ super.fieldAction(paoField, fieldname);
|
|
|
+ if (fieldname.equalsIgnoreCase("templatenum")) {
|
|
|
+ System.out.println(111);
|
|
|
+ // 新增节点之前先删除原先的节点
|
|
|
+ if (!getPaoSet("hyordernode").isEmpty()) {
|
|
|
+ PaoSetRemote ordernode = getPaoSet("hyordernode");
|
|
|
+ ordernode.deleteAll();
|
|
|
+ ordernode.save();
|
|
|
+ }
|
|
|
+ // 新增节点
|
|
|
+ PaoSetRemote ordernode = getPaoSet("hyordernode");
|
|
|
+ PaoSetRemote workordertemplate = getPaoSet("hyWorkordertemplate");
|
|
|
+ if (!workordertemplate.isEmpty()) {
|
|
|
+
|
|
|
+ PaoRemote templatepao = workordertemplate.getPao(0);
|
|
|
+ PaoSetRemote templatenode = templatepao.getPaoSet("hytemplatenode");
|
|
|
+ if (!templatenode.isEmpty()) {
|
|
|
+
|
|
|
+ int index = 0;
|
|
|
+ for (int i = 0; i < templatenode.count(); i++) {
|
|
|
+ PaoRemote pao = templatenode.getPao(i);
|
|
|
+ PaoSetRemote templatenode2 = pao.getPaoSet("hytemplatenode2");
|
|
|
+ if (templatenode2.isEmpty()) {
|
|
|
+ PaoRemote remote = ordernode.addAtEnd();
|
|
|
+ remote.setValue("FROWNUM", ++index, 11l);
|
|
|
+ remote.setValue("oneprocessname", pao.getString("oneprocessname"), 11l);
|
|
|
+ remote.setValue("Operating", pao.getString("Operating"), 11l);
|
|
|
+
|
|
|
+ remote.setValue("fisupload", pao.getString("fisupload"), 11l);
|
|
|
// remote.setValue("fisnotes",pao.getString("fisnotes"),11l);
|
|
|
- remote.setValue("fisaddtitem",pao.getString("fisaddtitem"),11l);
|
|
|
- remote.setValue("fistext",pao.getString("fistext"),11l);
|
|
|
+ remote.setValue("fisaddtitem", pao.getString("fisaddtitem"), 11l);
|
|
|
+ remote.setValue("fistext", pao.getString("fistext"), 11l);
|
|
|
// remote.setValue("fiscreatecard",pao.getString("fiscreatecard"),11l);
|
|
|
- remote.setValue("fisconfirmation",pao.getString("fisconfirmation"),11l);
|
|
|
- remote.setValue("fiscontract",pao.getString("fiscontract"),11l);
|
|
|
- remote.setValue("FISCOMPLETE",pao.getString("FISCOMPLETE"),11l);
|
|
|
-
|
|
|
- }else{
|
|
|
- PaoRemote remote = ordernode.addAtEnd();
|
|
|
- remote.setValue("FROWNUM",++index,11l);
|
|
|
- remote.setValue("oneprocessname",pao.getString("oneprocessname"),11l);
|
|
|
- remote.setValue("Operating",pao.getString("Operating"),11l);
|
|
|
- remote.setValue("ischilden",true,11l);
|
|
|
- remote.setValue("fisupload",pao.getString("fisupload"),11l);
|
|
|
+ remote.setValue("fisconfirmation", pao.getString("fisconfirmation"), 11l);
|
|
|
+ remote.setValue("fiscontract", pao.getString("fiscontract"), 11l);
|
|
|
+ remote.setValue("FISCOMPLETE", pao.getString("FISCOMPLETE"), 11l);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ PaoRemote remote = ordernode.addAtEnd();
|
|
|
+ remote.setValue("FROWNUM", ++index, 11l);
|
|
|
+ remote.setValue("oneprocessname", pao.getString("oneprocessname"), 11l);
|
|
|
+ remote.setValue("Operating", pao.getString("Operating"), 11l);
|
|
|
+ remote.setValue("ischilden", true, 11l);
|
|
|
+ remote.setValue("fisupload", pao.getString("fisupload"), 11l);
|
|
|
// remote.setValue("fisnotes",pao.getString("fisnotes"),11l);
|
|
|
- remote.setValue("fisaddtitem",pao.getString("fisaddtitem"),11l);
|
|
|
- remote.setValue("fistext",pao.getString("fistext"),11l);
|
|
|
+ remote.setValue("fisaddtitem", pao.getString("fisaddtitem"), 11l);
|
|
|
+ remote.setValue("fistext", pao.getString("fistext"), 11l);
|
|
|
// remote.setValue("fiscreatecard",pao.getString("fiscreatecard"),11l);
|
|
|
- remote.setValue("fisconfirmation",pao.getString("fisconfirmation"),11l);
|
|
|
- remote.setValue("fiscontract",pao.getString("fiscontract"),11l);
|
|
|
- remote.setValue("FISCOMPLETE",pao.getString("FISCOMPLETE"),11l);
|
|
|
-
|
|
|
- for(int j=0;j<templatenode2.count();j++){
|
|
|
- PaoRemote templatenode2_pao = templatenode2.getPao(j);
|
|
|
- PaoRemote remote2 = ordernode.addAtEnd();
|
|
|
- remote2.setValue("FROWNUM",++index,11l);
|
|
|
- remote2.setValue("twoprocessname",templatenode2_pao.getString("twoprocessname"),11l);
|
|
|
- remote2.setValue("Operating",templatenode2_pao.getString("Operating"),11l);
|
|
|
- remote2.setValue("ischilden",false,11l);
|
|
|
- remote2.setValue("supid",remote.getUniqueIDValue(),11l);
|
|
|
- remote2.setValue("fisupload",templatenode2_pao.getString("fisupload"),11l);
|
|
|
+ remote.setValue("fisconfirmation", pao.getString("fisconfirmation"), 11l);
|
|
|
+ remote.setValue("fiscontract", pao.getString("fiscontract"), 11l);
|
|
|
+ remote.setValue("FISCOMPLETE", pao.getString("FISCOMPLETE"), 11l);
|
|
|
+
|
|
|
+ for (int j = 0; j < templatenode2.count(); j++) {
|
|
|
+ PaoRemote templatenode2_pao = templatenode2.getPao(j);
|
|
|
+ PaoRemote remote2 = ordernode.addAtEnd();
|
|
|
+ remote2.setValue("FROWNUM", ++index, 11l);
|
|
|
+ remote2.setValue("twoprocessname", templatenode2_pao.getString("twoprocessname"), 11l);
|
|
|
+ remote2.setValue("Operating", templatenode2_pao.getString("Operating"), 11l);
|
|
|
+ remote2.setValue("ischilden", false, 11l);
|
|
|
+ remote2.setValue("supid", remote.getUniqueIDValue(), 11l);
|
|
|
+ remote2.setValue("fisupload", templatenode2_pao.getString("fisupload"), 11l);
|
|
|
// remote2.setValue("fisnotes",templatenode2_pao.getString("fisnotes"),11l);
|
|
|
- remote2.setValue("fisaddtitem",templatenode2_pao.getString("fisaddtitem"),11l);
|
|
|
- remote2.setValue("fistext",templatenode2_pao.getString("fistext"),11l);
|
|
|
+ remote2.setValue("fisaddtitem", templatenode2_pao.getString("fisaddtitem"), 11l);
|
|
|
+ remote2.setValue("fistext", templatenode2_pao.getString("fistext"), 11l);
|
|
|
// remote2.setValue("fiscreatecard",templatenode2_pao.getString("fiscreatecard"),11l);
|
|
|
- remote2.setValue("fisconfirmation",templatenode2_pao.getString("fisconfirmation"),11l);
|
|
|
- remote2.setValue("fiscontract",templatenode2_pao.getString("fiscontract"),11l);
|
|
|
- remote2.setValue("FISCOMPLETE",templatenode2_pao.getString("FISCOMPLETE"),11l);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //ordernode.save();
|
|
|
+ remote2.setValue("fisconfirmation", templatenode2_pao.getString("fisconfirmation"),
|
|
|
+ 11l);
|
|
|
+ remote2.setValue("fiscontract", templatenode2_pao.getString("fiscontract"), 11l);
|
|
|
+ remote2.setValue("FISCOMPLETE", templatenode2_pao.getString("FISCOMPLETE"), 11l);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // ordernode.save();
|
|
|
// getThisPaoSet().save();
|
|
|
- }else if(fieldname.equalsIgnoreCase("Installerphone")){
|
|
|
- PaoSetRemote installer = getPaoSet("Installer");
|
|
|
- if(installer.isEmpty())throw new P2AppException("","该安装人员不存在");
|
|
|
- setValue("Installer",installer.getPao(0).getString("fname"),11l);
|
|
|
- }else if(fieldname.equalsIgnoreCase("PROJECTLEADER")){
|
|
|
- PaoSetRemote paoSet = getPaoSet("HYWORKORDER_TEAM");
|
|
|
- paoSet.setWhere("hyworkernum='"+getString("PROJECTLEADER")+"'");
|
|
|
- paoSet.reset();
|
|
|
- if(paoSet.isEmpty()){
|
|
|
- PaoRemote remote = paoSet.addAtEnd();
|
|
|
- remote.setValue("hyworkernum",getString("PROJECTLEADER"),2l);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /**工单是否全部确认**/
|
|
|
- public boolean fisAllComplete() throws P2Exception {
|
|
|
- PaoSetRemote ordernode_confirm = P2Server.getP2Server().getPaoSet("hyordernode", P2Server.getP2Server().getSystemUserInfo());
|
|
|
- ordernode_confirm.setInsertSite(getSite());
|
|
|
- ordernode_confirm.setWhere("fparentid="+getInt("fparentid")+" and ischilden=0 and isconfirm=1");
|
|
|
- ordernode_confirm.reset();
|
|
|
-
|
|
|
- PaoSetRemote ordernode_count = P2Server.getP2Server().getPaoSet("hyordernode", P2Server.getP2Server().getSystemUserInfo());
|
|
|
- ordernode_count.setInsertSite(getSite());
|
|
|
- ordernode_count.setWhere("fparentid="+getInt("fparentid")+" and ischilden=0");
|
|
|
- ordernode_count.reset();
|
|
|
- return ordernode_confirm.count()==ordernode_count.count();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**完成工单**/
|
|
|
- public void complete(boolean iscreatecard,String hrid) throws Exception {
|
|
|
- if(!getString("fstatus").equals("进行中"))throw new P2AppException("","该工单不在进行中状态");
|
|
|
-
|
|
|
- PaoSetRemote ordernodeset = getPaoSet("hyordernode");
|
|
|
- ordernodeset.setWhere("ischilden=0");
|
|
|
- ordernodeset.reset();
|
|
|
- int allcount=ordernodeset.count();
|
|
|
- ordernodeset.setWhere("ischilden=0 and isconfirm=1");
|
|
|
- ordernodeset.reset();
|
|
|
- int count=ordernodeset.count();
|
|
|
- if(allcount!=count&&!getString("ftype").equals("维修")){
|
|
|
-// throw new P2AppException("","还有工序没有确认");
|
|
|
- }else{
|
|
|
- DBConnect dbConnect=new DBConnect();
|
|
|
-
|
|
|
- /**判断预约单是否可以完成**/
|
|
|
- PaoSetRemote serviceform = getPaoSet("AFTERSERVICEORDER");
|
|
|
- if(!serviceform.isEmpty()){
|
|
|
- PaoRemote serviceformPao = serviceform.getPao(0);
|
|
|
- PaoSetRemote workorders = serviceformPao.getPaoSet("hyWORKORDER");
|
|
|
- workorders.setWhere("hyWORKORDERid!="+getUniqueIDValue());
|
|
|
- workorders.reset();
|
|
|
- boolean isallcomplete=true;
|
|
|
- for(int i=0;i<workorders.count();i++){
|
|
|
- if(!workorders.getPao(i).getString("fstatus").equals("已完成")&&
|
|
|
- !workorders.getPao(i).getString("fstatus").equals("关闭")&&
|
|
|
- !workorders.getPao(i).getString("fstatus").equals("作废")){
|
|
|
- isallcomplete=false;
|
|
|
- }
|
|
|
- }
|
|
|
- if(isallcomplete){
|
|
|
- serviceformPao.setValue("fstatus","已完成",11l);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /**给经销商发送消息**/
|
|
|
+ } else if (fieldname.equalsIgnoreCase("Installerphone")) {
|
|
|
+ PaoSetRemote installer = getPaoSet("Installer");
|
|
|
+ if (installer.isEmpty())
|
|
|
+ throw new P2AppException("", "该安装人员不存在");
|
|
|
+ setValue("Installer", installer.getPao(0).getString("fname"), 11l);
|
|
|
+ } else if (fieldname.equalsIgnoreCase("PROJECTLEADER")) {
|
|
|
+ PaoSetRemote paoSet = getPaoSet("HYWORKORDER_TEAM");
|
|
|
+ paoSet.setWhere("hyworkernum='" + getString("PROJECTLEADER") + "'");
|
|
|
+ paoSet.reset();
|
|
|
+ if (paoSet.isEmpty()) {
|
|
|
+ PaoRemote remote = paoSet.addAtEnd();
|
|
|
+ remote.setValue("hyworkernum", getString("PROJECTLEADER"), 2l);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 工单是否全部确认 **/
|
|
|
+ public boolean fisAllComplete() throws P2Exception {
|
|
|
+ PaoSetRemote ordernode_confirm = P2Server.getP2Server().getPaoSet("hyordernode",
|
|
|
+ P2Server.getP2Server().getSystemUserInfo());
|
|
|
+ ordernode_confirm.setInsertSite(getSite());
|
|
|
+ ordernode_confirm.setWhere("fparentid=" + getInt("fparentid") + " and ischilden=0 and isconfirm=1");
|
|
|
+ ordernode_confirm.reset();
|
|
|
+
|
|
|
+ PaoSetRemote ordernode_count = P2Server.getP2Server().getPaoSet("hyordernode",
|
|
|
+ P2Server.getP2Server().getSystemUserInfo());
|
|
|
+ ordernode_count.setInsertSite(getSite());
|
|
|
+ ordernode_count.setWhere("fparentid=" + getInt("fparentid") + " and ischilden=0");
|
|
|
+ ordernode_count.reset();
|
|
|
+ return ordernode_confirm.count() == ordernode_count.count();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 完成工单 **/
|
|
|
+ public void complete(boolean iscreatecard, String hrid) throws Exception {
|
|
|
+ if (!getString("fstatus").equals("进行中"))
|
|
|
+ throw new P2AppException("", "该工单不在进行中状态");
|
|
|
+
|
|
|
+ PaoSetRemote ordernodeset = getPaoSet("hyordernode");
|
|
|
+ ordernodeset.setWhere("ischilden=0");
|
|
|
+ ordernodeset.reset();
|
|
|
+ int allcount = ordernodeset.count();
|
|
|
+ ordernodeset.setWhere("ischilden=0 and isconfirm=1");
|
|
|
+ ordernodeset.reset();
|
|
|
+ int count = ordernodeset.count();
|
|
|
+// if(allcount!=count&&!getString("ftype").equals("维修")){
|
|
|
+//// throw new P2AppException("","还有工序没有确认");
|
|
|
+// }else{
|
|
|
+ DBConnect dbConnect = new DBConnect();
|
|
|
+
|
|
|
+ /** 判断预约单是否可以完成 **/
|
|
|
+ PaoSetRemote serviceform = getPaoSet("AFTERSERVICEORDER");
|
|
|
+ if (!serviceform.isEmpty()) {
|
|
|
+ PaoRemote serviceformPao = serviceform.getPao(0);
|
|
|
+ PaoSetRemote workorders = serviceformPao.getPaoSet("hyWORKORDER");
|
|
|
+ workorders.setWhere("hyWORKORDERid!=" + getUniqueIDValue());
|
|
|
+ workorders.reset();
|
|
|
+ boolean isallcomplete = true;
|
|
|
+ for (int i = 0; i < workorders.count(); i++) {
|
|
|
+ if (!workorders.getPao(i).getString("fstatus").equals("已完成")
|
|
|
+ && !workorders.getPao(i).getString("fstatus").equals("关闭")
|
|
|
+ && !workorders.getPao(i).getString("fstatus").equals("作废")) {
|
|
|
+ isallcomplete = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isallcomplete) {
|
|
|
+ serviceformPao.setValue("fstatus", "已完成", 11l);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 给经销商发送消息 **/
|
|
|
// PaoSetRemote paoSet = getPaoSet("$workermassage", "workermassage", "");
|
|
|
// PaoRemote remote = paoSet.addAtEnd();
|
|
|
// remote.setValue("ftype","经销商消息",11l);
|
|
|
// remote.setValue("title","工单:"+getString("fworknum")+"已经完成",11l);
|
|
|
// remote.setValue("content","工单:"+getString("fworknum")+"已经完成",11l);
|
|
|
// remote.setValue("phone",getString("fagentnum"),11l);
|
|
|
- setValue("Acceptancedate",new Date(),11l);
|
|
|
- PaoSetRemote paoSet1 = getPaoSet("$hyworker", "hyworker", "hyworkernum='" + hrid + "'");
|
|
|
- if(!paoSet1.isEmpty()){
|
|
|
- setValue("Acceptby",paoSet1.getPao(0).getString("FNAME"),11l);
|
|
|
- }
|
|
|
- setValue("fstatus","已完成",11l);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- static Date addDate(Date date, int day) throws Exception {
|
|
|
- Calendar rightNow = Calendar.getInstance();
|
|
|
- rightNow.setTime(date);
|
|
|
-
|
|
|
- rightNow.add(Calendar.YEAR,day);//日期减1年
|
|
|
-
|
|
|
- return rightNow.getTime(); // 将毫秒数转换成日期
|
|
|
-
|
|
|
- }
|
|
|
+ setValue("Acceptancedate", new Date(), 11l);
|
|
|
+ PaoSetRemote paoSet1 = getPaoSet("$hyworker", "hyworker", "hyworkernum='" + hrid + "'");
|
|
|
+ if (!paoSet1.isEmpty()) {
|
|
|
+ setValue("Acceptby", paoSet1.getPao(0).getString("FNAME"), 11l);
|
|
|
+ }
|
|
|
+ setValue("fstatus", "已完成", 11l);
|
|
|
+ // }
|
|
|
+ }
|
|
|
|
|
|
- /**开始工单**/
|
|
|
- public void start() throws P2Exception {
|
|
|
- if(!getString("fstatus").equals("待开始"))throw new P2AppException("","该工单不在待开始状态");
|
|
|
- setValue("startdate",new Date(),11l);
|
|
|
- setValue("fstatus","进行中",11l);
|
|
|
+ static Date addDate(Date date, int day) throws Exception {
|
|
|
+ Calendar rightNow = Calendar.getInstance();
|
|
|
+ rightNow.setTime(date);
|
|
|
|
|
|
+ rightNow.add(Calendar.YEAR, day);// 日期减1年
|
|
|
|
|
|
- PaoSetRemote afterserviceorder = getPaoSet("AFTERSERVICEORDER");
|
|
|
- if(!afterserviceorder.isEmpty()){
|
|
|
- afterserviceorder.getPao(0).setValue("fstatus","进行中",11l);
|
|
|
- //afterserviceorder.save();
|
|
|
- }
|
|
|
+ return rightNow.getTime(); // 将毫秒数转换成日期
|
|
|
|
|
|
+ }
|
|
|
|
|
|
+ /** 开始工单 **/
|
|
|
+ public void start() throws P2Exception {
|
|
|
+ if (!getString("fstatus").equals("待开始"))
|
|
|
+ throw new P2AppException("", "该工单不在待开始状态");
|
|
|
+ setValue("startdate", new Date(), 11l);
|
|
|
+ setValue("fstatus", "进行中", 11l);
|
|
|
|
|
|
+ PaoSetRemote afterserviceorder = getPaoSet("AFTERSERVICEORDER");
|
|
|
+ if (!afterserviceorder.isEmpty()) {
|
|
|
+ afterserviceorder.getPao(0).setValue("fstatus", "进行中", 11l);
|
|
|
+ // afterserviceorder.save();
|
|
|
+ }
|
|
|
|
|
|
- /**给经销商发送消息**/
|
|
|
+ /** 给经销商发送消息 **/
|
|
|
// PaoSetRemote paoSet = getPaoSet("$workermassage", "workermassage", "");
|
|
|
// PaoRemote remote = paoSet.addAtEnd();
|
|
|
// remote.setValue("ftype","经销商消息",11l);
|
|
|
@@ -289,102 +286,99 @@ public class hyworkorder extends PaoCust {
|
|
|
// remote.setValue("content","工单:"+getString("fworknum")+"已经开始",11l);
|
|
|
// remote.setValue("phone",getString("fagentnum"),11l);
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public Row getCompleteAndTotal() throws P2Exception {
|
|
|
- DBConnect dbConnect=new DBConnect();
|
|
|
- Rows rows = dbConnect.runSqlQuery("select isnull((select count(1) from hyordernode where fparentid=" + getInt("hyworkorderid") + " and ischilden=0),0)count,\n" +
|
|
|
- "isnull((select count(1) from hyordernode where fparentid=" + getInt("hyworkorderid") + " and ischilden=0 and isconfirm=1),0)complete");
|
|
|
- return rows.get(0);
|
|
|
- }
|
|
|
-
|
|
|
+ public Row getCompleteAndTotal() throws P2Exception {
|
|
|
+ DBConnect dbConnect = new DBConnect();
|
|
|
+ Rows rows = dbConnect.runSqlQuery(
|
|
|
+ "select isnull((select count(1) from hyordernode where fparentid=" + getInt("hyworkorderid")
|
|
|
+ + " and ischilden=0),0)count,\n" + "isnull((select count(1) from hyordernode where fparentid="
|
|
|
+ + getInt("hyworkorderid") + " and ischilden=0 and isconfirm=1),0)complete");
|
|
|
+ return rows.get(0);
|
|
|
+ }
|
|
|
|
|
|
- /**后端完成工单**/
|
|
|
- public void completeformback(String hrid) throws Exception {
|
|
|
- if(!getString("fstatus").equals("进行中")&&!getString("fstatus").equals("质保卡审批"))throw new P2AppException("","该工单不在进行中状态");
|
|
|
- PaoSetRemote ordernodeset = getPaoSet("ordernode");
|
|
|
- ordernodeset.setWhere("ischilden=0");
|
|
|
- ordernodeset.reset();
|
|
|
- int allcount=ordernodeset.count();
|
|
|
- ordernodeset.setWhere("ischilden=0 and isconfirm=1");
|
|
|
- ordernodeset.reset();
|
|
|
- int count=ordernodeset.count();
|
|
|
- if(allcount!=count&&!getString("ftype").equals("维修")) {
|
|
|
- throw new P2AppException("", "还有工序没有确认");
|
|
|
- }
|
|
|
+ /** 后端完成工单 **/
|
|
|
+ public void completeformback(String hrid) throws Exception {
|
|
|
+ if (!getString("fstatus").equals("进行中") && !getString("fstatus").equals("质保卡审批"))
|
|
|
+ throw new P2AppException("", "该工单不在进行中状态");
|
|
|
+ PaoSetRemote ordernodeset = getPaoSet("ordernode");
|
|
|
+ ordernodeset.setWhere("ischilden=0");
|
|
|
+ ordernodeset.reset();
|
|
|
+ int allcount = ordernodeset.count();
|
|
|
+ ordernodeset.setWhere("ischilden=0 and isconfirm=1");
|
|
|
+ ordernodeset.reset();
|
|
|
+ int count = ordernodeset.count();
|
|
|
+ if (allcount != count && !getString("ftype").equals("维修")) {
|
|
|
+ throw new P2AppException("", "还有工序没有确认");
|
|
|
+ }
|
|
|
// PaoSetRemote workorder_errormsg = getPaoSet("workorder_errormsg");
|
|
|
// workorder_errormsg.setWhere("fisprocess=0");
|
|
|
// workorder_errormsg.reset();
|
|
|
// if(!workorder_errormsg.isEmpty()){
|
|
|
// throw new P2AppException("","有异常信息未处理");
|
|
|
// }
|
|
|
- DBConnect dbConnect=new DBConnect();
|
|
|
- PaoSetRemote workordertemplate = getPaoSet("WORKORDERTEMPLATE");
|
|
|
- /**判断预约单是否可以完成**/
|
|
|
- PaoSetRemote serviceform = getPaoSet("SERVICEFORM");
|
|
|
- if(!serviceform.isEmpty()){
|
|
|
- PaoRemote serviceformPao = serviceform.getPao(0);
|
|
|
- PaoSetRemote workorders = serviceformPao.getPaoSet("WORKORDER");
|
|
|
- workorders.setWhere("WORKORDERid!="+getUniqueIDValue());
|
|
|
- workorders.reset();
|
|
|
- boolean isallcomplete=true;
|
|
|
- for(int i=0;i<workorders.count();i++){
|
|
|
- if(!workorders.getPao(i).getString("fstatus").equals("已完成")&&
|
|
|
- !workorders.getPao(i).getString("fstatus").equals("关闭")&&
|
|
|
- !workorders.getPao(i).getString("fstatus").equals("作废")){
|
|
|
- isallcomplete=false;
|
|
|
- }
|
|
|
- }
|
|
|
- if(isallcomplete){
|
|
|
- serviceformPao.setValue("fstatus","已完成",11l);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**给经销商发送消息**/
|
|
|
- PaoSetRemote paoSet = getPaoSet("$workermassage", "workermassage", "");
|
|
|
- PaoRemote remote = paoSet.addAtEnd();
|
|
|
- remote.setValue("ftype","经销商消息",11l);
|
|
|
- remote.setValue("title","工单:"+getString("fworknum")+"已经完成",11l);
|
|
|
- remote.setValue("content","工单:"+getString("fworknum")+"已经完成",11l);
|
|
|
- remote.setValue("phone",getString("fagentnum"),11l);
|
|
|
- setValue("Acceptancedate",new Date(),11l);
|
|
|
- setValue("Acceptby",hrid,11l);
|
|
|
- setValue("fstatus","已完成",11l);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /**拒绝**/
|
|
|
- public void refuse() throws P2Exception {
|
|
|
- if(!getString("fstatus").equals("质保卡审批"))throw new P2AppException("","非质保卡审批状态无法拒绝");
|
|
|
- setValue("fstatus","进行中",11l);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**添加团队**/
|
|
|
- public void addservertitem(PaoSetRemote paoSet) throws P2Exception {
|
|
|
-
|
|
|
- Vector<PaoRemote> selection = paoSet.getSelection();
|
|
|
- Iterator<PaoRemote> iterator = selection.iterator();
|
|
|
- PaoSetRemote HYWORKORDER_TEAM = getPaoSet("HYWORKORDER_TEAM");
|
|
|
- while(iterator.hasNext()){
|
|
|
- PaoRemote next = iterator.next();
|
|
|
- PaoRemote remote = HYWORKORDER_TEAM.addAtEnd();
|
|
|
- remote.setValue("hyworkernum",next.getString("hyworkernum"),2l);
|
|
|
- }
|
|
|
- HYWORKORDER_TEAM.save();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**是否作废**/
|
|
|
- public boolean fisvoid()throws P2Exception {
|
|
|
- return getString("fstatus").equals("作废");
|
|
|
- }
|
|
|
- /**是否暂停**/
|
|
|
- public boolean fisSuspend() throws P2Exception {
|
|
|
- return getString("fstatus").equals("暂停");
|
|
|
- }
|
|
|
+ DBConnect dbConnect = new DBConnect();
|
|
|
+ PaoSetRemote workordertemplate = getPaoSet("WORKORDERTEMPLATE");
|
|
|
+ /** 判断预约单是否可以完成 **/
|
|
|
+ PaoSetRemote serviceform = getPaoSet("SERVICEFORM");
|
|
|
+ if (!serviceform.isEmpty()) {
|
|
|
+ PaoRemote serviceformPao = serviceform.getPao(0);
|
|
|
+ PaoSetRemote workorders = serviceformPao.getPaoSet("WORKORDER");
|
|
|
+ workorders.setWhere("WORKORDERid!=" + getUniqueIDValue());
|
|
|
+ workorders.reset();
|
|
|
+ boolean isallcomplete = true;
|
|
|
+ for (int i = 0; i < workorders.count(); i++) {
|
|
|
+ if (!workorders.getPao(i).getString("fstatus").equals("已完成")
|
|
|
+ && !workorders.getPao(i).getString("fstatus").equals("关闭")
|
|
|
+ && !workorders.getPao(i).getString("fstatus").equals("作废")) {
|
|
|
+ isallcomplete = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isallcomplete) {
|
|
|
+ serviceformPao.setValue("fstatus", "已完成", 11l);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 给经销商发送消息 **/
|
|
|
+ PaoSetRemote paoSet = getPaoSet("$workermassage", "workermassage", "");
|
|
|
+ PaoRemote remote = paoSet.addAtEnd();
|
|
|
+ remote.setValue("ftype", "经销商消息", 11l);
|
|
|
+ remote.setValue("title", "工单:" + getString("fworknum") + "已经完成", 11l);
|
|
|
+ remote.setValue("content", "工单:" + getString("fworknum") + "已经完成", 11l);
|
|
|
+ remote.setValue("phone", getString("fagentnum"), 11l);
|
|
|
+ setValue("Acceptancedate", new Date(), 11l);
|
|
|
+ setValue("Acceptby", hrid, 11l);
|
|
|
+ setValue("fstatus", "已完成", 11l);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 拒绝 **/
|
|
|
+ public void refuse() throws P2Exception {
|
|
|
+ if (!getString("fstatus").equals("质保卡审批"))
|
|
|
+ throw new P2AppException("", "非质保卡审批状态无法拒绝");
|
|
|
+ setValue("fstatus", "进行中", 11l);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 添加团队 **/
|
|
|
+ public void addservertitem(PaoSetRemote paoSet) throws P2Exception {
|
|
|
+
|
|
|
+ Vector<PaoRemote> selection = paoSet.getSelection();
|
|
|
+ Iterator<PaoRemote> iterator = selection.iterator();
|
|
|
+ PaoSetRemote HYWORKORDER_TEAM = getPaoSet("HYWORKORDER_TEAM");
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ PaoRemote next = iterator.next();
|
|
|
+ PaoRemote remote = HYWORKORDER_TEAM.addAtEnd();
|
|
|
+ remote.setValue("hyworkernum", next.getString("hyworkernum"), 2l);
|
|
|
+ }
|
|
|
+ HYWORKORDER_TEAM.save();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 是否作废 **/
|
|
|
+ public boolean fisvoid() throws P2Exception {
|
|
|
+ return getString("fstatus").equals("作废");
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 是否暂停 **/
|
|
|
+ public boolean fisSuspend() throws P2Exception {
|
|
|
+ return getString("fstatus").equals("暂停");
|
|
|
+ }
|
|
|
}
|