|
|
@@ -22,630 +22,689 @@ import java.util.Vector;
|
|
|
|
|
|
public class workorder extends PaoCust {
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 构造函数
|
|
|
- *
|
|
|
- * @param arg0
|
|
|
- */
|
|
|
- public workorder(PaoSet arg0) {
|
|
|
- super(arg0);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void init() throws P2Exception {
|
|
|
- super.init();
|
|
|
- if(!toBeAdded()){
|
|
|
-
|
|
|
- setFieldFlag(new GetFieldsName(getName()).getFields(), READONLY,true);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void add() throws P2Exception {
|
|
|
- super.add();
|
|
|
- setValue("fworknum", getBillNum("WORKORDER"),11l);
|
|
|
- setValue("fstatus","待开始",11l);
|
|
|
- setValue("progress",0,11l);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void fieldAction(Object paoField, String fieldname) throws P2Exception {
|
|
|
- super.fieldAction(paoField, fieldname);
|
|
|
- if(fieldname.equalsIgnoreCase("templatenum")){
|
|
|
- //新增节点之前先删除原先的节点
|
|
|
- if(!getPaoSet("ORDERNODE").isEmpty()){
|
|
|
- PaoSetRemote ordernode = getPaoSet("ORDERNODE");
|
|
|
- ordernode.deleteAll();
|
|
|
- ordernode.save();
|
|
|
- }
|
|
|
- //新增节点
|
|
|
- PaoSetRemote ordernode = getPaoSet("ORDERNODE");
|
|
|
- PaoSetRemote workordertemplate = getPaoSet("WORKORDERTEMPLATE");
|
|
|
- if(!workordertemplate.isEmpty()){
|
|
|
-
|
|
|
- PaoRemote templatepao = workordertemplate.getPao(0);
|
|
|
- PaoSetRemote templatenode = templatepao.getPaoSet("TEMPLATENODE");
|
|
|
- if(!templatenode.isEmpty()){
|
|
|
-
|
|
|
- int index=0;
|
|
|
- for(int i=0;i<templatenode.count();i++){
|
|
|
- PaoRemote pao = templatenode.getPao(i);
|
|
|
- PaoSetRemote templatenode2 = pao.getPaoSet("TEMPLATENODE2");
|
|
|
- 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);
|
|
|
+ /**
|
|
|
+ * 构造函数
|
|
|
+ *
|
|
|
+ * @param arg0
|
|
|
+ */
|
|
|
+ public workorder(PaoSet arg0) {
|
|
|
+ super(arg0);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void init() throws P2Exception {
|
|
|
+ super.init();
|
|
|
+ if (!toBeAdded()) {
|
|
|
+
|
|
|
+ setFieldFlag(new GetFieldsName(getName()).getFields(), READONLY, true);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void add() throws P2Exception {
|
|
|
+ super.add();
|
|
|
+ setValue("fworknum", getBillNum("WORKORDER"), 11l);
|
|
|
+ setValue("fstatus", "待开始", 11l);
|
|
|
+ setValue("progress", 0, 11l);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void fieldAction(Object paoField, String fieldname) throws P2Exception {
|
|
|
+ super.fieldAction(paoField, fieldname);
|
|
|
+ if (fieldname.equalsIgnoreCase("templatenum")) {
|
|
|
+ // 新增节点之前先删除原先的节点
|
|
|
+ if (!getPaoSet("ORDERNODE").isEmpty()) {
|
|
|
+ PaoSetRemote ordernode = getPaoSet("ORDERNODE");
|
|
|
+ ordernode.deleteAll();
|
|
|
+ ordernode.save();
|
|
|
+ }
|
|
|
+ // 新增节点
|
|
|
+ PaoSetRemote ordernode = getPaoSet("ORDERNODE");
|
|
|
+ PaoSetRemote workordertemplate = getPaoSet("WORKORDERTEMPLATE");
|
|
|
+ if (!workordertemplate.isEmpty()) {
|
|
|
+
|
|
|
+ PaoRemote templatepao = workordertemplate.getPao(0);
|
|
|
+ PaoSetRemote templatenode = templatepao.getPaoSet("TEMPLATENODE");
|
|
|
+ if (!templatenode.isEmpty()) {
|
|
|
+
|
|
|
+ int index = 0;
|
|
|
+ for (int i = 0; i < templatenode.count(); i++) {
|
|
|
+ PaoRemote pao = templatenode.getPao(i);
|
|
|
+ PaoSetRemote templatenode2 = pao.getPaoSet("TEMPLATENODE2");
|
|
|
+ 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("fiscomplete",pao.getString("fiscomplete"),11l);
|
|
|
+ remote.setValue("fisaddtitem", pao.getString("fisaddtitem"), 11l);
|
|
|
+ remote.setValue("fiscomplete", pao.getString("fiscomplete"), 11l);
|
|
|
// remote.setValue("fiscreatecard",pao.getString("fiscreatecard"),11l);
|
|
|
- remote.setValue("fisqualified",pao.getString("fisqualified"),11l);
|
|
|
- remote.setValue("FISSIGNATURE",pao.getString("FISSIGNATURE"),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("fisqualified", pao.getString("fisqualified"), 11l);
|
|
|
+ remote.setValue("FISSIGNATURE", pao.getString("FISSIGNATURE"), 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("fiscomplete",pao.getString("fiscomplete"),11l);
|
|
|
+ remote.setValue("fisaddtitem", pao.getString("fisaddtitem"), 11l);
|
|
|
+ remote.setValue("fiscomplete", pao.getString("fiscomplete"), 11l);
|
|
|
// remote.setValue("fiscreatecard",pao.getString("fiscreatecard"),11l);
|
|
|
- remote.setValue("fisqualified",pao.getString("fisqualified"),11l);
|
|
|
- remote.setValue("FISSIGNATURE",pao.getString("FISSIGNATURE"),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("fisqualified", pao.getString("fisqualified"), 11l);
|
|
|
+ remote.setValue("FISSIGNATURE", pao.getString("FISSIGNATURE"), 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("fiscomplete",templatenode2_pao.getString("fiscomplete"),11l);
|
|
|
+ remote2.setValue("fisaddtitem", templatenode2_pao.getString("fisaddtitem"), 11l);
|
|
|
+ remote2.setValue("fiscomplete", templatenode2_pao.getString("fiscomplete"), 11l);
|
|
|
// remote2.setValue("fiscreatecard",templatenode2_pao.getString("fiscreatecard"),11l);
|
|
|
- remote2.setValue("fisqualified",templatenode2_pao.getString("fisqualified"),11l);
|
|
|
- remote2.setValue("FISSIGNATURE",templatenode2_pao.getString("FISSIGNATURE"),11l);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //ordernode.save();
|
|
|
+ remote2.setValue("fisqualified", templatenode2_pao.getString("fisqualified"), 11l);
|
|
|
+ remote2.setValue("FISSIGNATURE", templatenode2_pao.getString("FISSIGNATURE"), 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);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public void addworktitem(PaoSetRemote paoSet) throws P2Exception {
|
|
|
- Vector<PaoRemote> selection = paoSet.getSelection();
|
|
|
- Iterator<PaoRemote> iterator = selection.iterator();
|
|
|
- PaoSetRemote workorder_titem = getPaoSet("WORKORDER_TITEM");
|
|
|
- System.out.println("addworktitem");
|
|
|
- while(iterator.hasNext()){
|
|
|
- PaoRemote next = iterator.next();
|
|
|
- PaoRemote remote = workorder_titem.addAtEnd();
|
|
|
- remote.setValue("FITEMNO",next.getString("FITEMNO"),11l);
|
|
|
- remote.setValue("FITEMNAME",next.getString("FITEMNAME"),11l);
|
|
|
- remote.setValue("FMODEL",next.getString("FMODEL"),11l);
|
|
|
- remote.setValue("FSPEC",next.getString("FSPEC"),11l);
|
|
|
- }
|
|
|
- workorder_titem.save();
|
|
|
- }
|
|
|
-
|
|
|
- /**工单是否全部确认**/
|
|
|
- public boolean fisAllComplete() throws P2Exception {
|
|
|
- PaoSetRemote ordernode_confirm = P2Server.getP2Server().getPaoSet("ordernode", 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("ordernode", 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 back() throws P2Exception {
|
|
|
- if(!getString("fstatus").equals("进行中"))throw new P2AppException("","该工单不在进行中状态");
|
|
|
- setValue("fstatus","关闭",11l);
|
|
|
- }
|
|
|
- /**完成工单**/
|
|
|
- public void complete(boolean iscreatecard,String hrid) throws Exception {
|
|
|
- if(!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("","还有工序没有确认");
|
|
|
- }else{
|
|
|
- DBConnect dbConnect=new DBConnect();
|
|
|
- /**质保卡生成**/
|
|
|
- PaoSetRemote workordertemplate = getPaoSet("WORKORDERTEMPLATE");
|
|
|
-
|
|
|
- if(!workordertemplate.isEmpty()){
|
|
|
- PaoRemote pao = workordertemplate.getPao(0);
|
|
|
+ } else if (fieldname.equalsIgnoreCase("Installerphone")) {
|
|
|
+ PaoSetRemote installer = getPaoSet("Installer");
|
|
|
+ if (installer.isEmpty())
|
|
|
+ throw new P2AppException("", "该安装人员不存在");
|
|
|
+ setValue("Installer", installer.getPao(0).getString("fname"), 11l);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public void addworktitem(PaoSetRemote paoSet) throws P2Exception {
|
|
|
+ Vector<PaoRemote> selection = paoSet.getSelection();
|
|
|
+ Iterator<PaoRemote> iterator = selection.iterator();
|
|
|
+ PaoSetRemote workorder_titem = getPaoSet("WORKORDER_TITEM");
|
|
|
+ System.out.println("addworktitem");
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ PaoRemote next = iterator.next();
|
|
|
+ PaoRemote remote = workorder_titem.addAtEnd();
|
|
|
+ remote.setValue("FITEMNO", next.getString("FITEMNO"), 11l);
|
|
|
+ remote.setValue("FITEMNAME", next.getString("FITEMNAME"), 11l);
|
|
|
+ remote.setValue("FMODEL", next.getString("FMODEL"), 11l);
|
|
|
+ remote.setValue("FSPEC", next.getString("FSPEC"), 11l);
|
|
|
+ }
|
|
|
+ workorder_titem.save();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 工单是否全部确认 **/
|
|
|
+ public boolean fisAllComplete() throws P2Exception {
|
|
|
+ PaoSetRemote ordernode_confirm = P2Server.getP2Server().getPaoSet("ordernode",
|
|
|
+ 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("ordernode",
|
|
|
+ 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 back() throws P2Exception {
|
|
|
+ if (!getString("fstatus").equals("进行中"))
|
|
|
+ throw new P2AppException("", "该工单不在进行中状态");
|
|
|
+ setValue("fstatus", "关闭", 11l);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 完成工单 **/
|
|
|
+ public void complete(boolean iscreatecard, String hrid) throws Exception {
|
|
|
+ if (!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("", "还有工序没有确认");
|
|
|
+ } else {
|
|
|
+ DBConnect dbConnect = new DBConnect();
|
|
|
+ /** 质保卡生成 **/
|
|
|
+ PaoSetRemote workordertemplate = getPaoSet("WORKORDERTEMPLATE");
|
|
|
+
|
|
|
+ if (!workordertemplate.isEmpty()) {
|
|
|
+ PaoRemote pao = workordertemplate.getPao(0);
|
|
|
// if(pao.getBoolean("fisfillAC")){
|
|
|
// PaoSetRemote AINTEGRALRULE = getPaoSet("AINTEGRALRULE");
|
|
|
// PaoSetRemote CINTEGRALRULE = getPaoSet("CINTEGRALRULE");
|
|
|
// if(AINTEGRALRULE.isEmpty()||CINTEGRALRULE.isEmpty())throw new P2AppException("","请填写项目信息后再提交!");
|
|
|
// }
|
|
|
- if(pao.getBoolean("fiscreatecard")){
|
|
|
- /**判断工序中是否含有不合格的工序,如有,则不生成质保卡**/
|
|
|
- //Rows rows = dbConnect.runSqlQuery("select 1 result from ordernode where fparentid=" + getUniqueIDValue() + " and fisqualified=1 and ischilden=0 and qualified=0");
|
|
|
- if(iscreatecard){
|
|
|
- PaoSetRemote qualitycard = P2Server.getP2Server().getPaoSet("Qualitycard", P2Server.getP2Server().getSystemUserInfo());
|
|
|
- qualitycard.setInsertSite(getSite());
|
|
|
- PaoRemote remote = qualitycard.addAtEnd();
|
|
|
- remote.setValue("fworknum",getString("fworknum"),11l);
|
|
|
- remote.setValue("customername",getString("customername"),11l);
|
|
|
- remote.setValue("customerphone",getString("customephone"),11l);
|
|
|
- Rows rows_dateset = dbConnect.runSqlQuery("select value from PS_DATABIND_LIST where databindid='QUALITYCARDDATE' and siteid='" + getSite() + "'");
|
|
|
- if(!rows_dateset.isEmpty()){
|
|
|
- remote.setValue("Expirationtime",addDate(new Date(),rows_dateset.get(0).getInteger("value")),11l);
|
|
|
- }else{
|
|
|
- remote.setValue("Expirationtime",addDate(new Date(),1),11l);
|
|
|
- }
|
|
|
- remote.setValue("FPROVINCE",getString("FPROVINCE"),11l);
|
|
|
- remote.setValue("FCITY",getString("FCITY"),11l);
|
|
|
- remote.setValue("FCOUNTY",getString("FCOUNTY"),11l);
|
|
|
- remote.setValue("FADDRESS",getString("FADDRESS"),11l);
|
|
|
- PaoSetRemote customer = getPaoSet("CUSTOMER");
|
|
|
- if(!customer.isEmpty()){
|
|
|
- remote.setValue("contacts",customer.getPao(0).getString("contacts"),11l);
|
|
|
- }else{
|
|
|
- remote.setValue("contacts",getString("customername"),11l);
|
|
|
- }
|
|
|
- remote.setValue("Installer",getString("Installer"),11l);
|
|
|
- remote.setValue("Installerphone",getString("Installerphone"),11l);
|
|
|
- PaoSetRemote paoSet = getPaoSet("$worker", "worker", "workphone='" + hrid + "'");
|
|
|
- if(!paoSet.isEmpty()){
|
|
|
- remote.setValue("CREATEBY",paoSet.getPao(0).getString("FNAME"),11l);
|
|
|
- }
|
|
|
- qualitycard.save();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- /**判断预约单是否可以完成**/
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
- /**积分规则计算**/
|
|
|
- ACcalculation(workordertemplate);
|
|
|
-
|
|
|
-
|
|
|
- /**给经销商发送消息**/
|
|
|
- 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("$worker", "worker", "workphone='" + hrid + "'");
|
|
|
- if(!paoSet1.isEmpty()){
|
|
|
- setValue("Acceptby",paoSet1.getPao(0).getString("FNAME"),11l);
|
|
|
- }
|
|
|
- setValue("fstatus","已完成",11l);
|
|
|
- }
|
|
|
- }
|
|
|
- /**创建积分变动**/
|
|
|
- private void createintegralchange(String ftype,int result_cunt,String phone,String name,String type,int fvalue,int kitchen,int toilet,int balcony,int result) throws P2Exception {
|
|
|
- PaoSetRemote personnelset = P2Server.getP2Server().getPaoSet("personnel", P2Server.getP2Server().getSystemUserInfo());
|
|
|
- personnelset.setInsertSite(getSite());
|
|
|
- personnelset.setWhere("customerphone='"+phone+"'");
|
|
|
- personnelset.reset();
|
|
|
- PaoRemote pao=null;
|
|
|
- if(!personnelset.isEmpty()){
|
|
|
- pao= personnelset.getPao(0);
|
|
|
- PaoSetRemote integralchange = pao.getPaoSet("integralchange");
|
|
|
- PaoRemote remote = integralchange.addAtEnd();
|
|
|
- remote.setValue("ftype",ftype,11l);
|
|
|
- remote.setValue("changevalue",result_cunt,11l);
|
|
|
- remote.setValue("valuetotal",result_cunt+(ftype.equals("A积分")?pao.getInt("Aintegral"):pao.getInt("Cintegral")),11l);
|
|
|
- String reason="工单奖励,工单来源:"+getString("fworknum")+",规则:"+type+",";
|
|
|
- if(type.equals("管材")||type.equals("丝扣嵌件")){
|
|
|
- reason+="数量:"+fvalue+",积分:"+result;
|
|
|
- }else{
|
|
|
- reason+="厨房数:"+kitchen+",卫生间数:"+balcony+",阳台数:"+toilet+",积分:"+result;
|
|
|
- }
|
|
|
- remote.setValue("Reason",reason,11l);
|
|
|
- remote.setValue("customerphone",phone,11l);
|
|
|
- personnelset.save();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- 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(); // 将毫秒数转换成日期
|
|
|
-
|
|
|
- }
|
|
|
- /**获取经销商积分规则**/
|
|
|
- public PaoRemote getTagentIntegralruleType(String ftype) throws P2Exception {
|
|
|
- PaoSetRemote tagents = P2Server.getP2Server().getPaoSet("TAGENTS", P2Server.getP2Server().getSystemUserInfo());
|
|
|
- tagents.setWhere("fagentnum='"+getString("fagentnum")+"'");
|
|
|
- tagents.reset();
|
|
|
- if(!tagents.isEmpty()){
|
|
|
- PaoRemote tagentsPao = tagents.getPao(0);
|
|
|
- PaoSetRemote integralrule = tagentsPao.getPaoSet("Integralrule");
|
|
|
- integralrule.setWhere("ftype='"+ftype+"'");
|
|
|
- integralrule.reset();
|
|
|
- if(!integralrule.isEmpty()){
|
|
|
- PaoRemote pao = integralrule.getPao(0);
|
|
|
- return pao;
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
- /**开始工单**/
|
|
|
- public void start() throws P2Exception {
|
|
|
- if(!getString("fstatus").equals("待开始"))throw new P2AppException("","该工单不在待开始状态");
|
|
|
- setValue("startdate",new Date(),11l);
|
|
|
- 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);
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- /**创建积分人员**/
|
|
|
- public void createpersonal(String fname,String phone) throws P2Exception {
|
|
|
- PaoSetRemote personnel2 = P2Server.getP2Server().getPaoSet("personnel", P2Server.getP2Server().getSystemUserInfo());
|
|
|
- personnel2.setInsertSite(getSite());
|
|
|
- personnel2.setWhere("customerphone='" +phone + "'");
|
|
|
- personnel2.reset();
|
|
|
- if(personnel2.isEmpty()){
|
|
|
- PaoRemote remote = personnel2.addAtEnd();
|
|
|
- remote.setValue("customername", fname, 11l);
|
|
|
- remote.setValue("customerphone",phone, 11l);
|
|
|
- remote.setValue("FAGENTNUM", getString("fagentnum"), 11l);
|
|
|
- personnel2.save();
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public Row getCompleteAndTotal() throws P2Exception {
|
|
|
- DBConnect dbConnect=new DBConnect();
|
|
|
- Rows rows = dbConnect.runSqlQuery("select isnull((select count(1) from ordernode where fparentid=" + getInt("workorderid") + " and ischilden=0),0)count,\n" +
|
|
|
- "isnull((select count(1) from ordernode where fparentid=" + getInt("workorderid") + " and ischilden=0 and isconfirm=1),0)complete");
|
|
|
- return rows.get(0);
|
|
|
- }
|
|
|
- /**作废**/
|
|
|
- public void toVoid(String returnreason) throws P2Exception {
|
|
|
- if(!getString("fstatus").equals("进行中")&&!getString("fstatus").equals("待开始")&&!getString("fstatus").equals("暂停"))throw new P2AppException("","该工单不在进行中或待开始状态");
|
|
|
- setValue("fstatus","作废",11l);
|
|
|
- setValue("returnreason",returnreason,11l);
|
|
|
- PaoSetRemote serviceform = getPaoSet("SERVICEFORM");
|
|
|
- if(!serviceform.isEmpty()){
|
|
|
- serviceform.getPao(0).setValue("fstatus","待处理",11l);
|
|
|
- }
|
|
|
- /**发送消息**/
|
|
|
- PaoSetRemote workorder_team = getPaoSet("WORKORDER_TEAM");
|
|
|
- if(!workorder_team.isEmpty()){
|
|
|
- PaoSetRemote workermassage = P2Server.getP2Server().getPaoSet("workermassage", P2Server.getP2Server().getSystemUserInfo());
|
|
|
- for(int i=0;i<workorder_team.count();i++){
|
|
|
- String workephone = workorder_team.getPao(i).getString("workephone");
|
|
|
-
|
|
|
- workermassage.setInsertSite(getSite());
|
|
|
- PaoRemote remote = workermassage.addAtEnd();
|
|
|
- remote.setValue("ftype","系统消息",11l);
|
|
|
- remote.setValue("title","您有一个"+getString("ftype")+"单:"+getString("fworknum")+"已作废",11l);
|
|
|
- remote.setValue("content","您有一个"+getString("ftype")+"单:"+getString("fworknum")+"已作废",11l);
|
|
|
- remote.setValue("phone",workephone,11l);
|
|
|
- remote.setValue("fworknum",getString("fworknum"),11l);
|
|
|
-
|
|
|
- }
|
|
|
- workermassage.save();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- /**启用**/
|
|
|
- public void toUsed() throws P2Exception {
|
|
|
-
|
|
|
- if(!getString("fstatus").equals("暂停"))throw new P2AppException("","该工单不在暂停中状态");
|
|
|
- setValue("fstatus","进行中",11l);
|
|
|
- PaoSetRemote workorder_team = getPaoSet("WORKORDER_TEAM");
|
|
|
- if(!workorder_team.isEmpty()){
|
|
|
- PaoSetRemote workermassage = P2Server.getP2Server().getPaoSet("workermassage", P2Server.getP2Server().getSystemUserInfo());
|
|
|
- for(int i=0;i<workorder_team.count();i++){
|
|
|
- String workephone = workorder_team.getPao(i).getString("workephone");
|
|
|
- workermassage.setInsertSite(getSite());
|
|
|
- PaoRemote remote = workermassage.addAtEnd();
|
|
|
- remote.setValue("ftype","跳转消息",11l);
|
|
|
- remote.setValue("title","您有一个"+getString("ftype")+"单:"+getString("fworknum")+"已启用",11l);
|
|
|
- remote.setValue("content","您有一个"+getString("ftype")+"单:"+getString("fworknum")+"已启用",11l);
|
|
|
- remote.setValue("phone",workephone,11l);
|
|
|
- remote.setValue("fworknum",getString("fworknum"),11l);
|
|
|
- }
|
|
|
- workermassage.save();
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- /**暂停**/
|
|
|
- public void toSuspend() throws P2Exception {
|
|
|
- if(!getString("fstatus").equals("进行中"))throw new P2AppException("","该工单不在进行中状态");
|
|
|
- setValue("fstatus","暂停",11l);
|
|
|
- /**推送消息**/
|
|
|
- PaoSetRemote workorder_team = getPaoSet("WORKORDER_TEAM");
|
|
|
- if(!workorder_team.isEmpty()){
|
|
|
- PaoSetRemote workermassage = P2Server.getP2Server().getPaoSet("workermassage", P2Server.getP2Server().getSystemUserInfo());
|
|
|
- for(int i=0;i<workorder_team.count();i++){
|
|
|
- String workephone = workorder_team.getPao(i).getString("workephone");
|
|
|
-
|
|
|
- workermassage.setInsertSite(getSite());
|
|
|
- PaoRemote remote = workermassage.addAtEnd();
|
|
|
- remote.setValue("ftype","系统消息",11l);
|
|
|
- remote.setValue("title","您有一个"+getString("ftype")+"单:"+getString("fworknum")+"已暂停",11l);
|
|
|
- remote.setValue("content","您有一个"+getString("ftype")+"单:"+getString("fworknum")+"已暂停",11l);
|
|
|
- remote.setValue("phone",workephone,11l);
|
|
|
- remote.setValue("fworknum",getString("fworknum"),11l);
|
|
|
- }
|
|
|
- workermassage.save();
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- /**是否暂停**/
|
|
|
- public boolean fisSuspend() throws P2Exception {
|
|
|
- return getString("fstatus").equals("暂停");
|
|
|
- }
|
|
|
- /**是否作废**/
|
|
|
- public boolean fisvoid()throws P2Exception {
|
|
|
- return getString("fstatus").equals("作废");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**生成质保卡**/
|
|
|
- public void createQualitycard(String hrid) throws Exception {
|
|
|
-
|
|
|
- if(!getString("fstatus").equals("已完成")&&!getString("fstatus").equals("进行中")&&!getString("fstatus").equals("质保卡审批"))throw new P2AppException("","非进行或完成状态不可生成质保卡");
|
|
|
- if(getString("fstatus").equals("进行中")||getString("fstatus").equals("质保卡审批")){
|
|
|
- completeformback(hrid);
|
|
|
- }
|
|
|
- PaoSetRemote qualitycard_set = getPaoSet("QUALITYCARD");
|
|
|
- if(!qualitycard_set.isEmpty())throw new P2AppException("","该质保卡已经生成");
|
|
|
- DBConnect dbConnect=new DBConnect();
|
|
|
- PaoSetRemote qualitycard = P2Server.getP2Server().getPaoSet("Qualitycard", P2Server.getP2Server().getSystemUserInfo());
|
|
|
- qualitycard.setInsertSite(getSite());
|
|
|
- PaoRemote remote = qualitycard.addAtEnd();
|
|
|
- remote.setValue("fworknum",getString("fworknum"),11l);
|
|
|
- remote.setValue("customername",getString("customername"),11l);
|
|
|
- remote.setValue("customerphone",getString("customephone"),11l);
|
|
|
- Rows rows_dateset = dbConnect.runSqlQuery("select value from PS_DATABIND_LIST where databindid='QUALITYCARDDATE' and siteid='" + getSite() + "'");
|
|
|
- if(!rows_dateset.isEmpty()){
|
|
|
- remote.setValue("Expirationtime",addDate(new Date(),rows_dateset.get(0).getInteger("value")),11l);
|
|
|
- }else{
|
|
|
- remote.setValue("Expirationtime",addDate(new Date(),1),11l);
|
|
|
- }
|
|
|
- remote.setValue("FPROVINCE",getString("FPROVINCE"),11l);
|
|
|
- remote.setValue("FCITY",getString("FCITY"),11l);
|
|
|
- remote.setValue("FCOUNTY",getString("FCOUNTY"),11l);
|
|
|
- remote.setValue("FADDRESS",getString("FADDRESS"),11l);
|
|
|
- PaoSetRemote customer = getPaoSet("CUSTOMER");
|
|
|
- if(!customer.isEmpty()){
|
|
|
- remote.setValue("contacts",customer.getPao(0).getString("contacts"),11l);
|
|
|
- }else{
|
|
|
- remote.setValue("contacts",getString("customername"),11l);
|
|
|
- }
|
|
|
- remote.setValue("Installer",getString("Installer"),11l);
|
|
|
- remote.setValue("Installerphone",getString("Installerphone"),11l);
|
|
|
- remote.setValue("CREATEBY",hrid,11l);
|
|
|
- qualitycard.save();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**后端完成工单**/
|
|
|
- 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("", "还有工序没有确认");
|
|
|
- }
|
|
|
+ if (pao.getBoolean("fiscreatecard")) {
|
|
|
+ /** 判断工序中是否含有不合格的工序,如有,则不生成质保卡 **/
|
|
|
+ // Rows rows = dbConnect.runSqlQuery("select 1 result from ordernode where
|
|
|
+ // fparentid=" + getUniqueIDValue() + " and fisqualified=1 and ischilden=0 and
|
|
|
+ // qualified=0");
|
|
|
+ if (iscreatecard) {
|
|
|
+ PaoSetRemote qualitycard = P2Server.getP2Server().getPaoSet("Qualitycard",
|
|
|
+ P2Server.getP2Server().getSystemUserInfo());
|
|
|
+ qualitycard.setInsertSite(getSite());
|
|
|
+ PaoRemote remote = qualitycard.addAtEnd();
|
|
|
+ remote.setValue("fworknum", getString("fworknum"), 11l);
|
|
|
+ remote.setValue("customername", getString("customername"), 11l);
|
|
|
+ remote.setValue("customerphone", getString("customephone"), 11l);
|
|
|
+ Rows rows_dateset = dbConnect.runSqlQuery(
|
|
|
+ "select value from PS_DATABIND_LIST where databindid='QUALITYCARDDATE' and siteid='"
|
|
|
+ + getSite() + "'");
|
|
|
+ if (!rows_dateset.isEmpty()) {
|
|
|
+ remote.setValue("Expirationtime",
|
|
|
+ addDate(new Date(), rows_dateset.get(0).getInteger("value")), 11l);
|
|
|
+ } else {
|
|
|
+ remote.setValue("Expirationtime", addDate(new Date(), 1), 11l);
|
|
|
+ }
|
|
|
+ remote.setValue("FPROVINCE", getString("FPROVINCE"), 11l);
|
|
|
+ remote.setValue("FCITY", getString("FCITY"), 11l);
|
|
|
+ remote.setValue("FCOUNTY", getString("FCOUNTY"), 11l);
|
|
|
+ remote.setValue("FADDRESS", getString("FADDRESS"), 11l);
|
|
|
+ PaoSetRemote customer = getPaoSet("CUSTOMER");
|
|
|
+ if (!customer.isEmpty()) {
|
|
|
+ remote.setValue("contacts", customer.getPao(0).getString("contacts"), 11l);
|
|
|
+ } else {
|
|
|
+ remote.setValue("contacts", getString("customername"), 11l);
|
|
|
+ }
|
|
|
+ remote.setValue("Installer", getString("Installer"), 11l);
|
|
|
+ remote.setValue("Installerphone", getString("Installerphone"), 11l);
|
|
|
+ PaoSetRemote paoSet = getPaoSet("$worker", "worker", "workphone='" + hrid + "'");
|
|
|
+ if (!paoSet.isEmpty()) {
|
|
|
+ remote.setValue("CREATEBY", paoSet.getPao(0).getString("FNAME"), 11l);
|
|
|
+ }
|
|
|
+ qualitycard.save();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /** 判断预约单是否可以完成 **/
|
|
|
+ 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) {
|
|
|
+ if (getString("ftype") != null && getString("ftype").length() != 0
|
|
|
+ && getString("ftype").equals("施工")) {
|
|
|
+ serviceformPao.setValue("fstatus", "待验收", 11l);
|
|
|
+ } else {
|
|
|
+ serviceformPao.setValue("fstatus", "已完成", 11l);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /** 积分规则计算 **/
|
|
|
+ ACcalculation(workordertemplate);
|
|
|
+
|
|
|
+ /** 给经销商发送消息 **/
|
|
|
+ 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("$worker", "worker", "workphone='" + hrid + "'");
|
|
|
+ if (!paoSet1.isEmpty()) {
|
|
|
+ setValue("Acceptby", paoSet1.getPao(0).getString("FNAME"), 11l);
|
|
|
+ }
|
|
|
+ setValue("fstatus", "已完成", 11l);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 创建积分变动 **/
|
|
|
+ private void createintegralchange(String ftype, int result_cunt, String phone, String name, String type, int fvalue,
|
|
|
+ int kitchen, int toilet, int balcony, int result) throws P2Exception {
|
|
|
+ PaoSetRemote personnelset = P2Server.getP2Server().getPaoSet("personnel",
|
|
|
+ P2Server.getP2Server().getSystemUserInfo());
|
|
|
+ personnelset.setInsertSite(getSite());
|
|
|
+ personnelset.setWhere("customerphone='" + phone + "'");
|
|
|
+ personnelset.reset();
|
|
|
+ PaoRemote pao = null;
|
|
|
+ if (!personnelset.isEmpty()) {
|
|
|
+ pao = personnelset.getPao(0);
|
|
|
+ PaoSetRemote integralchange = pao.getPaoSet("integralchange");
|
|
|
+ PaoRemote remote = integralchange.addAtEnd();
|
|
|
+ remote.setValue("ftype", ftype, 11l);
|
|
|
+ remote.setValue("changevalue", result_cunt, 11l);
|
|
|
+ remote.setValue("valuetotal",
|
|
|
+ result_cunt + (ftype.equals("A积分") ? pao.getInt("Aintegral") : pao.getInt("Cintegral")), 11l);
|
|
|
+ String reason = "工单奖励,工单来源:" + getString("fworknum") + ",规则:" + type + ",";
|
|
|
+ if (type.equals("管材") || type.equals("丝扣嵌件")) {
|
|
|
+ reason += "数量:" + fvalue + ",积分:" + result;
|
|
|
+ } else {
|
|
|
+ reason += "厨房数:" + kitchen + ",卫生间数:" + balcony + ",阳台数:" + toilet + ",积分:" + result;
|
|
|
+ }
|
|
|
+ remote.setValue("Reason", reason, 11l);
|
|
|
+ remote.setValue("customerphone", phone, 11l);
|
|
|
+ personnelset.save();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ 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(); // 将毫秒数转换成日期
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 获取经销商积分规则 **/
|
|
|
+ public PaoRemote getTagentIntegralruleType(String ftype) throws P2Exception {
|
|
|
+ PaoSetRemote tagents = P2Server.getP2Server().getPaoSet("TAGENTS", P2Server.getP2Server().getSystemUserInfo());
|
|
|
+ tagents.setWhere("fagentnum='" + getString("fagentnum") + "'");
|
|
|
+ tagents.reset();
|
|
|
+ if (!tagents.isEmpty()) {
|
|
|
+ PaoRemote tagentsPao = tagents.getPao(0);
|
|
|
+ PaoSetRemote integralrule = tagentsPao.getPaoSet("Integralrule");
|
|
|
+ integralrule.setWhere("ftype='" + ftype + "'");
|
|
|
+ integralrule.reset();
|
|
|
+ if (!integralrule.isEmpty()) {
|
|
|
+ PaoRemote pao = integralrule.getPao(0);
|
|
|
+ return pao;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 开始工单 **/
|
|
|
+ public void start() throws P2Exception {
|
|
|
+ if (!getString("fstatus").equals("待开始"))
|
|
|
+ throw new P2AppException("", "该工单不在待开始状态");
|
|
|
+ setValue("startdate", new Date(), 11l);
|
|
|
+ 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);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 创建积分人员 **/
|
|
|
+ public void createpersonal(String fname, String phone) throws P2Exception {
|
|
|
+ PaoSetRemote personnel2 = P2Server.getP2Server().getPaoSet("personnel",
|
|
|
+ P2Server.getP2Server().getSystemUserInfo());
|
|
|
+ personnel2.setInsertSite(getSite());
|
|
|
+ personnel2.setWhere("customerphone='" + phone + "'");
|
|
|
+ personnel2.reset();
|
|
|
+ if (personnel2.isEmpty()) {
|
|
|
+ PaoRemote remote = personnel2.addAtEnd();
|
|
|
+ remote.setValue("customername", fname, 11l);
|
|
|
+ remote.setValue("customerphone", phone, 11l);
|
|
|
+ remote.setValue("FAGENTNUM", getString("fagentnum"), 11l);
|
|
|
+ personnel2.save();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public Row getCompleteAndTotal() throws P2Exception {
|
|
|
+ DBConnect dbConnect = new DBConnect();
|
|
|
+ Rows rows = dbConnect
|
|
|
+ .runSqlQuery("select isnull((select count(1) from ordernode where fparentid=" + getInt("workorderid")
|
|
|
+ + " and ischilden=0),0)count,\n" + "isnull((select count(1) from ordernode where fparentid="
|
|
|
+ + getInt("workorderid") + " and ischilden=0 and isconfirm=1),0)complete");
|
|
|
+ return rows.get(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 作废 **/
|
|
|
+ public void toVoid(String returnreason) throws P2Exception {
|
|
|
+ if (!getString("fstatus").equals("进行中") && !getString("fstatus").equals("待开始")
|
|
|
+ && !getString("fstatus").equals("暂停"))
|
|
|
+ throw new P2AppException("", "该工单不在进行中或待开始状态");
|
|
|
+ setValue("fstatus", "作废", 11l);
|
|
|
+ setValue("returnreason", returnreason, 11l);
|
|
|
+ PaoSetRemote serviceform = getPaoSet("SERVICEFORM");
|
|
|
+ if (!serviceform.isEmpty()) {
|
|
|
+ serviceform.getPao(0).setValue("fstatus", "待处理", 11l);
|
|
|
+ }
|
|
|
+ /** 发送消息 **/
|
|
|
+ PaoSetRemote workorder_team = getPaoSet("WORKORDER_TEAM");
|
|
|
+ if (!workorder_team.isEmpty()) {
|
|
|
+ PaoSetRemote workermassage = P2Server.getP2Server().getPaoSet("workermassage",
|
|
|
+ P2Server.getP2Server().getSystemUserInfo());
|
|
|
+ for (int i = 0; i < workorder_team.count(); i++) {
|
|
|
+ String workephone = workorder_team.getPao(i).getString("workephone");
|
|
|
+
|
|
|
+ workermassage.setInsertSite(getSite());
|
|
|
+ PaoRemote remote = workermassage.addAtEnd();
|
|
|
+ remote.setValue("ftype", "系统消息", 11l);
|
|
|
+ remote.setValue("title", "您有一个" + getString("ftype") + "单:" + getString("fworknum") + "已作废", 11l);
|
|
|
+ remote.setValue("content", "您有一个" + getString("ftype") + "单:" + getString("fworknum") + "已作废", 11l);
|
|
|
+ remote.setValue("phone", workephone, 11l);
|
|
|
+ remote.setValue("fworknum", getString("fworknum"), 11l);
|
|
|
+
|
|
|
+ }
|
|
|
+ workermassage.save();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 启用 **/
|
|
|
+ public void toUsed() throws P2Exception {
|
|
|
+
|
|
|
+ if (!getString("fstatus").equals("暂停"))
|
|
|
+ throw new P2AppException("", "该工单不在暂停中状态");
|
|
|
+ setValue("fstatus", "进行中", 11l);
|
|
|
+ PaoSetRemote workorder_team = getPaoSet("WORKORDER_TEAM");
|
|
|
+ if (!workorder_team.isEmpty()) {
|
|
|
+ PaoSetRemote workermassage = P2Server.getP2Server().getPaoSet("workermassage",
|
|
|
+ P2Server.getP2Server().getSystemUserInfo());
|
|
|
+ for (int i = 0; i < workorder_team.count(); i++) {
|
|
|
+ String workephone = workorder_team.getPao(i).getString("workephone");
|
|
|
+ workermassage.setInsertSite(getSite());
|
|
|
+ PaoRemote remote = workermassage.addAtEnd();
|
|
|
+ remote.setValue("ftype", "跳转消息", 11l);
|
|
|
+ remote.setValue("title", "您有一个" + getString("ftype") + "单:" + getString("fworknum") + "已启用", 11l);
|
|
|
+ remote.setValue("content", "您有一个" + getString("ftype") + "单:" + getString("fworknum") + "已启用", 11l);
|
|
|
+ remote.setValue("phone", workephone, 11l);
|
|
|
+ remote.setValue("fworknum", getString("fworknum"), 11l);
|
|
|
+ }
|
|
|
+ workermassage.save();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 暂停 **/
|
|
|
+ public void toSuspend() throws P2Exception {
|
|
|
+ if (!getString("fstatus").equals("进行中"))
|
|
|
+ throw new P2AppException("", "该工单不在进行中状态");
|
|
|
+ setValue("fstatus", "暂停", 11l);
|
|
|
+ /** 推送消息 **/
|
|
|
+ PaoSetRemote workorder_team = getPaoSet("WORKORDER_TEAM");
|
|
|
+ if (!workorder_team.isEmpty()) {
|
|
|
+ PaoSetRemote workermassage = P2Server.getP2Server().getPaoSet("workermassage",
|
|
|
+ P2Server.getP2Server().getSystemUserInfo());
|
|
|
+ for (int i = 0; i < workorder_team.count(); i++) {
|
|
|
+ String workephone = workorder_team.getPao(i).getString("workephone");
|
|
|
+
|
|
|
+ workermassage.setInsertSite(getSite());
|
|
|
+ PaoRemote remote = workermassage.addAtEnd();
|
|
|
+ remote.setValue("ftype", "系统消息", 11l);
|
|
|
+ remote.setValue("title", "您有一个" + getString("ftype") + "单:" + getString("fworknum") + "已暂停", 11l);
|
|
|
+ remote.setValue("content", "您有一个" + getString("ftype") + "单:" + getString("fworknum") + "已暂停", 11l);
|
|
|
+ remote.setValue("phone", workephone, 11l);
|
|
|
+ remote.setValue("fworknum", getString("fworknum"), 11l);
|
|
|
+ }
|
|
|
+ workermassage.save();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 是否暂停 **/
|
|
|
+ public boolean fisSuspend() throws P2Exception {
|
|
|
+ return getString("fstatus").equals("暂停");
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 是否作废 **/
|
|
|
+ public boolean fisvoid() throws P2Exception {
|
|
|
+ return getString("fstatus").equals("作废");
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 生成质保卡 **/
|
|
|
+ public void createQualitycard(String hrid) throws Exception {
|
|
|
+
|
|
|
+ if (!getString("fstatus").equals("已完成") && !getString("fstatus").equals("进行中")
|
|
|
+ && !getString("fstatus").equals("质保卡审批"))
|
|
|
+ throw new P2AppException("", "非进行或完成状态不可生成质保卡");
|
|
|
+ if (getString("fstatus").equals("进行中") || getString("fstatus").equals("质保卡审批")) {
|
|
|
+ completeformback(hrid);
|
|
|
+ }
|
|
|
+ PaoSetRemote qualitycard_set = getPaoSet("QUALITYCARD");
|
|
|
+ if (!qualitycard_set.isEmpty())
|
|
|
+ throw new P2AppException("", "该质保卡已经生成");
|
|
|
+ DBConnect dbConnect = new DBConnect();
|
|
|
+ PaoSetRemote qualitycard = P2Server.getP2Server().getPaoSet("Qualitycard",
|
|
|
+ P2Server.getP2Server().getSystemUserInfo());
|
|
|
+ qualitycard.setInsertSite(getSite());
|
|
|
+ PaoRemote remote = qualitycard.addAtEnd();
|
|
|
+ remote.setValue("fworknum", getString("fworknum"), 11l);
|
|
|
+ remote.setValue("customername", getString("customername"), 11l);
|
|
|
+ remote.setValue("customerphone", getString("customephone"), 11l);
|
|
|
+ Rows rows_dateset = dbConnect.runSqlQuery(
|
|
|
+ "select value from PS_DATABIND_LIST where databindid='QUALITYCARDDATE' and siteid='" + getSite() + "'");
|
|
|
+ if (!rows_dateset.isEmpty()) {
|
|
|
+ remote.setValue("Expirationtime", addDate(new Date(), rows_dateset.get(0).getInteger("value")), 11l);
|
|
|
+ } else {
|
|
|
+ remote.setValue("Expirationtime", addDate(new Date(), 1), 11l);
|
|
|
+ }
|
|
|
+ remote.setValue("FPROVINCE", getString("FPROVINCE"), 11l);
|
|
|
+ remote.setValue("FCITY", getString("FCITY"), 11l);
|
|
|
+ remote.setValue("FCOUNTY", getString("FCOUNTY"), 11l);
|
|
|
+ remote.setValue("FADDRESS", getString("FADDRESS"), 11l);
|
|
|
+ PaoSetRemote customer = getPaoSet("CUSTOMER");
|
|
|
+ if (!customer.isEmpty()) {
|
|
|
+ remote.setValue("contacts", customer.getPao(0).getString("contacts"), 11l);
|
|
|
+ } else {
|
|
|
+ remote.setValue("contacts", getString("customername"), 11l);
|
|
|
+ }
|
|
|
+ remote.setValue("Installer", getString("Installer"), 11l);
|
|
|
+ remote.setValue("Installerphone", getString("Installerphone"), 11l);
|
|
|
+ remote.setValue("CREATEBY", hrid, 11l);
|
|
|
+ qualitycard.save();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 后端完成工单 **/
|
|
|
+ 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);
|
|
|
- }
|
|
|
- }
|
|
|
- /**积分规则计算**/
|
|
|
- ACcalculation(workordertemplate);
|
|
|
-
|
|
|
- /**给经销商发送消息**/
|
|
|
- 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);
|
|
|
- }
|
|
|
-
|
|
|
- /**AC积分计算**/
|
|
|
- public void ACcalculation(PaoSetRemote workordertemplate) throws P2Exception {
|
|
|
- /**积分规则计算**/
|
|
|
- if(!workordertemplate.isEmpty()&&workordertemplate.getPao(0).getBoolean("fisfillAC")) {
|
|
|
- PaoSetRemote aintegralrule = getPaoSet("AINTEGRALRULE");
|
|
|
- PaoSetRemote cintegralrule = getPaoSet("CINTEGRALRULE");
|
|
|
- /**A积分设置**/
|
|
|
- if (!aintegralrule.isEmpty()) {
|
|
|
- PaoRemote pao = aintegralrule.getPao(0);
|
|
|
- if(!pao.isNull("phone")){
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- String calculationrules = pao.getString("CALCULATIONRULES");
|
|
|
- PaoRemote AtagentIntegralruleType = getTagentIntegralruleType("A积分");
|
|
|
- if (calculationrules.equals("管材")) {
|
|
|
- if(AtagentIntegralruleType!=null&&!AtagentIntegralruleType.isNull("fvalue")&&AtagentIntegralruleType.getInt("fvalue")!=0) {
|
|
|
- int result_cunt = AtagentIntegralruleType == null ? 0 : AtagentIntegralruleType.getInt("fvalue") * pao.getInt("fvalue");
|
|
|
-
|
|
|
- if(result_cunt!=0&&!pao.isNull("phone")&&!pao.isNull("fname")){
|
|
|
- createpersonal(pao.getString("fname"),pao.getString("phone"));
|
|
|
- createintegralchange("A积分", result_cunt, pao.getString("phone"), pao.getString("fname"), calculationrules, pao.getInt("fvalue"), 0, 0, 0, result_cunt);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- if(calculationrules.equals("丝扣嵌件")){
|
|
|
- if(AtagentIntegralruleType!=null&&!AtagentIntegralruleType.isNull("fvalue2")&&AtagentIntegralruleType.getInt("fvalue2")!=0) {
|
|
|
- int result_cunt = AtagentIntegralruleType == null ? 0 : AtagentIntegralruleType.getInt("fvalue2") * pao.getInt("fvalue");
|
|
|
- if(result_cunt!=0&&!pao.isNull("phone")&&!pao.isNull("fname")){
|
|
|
- createpersonal(pao.getString("fname"),pao.getString("phone"));
|
|
|
- createintegralchange("A积分", result_cunt, pao.getString("phone"), pao.getString("fname"), calculationrules, pao.getInt("fvalue"), 0, 0, 0, result_cunt);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- if (calculationrules.equals("户型")) {
|
|
|
- if(AtagentIntegralruleType!=null) {
|
|
|
- Integer kitchen = pao.getInt("kitchen");
|
|
|
- Integer toilet = pao.getInt("toilet");
|
|
|
- Integer balcony = pao.getInt("balcony");
|
|
|
- int result_cunt = 0;
|
|
|
- result_cunt = kitchen * AtagentIntegralruleType.getInt("kitchen") + toilet * AtagentIntegralruleType.getInt("toilet") + balcony * AtagentIntegralruleType.getInt("balcony");
|
|
|
- if(result_cunt!=0&&!pao.isNull("phone")&&!pao.isNull("fname")){
|
|
|
- createpersonal(pao.getString("fname"),pao.getString("phone"));
|
|
|
- createintegralchange("A积分", result_cunt, pao.getString("phone"), pao.getString("fname"), calculationrules, 0, kitchen, toilet, balcony, result_cunt);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- /**C积分设置**/
|
|
|
-
|
|
|
- if (!cintegralrule.isEmpty()) {
|
|
|
- PaoRemote pao = cintegralrule.getPao(0);
|
|
|
- String calculationrules = pao.getString("CALCULATIONRULES");
|
|
|
- PaoRemote CtagentIntegralruleType = getTagentIntegralruleType("C积分");
|
|
|
- if(!pao.isNull("phone")) {
|
|
|
- if (calculationrules.equals("管材")) {
|
|
|
- if(CtagentIntegralruleType!=null&&!CtagentIntegralruleType.isNull("fvalue")&&CtagentIntegralruleType.getInt("fvalue")!=0) {
|
|
|
- int result_cunt = CtagentIntegralruleType == null ? 0 : CtagentIntegralruleType.getInt("fvalue") * pao.getInt("fvalue");
|
|
|
- if(result_cunt!=0&&!pao.isNull("phone")&&!pao.isNull("fname")){
|
|
|
- createpersonal(pao.getString("fname"),pao.getString("phone"));
|
|
|
- createintegralchange("C积分", result_cunt, pao.getString("phone"), pao.getString("fname"), calculationrules, pao.getInt("fvalue"), 0, 0, 0, result_cunt);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- if (calculationrules.equals("丝扣嵌件")) {
|
|
|
- if(CtagentIntegralruleType!=null&&!CtagentIntegralruleType.isNull("fvalue2")&&CtagentIntegralruleType.getInt("fvalue2")!=0) {
|
|
|
- int result_cunt = CtagentIntegralruleType == null ? 0 : CtagentIntegralruleType.getInt("fvalue2") * pao.getInt("fvalue");
|
|
|
- if(result_cunt!=0&&!pao.isNull("phone")&&!pao.isNull("fname")){
|
|
|
- createpersonal(pao.getString("fname"),pao.getString("phone"));
|
|
|
- createintegralchange("C积分", result_cunt, pao.getString("phone"), pao.getString("fname"), calculationrules, pao.getInt("fvalue"), 0, 0, 0, result_cunt);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- if (calculationrules.equals("户型")) {
|
|
|
- if(CtagentIntegralruleType!=null) {
|
|
|
- Integer kitchen = pao.getInt("kitchen");
|
|
|
- Integer toilet = pao.getInt("toilet");
|
|
|
- Integer balcony = pao.getInt("balcony");
|
|
|
- int result_cunt = 0;
|
|
|
- if (CtagentIntegralruleType != null) {
|
|
|
- result_cunt = kitchen * CtagentIntegralruleType.getInt("kitchen") + toilet * CtagentIntegralruleType.getInt("toilet") + balcony * CtagentIntegralruleType.getInt("balcony");
|
|
|
- if(result_cunt!=0&&!pao.isNull("phone")&&!pao.isNull("fname")){
|
|
|
- createpersonal(pao.getString("fname"),pao.getString("phone"));
|
|
|
- createintegralchange("C积分", result_cunt, pao.getString("phone"), pao.getString("fname"), calculationrules, 0, kitchen, toilet, balcony, result_cunt);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**拒绝**/
|
|
|
- public void refuse() throws P2Exception {
|
|
|
- if(!getString("fstatus").equals("质保卡审批"))throw new P2AppException("","非质保卡审批状态无法拒绝");
|
|
|
- setValue("fstatus","进行中",11l);
|
|
|
- }
|
|
|
+ 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) {
|
|
|
+ if (getString("ftype") != null && getString("ftype").length() != 0 && getString("ftype").equals("施工")) {
|
|
|
+ serviceformPao.setValue("fstatus", "待验收", 11l);
|
|
|
+ } else {
|
|
|
+ serviceformPao.setValue("fstatus", "已完成", 11l);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /** 积分规则计算 **/
|
|
|
+ ACcalculation(workordertemplate);
|
|
|
+
|
|
|
+ /** 给经销商发送消息 **/
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** AC积分计算 **/
|
|
|
+ public void ACcalculation(PaoSetRemote workordertemplate) throws P2Exception {
|
|
|
+ /** 积分规则计算 **/
|
|
|
+ if (!workordertemplate.isEmpty() && workordertemplate.getPao(0).getBoolean("fisfillAC")) {
|
|
|
+ PaoSetRemote aintegralrule = getPaoSet("AINTEGRALRULE");
|
|
|
+ PaoSetRemote cintegralrule = getPaoSet("CINTEGRALRULE");
|
|
|
+ /** A积分设置 **/
|
|
|
+ if (!aintegralrule.isEmpty()) {
|
|
|
+ PaoRemote pao = aintegralrule.getPao(0);
|
|
|
+ if (!pao.isNull("phone")) {
|
|
|
+
|
|
|
+ String calculationrules = pao.getString("CALCULATIONRULES");
|
|
|
+ PaoRemote AtagentIntegralruleType = getTagentIntegralruleType("A积分");
|
|
|
+ if (calculationrules.equals("管材")) {
|
|
|
+ if (AtagentIntegralruleType != null && !AtagentIntegralruleType.isNull("fvalue")
|
|
|
+ && AtagentIntegralruleType.getInt("fvalue") != 0) {
|
|
|
+ int result_cunt = AtagentIntegralruleType == null ? 0
|
|
|
+ : AtagentIntegralruleType.getInt("fvalue") * pao.getInt("fvalue");
|
|
|
+
|
|
|
+ if (result_cunt != 0 && !pao.isNull("phone") && !pao.isNull("fname")) {
|
|
|
+ createpersonal(pao.getString("fname"), pao.getString("phone"));
|
|
|
+ createintegralchange("A积分", result_cunt, pao.getString("phone"), pao.getString("fname"),
|
|
|
+ calculationrules, pao.getInt("fvalue"), 0, 0, 0, result_cunt);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (calculationrules.equals("丝扣嵌件")) {
|
|
|
+ if (AtagentIntegralruleType != null && !AtagentIntegralruleType.isNull("fvalue2")
|
|
|
+ && AtagentIntegralruleType.getInt("fvalue2") != 0) {
|
|
|
+ int result_cunt = AtagentIntegralruleType == null ? 0
|
|
|
+ : AtagentIntegralruleType.getInt("fvalue2") * pao.getInt("fvalue");
|
|
|
+ if (result_cunt != 0 && !pao.isNull("phone") && !pao.isNull("fname")) {
|
|
|
+ createpersonal(pao.getString("fname"), pao.getString("phone"));
|
|
|
+ createintegralchange("A积分", result_cunt, pao.getString("phone"), pao.getString("fname"),
|
|
|
+ calculationrules, pao.getInt("fvalue"), 0, 0, 0, result_cunt);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (calculationrules.equals("户型")) {
|
|
|
+ if (AtagentIntegralruleType != null) {
|
|
|
+ Integer kitchen = pao.getInt("kitchen");
|
|
|
+ Integer toilet = pao.getInt("toilet");
|
|
|
+ Integer balcony = pao.getInt("balcony");
|
|
|
+ int result_cunt = 0;
|
|
|
+ result_cunt = kitchen * AtagentIntegralruleType.getInt("kitchen")
|
|
|
+ + toilet * AtagentIntegralruleType.getInt("toilet")
|
|
|
+ + balcony * AtagentIntegralruleType.getInt("balcony");
|
|
|
+ if (result_cunt != 0 && !pao.isNull("phone") && !pao.isNull("fname")) {
|
|
|
+ createpersonal(pao.getString("fname"), pao.getString("phone"));
|
|
|
+ createintegralchange("A积分", result_cunt, pao.getString("phone"), pao.getString("fname"),
|
|
|
+ calculationrules, 0, kitchen, toilet, balcony, result_cunt);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ /** C积分设置 **/
|
|
|
+
|
|
|
+ if (!cintegralrule.isEmpty()) {
|
|
|
+ PaoRemote pao = cintegralrule.getPao(0);
|
|
|
+ String calculationrules = pao.getString("CALCULATIONRULES");
|
|
|
+ PaoRemote CtagentIntegralruleType = getTagentIntegralruleType("C积分");
|
|
|
+ if (!pao.isNull("phone")) {
|
|
|
+ if (calculationrules.equals("管材")) {
|
|
|
+ if (CtagentIntegralruleType != null && !CtagentIntegralruleType.isNull("fvalue")
|
|
|
+ && CtagentIntegralruleType.getInt("fvalue") != 0) {
|
|
|
+ int result_cunt = CtagentIntegralruleType == null ? 0
|
|
|
+ : CtagentIntegralruleType.getInt("fvalue") * pao.getInt("fvalue");
|
|
|
+ if (result_cunt != 0 && !pao.isNull("phone") && !pao.isNull("fname")) {
|
|
|
+ createpersonal(pao.getString("fname"), pao.getString("phone"));
|
|
|
+ createintegralchange("C积分", result_cunt, pao.getString("phone"), pao.getString("fname"),
|
|
|
+ calculationrules, pao.getInt("fvalue"), 0, 0, 0, result_cunt);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (calculationrules.equals("丝扣嵌件")) {
|
|
|
+ if (CtagentIntegralruleType != null && !CtagentIntegralruleType.isNull("fvalue2")
|
|
|
+ && CtagentIntegralruleType.getInt("fvalue2") != 0) {
|
|
|
+ int result_cunt = CtagentIntegralruleType == null ? 0
|
|
|
+ : CtagentIntegralruleType.getInt("fvalue2") * pao.getInt("fvalue");
|
|
|
+ if (result_cunt != 0 && !pao.isNull("phone") && !pao.isNull("fname")) {
|
|
|
+ createpersonal(pao.getString("fname"), pao.getString("phone"));
|
|
|
+ createintegralchange("C积分", result_cunt, pao.getString("phone"), pao.getString("fname"),
|
|
|
+ calculationrules, pao.getInt("fvalue"), 0, 0, 0, result_cunt);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (calculationrules.equals("户型")) {
|
|
|
+ if (CtagentIntegralruleType != null) {
|
|
|
+ Integer kitchen = pao.getInt("kitchen");
|
|
|
+ Integer toilet = pao.getInt("toilet");
|
|
|
+ Integer balcony = pao.getInt("balcony");
|
|
|
+ int result_cunt = 0;
|
|
|
+ if (CtagentIntegralruleType != null) {
|
|
|
+ result_cunt = kitchen * CtagentIntegralruleType.getInt("kitchen")
|
|
|
+ + toilet * CtagentIntegralruleType.getInt("toilet")
|
|
|
+ + balcony * CtagentIntegralruleType.getInt("balcony");
|
|
|
+ if (result_cunt != 0 && !pao.isNull("phone") && !pao.isNull("fname")) {
|
|
|
+ createpersonal(pao.getString("fname"), pao.getString("phone"));
|
|
|
+ createintegralchange("C积分", result_cunt, pao.getString("phone"),
|
|
|
+ pao.getString("fname"), calculationrules, 0, kitchen, toilet, balcony,
|
|
|
+ result_cunt);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 拒绝 **/
|
|
|
+ public void refuse() throws P2Exception {
|
|
|
+ if (!getString("fstatus").equals("质保卡审批"))
|
|
|
+ throw new P2AppException("", "非质保卡审批状态无法拒绝");
|
|
|
+ setValue("fstatus", "进行中", 11l);
|
|
|
+ }
|
|
|
}
|