Exemple #1
0
    public bool Update(string po, string MOVETYPE, string txtField)
    {
        bool  result = false;
        Logon logon  = new Logon();

        try
        {
            logon.Conncet();
            Function function = new Function();
            logon.SetFunction("ZRFC006");
            logon.Field_SetValue("PURCHASEORDER", po);
            logon.Field_SetValue("ZRFCTYPE", "G");
            logon.StartFunction();
            this.ZMSG      = logon.Retrun_String("ZMSG");
            this.ZFLAG     = logon.Retrun_String("ZFLAG");
            this.POHEADER  = logon.getStruct("POHEADER");
            this.POITEM    = logon.Return_Message("POITEM");
            this.POACCOUNT = logon.Return_Message("POACCOUNT");
        }
        finally
        {
            logon.dispose();
        }
        if (this.POITEM.Rows.Count > 0)
        {
            result = true;
        }
        return(result);
    }
Exemple #2
0
    protected void resend_Click(object sender, EventArgs e)
    {
        XmlDocument xmlDoc = new XmlDocument();

        xmlDoc.LoadXml(txtFieldValue.Text);
        XmlNodeList msglist = xmlDoc.SelectNodes("Form/FormFieldValue/FieldItem/FieldValue/Item/RETURNMSG");

        foreach (XmlNode nd in msglist)
        {
            xmlDoc.SelectSingleNode("Form/FormFieldValue/FieldItem/FieldValue/Item").RemoveChild(xmlDoc.SelectSingleNode("Form/FormFieldValue/FieldItem/FieldValue/Item/RETURNMSG"));
        }
        Logon  Con   = new Logon();
        string ZFLAG = "";
        string ZMSG  = "";

        try
        {
            Con.Conncet(); //連接
            Function fn = new Function();
            fn.SetFunction("ZRFC006");
            // fn.Field_SetValue("PURCHASEORDER", xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem/FieldValue").Attributes["PURCHASEORDER"].Value);
            fn.Field_SetValue("ZRFCTYPE", "M");
            fn.Field_SetValue("PSTNG_DATE", xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem/FieldValue").Attributes["PSTNG_DATE"].Value);
            fn.Field_SetValue("DOC_DATE", xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem/FieldValue").Attributes["DOC_DATE"].Value);
            fn.Field_SetValue("MOVE_TYPE", xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem/FieldValue").Attributes["MOVE_TYPE"].Value);
            fn.Set_TableName("POITEM");
            DataTable POITEM = new DataTable("POITEM");
            POITEM.Columns.Add("ITEM");
            POITEM.Columns.Add("value");
            XmlNodeList ItemList = xmlDoc.SelectNodes("/Form/FormFieldValue/FieldItem/FieldValue/Item");
            DataRow     dr;
            foreach (XmlNode node in ItemList)
            {
                POITEM.Rows.Clear();
                XmlElement XE = (XmlElement)node;

                XmlAttributeCollection xac = node.Attributes;
                foreach (XmlAttribute xa in xac)
                {
                    if (xa.Name != "key")
                    {
                        dr    = POITEM.NewRow();
                        dr[0] = xa.Name;
                        dr[1] = xa.Value;
                        POITEM.Rows.Add(dr);
                    }
                }

                fn.Set_Table(POITEM);
            }

            fn.StartFunction();
            ZFLAG = fn.Retrun_String("ZFLAG");
            ZMSG  = fn.Retrun_String("ZMSG");
        }
        finally
        {
            Con.dispose();
        }
        bool flag = false;
        int  ty   = 0;

        XmlElement fieldElement = xmlDoc.CreateElement("RETURNMSG");

        switch (ZFLAG)
        {
        case "S":
            fieldElement.SetAttribute("type", "成功");
            ty = 1;

            break;

        case "W":
            fieldElement.SetAttribute("type", "警告");
            break;

        case "E":
            fieldElement.SetAttribute("type", "失敗");
            ty   = 0;
            flag = true;
            break;
        }
        fieldElement.SetAttribute("msg", ZMSG);

        xmlDoc.SelectSingleNode("/Form/FormFieldValue/FieldItem/FieldValue/Item").InnerXml += fieldElement.OuterXml;

        XmlNodeList last         = xmlDoc.SelectNodes("/Form/FormFieldValue/FieldItem");
        int         lastcount    = last.Count;
        int         xmllistcount = 1;

        foreach (XmlNode nd in last)
        {
            if (xmllistcount == lastcount)
            {
                if (flag == true)
                {
                    nd.Attributes["ConditionValue"].Value = "0";
                }
                else
                {
                    nd.Attributes["ConditionValue"].Value = ty.ToString();
                }
            }
            xmllistcount++;
        }
        string            txt        = (ty == 1) ? "成功" : "失敗";
        PrivateMessageUCO msgUco     = new PrivateMessageUCO();
        string            createUser = xmlDoc.SelectSingleNode("/Form/Applicant").Attributes["userGuid"].Value;

        msgUco.SendOneNewMessage("admin", "採購單-收貨回傳資訊", txt, createUser);
        PO_Receipt.UCO.UCO uco = new PO_Receipt.UCO.UCO();
        msg ds = new msg();

        //DataTable re = new DataTable();
        msg.TB_WKF_TASKRow TASKRow = ds.TB_WKF_TASK.NewTB_WKF_TASKRow();
        TASKRow.DOC_NBR     = DOC_NBR;
        TASKRow.CURRENT_DOC = xmlDoc.OuterXml;
        uco.UpdateXmlsetMsg(TASKRow);
        Response.Write("<script>alert('重送完成');location.href='" + Request.Url.AbsoluteUri + "';</script>");
    }