示例#1
0
    protected void btnLink_Click(object sender, DirectEventArgs e)
    {
        DataTable dtHead   = oStandard.GetdtHead(txtRDocNo.Text.Trim());
        DataTable dtDetail = oStandard.GetdtDetail(txtRDocNo.Text.Trim());

        if (dtHead.Rows.Count > 0) //Check是否符合應退未退的條件
        {
            DataRow drHead = dtHead.Rows[0];
            if (drHead["APTYP"].ToString() == "I1")
            {
                if (drHead["RTNIF"].ToString() == "Y")//符合條件時,加載基本資料
                {
                    txtDocNo.Text       = oStandard.CreateFormNo(txtRDocNo.Text.Trim());
                    txtCostCenter.Text  = drHead["KOSTL"].ToString(); //成本中心
                    txtDepartment.Text  = drHead["ABTEI"].ToString(); //部門
                    txtApplication.Text = drHead["ERNAM"].ToString(); //LoginID
                    txtReturn.Text      = drHead["RTNIF"].ToString(); // Return Flag
                    txtWERKS.Text       = drHead["WERKS"].ToString();
                    txtAPTYP.Text       = drHead["APTYP"].ToString();

                    string xmlstrHead = oStandard.DataTableToXMLStr(dtHead);
                    txtHead.Text = xmlstrHead;                                               //Head
                    string xmlstrDetail = oStandard.DataTableToXMLStr(dtDetail);
                    txtDetail.Text = xmlstrDetail;                                           //Detail

                    string        tempWEKS = DOA.GetXMLConfigName(dtHead);                   //CALL FUNCTION獲取XML配置檔名
                    SettingParser x        = new SettingParser(tempWEKS, txtAPTYP.Text);     //讀取XML配置檔信息
                    txtDOA.Text = x.ApproveXML.Replace("&lt1;", "<").Replace("&gt1;", ">");; //抓取DOA的簽核邏輯

                    //計算總金額
                    double amount = 0;
                    foreach (DataRow dr in dtDetail.Rows)
                    {
                        amount += double.Parse(dr["STPRS"].ToString());
                    }
                    txtAmount.Text = amount.ToString("n");
                }
                else
                {
                    Alert("此單號不符合應退未退的條件!");
                    Refresh();
                    return;
                }
            }
            else
            {
                Alert("Link單號必須是I1單!");
                Refresh();
                return;
            }
        }
        else
        {
            Alert("此單號不存在!");
            Refresh();
            return;
        }
    }
示例#2
0
    private void ShowRecord(GDSExceptionHandlingUIShadow lUIControls, EFFormFields FormFields, string type, int caseId, SPMTaskVariables SPMTaskVars)
    {
        string     caseid    = SPMTaskVars.ReadDatum("CASEID").ToString();
        string     stepName  = (string)(SPMTaskVars.ReadDatum("STEPNAME"));
        GDS_Helper oStandard = new GDS_Helper();

        if (stepName != "Begin")
        {
            #region 抓取 異常單資料 並綁定到控件中
            DataTable dt = oStandard.GetMaster_Exception(int.Parse(caseid));//加載 異常單主表資料
            if (dt.Rows.Count > 0)
            {
                #region 數據加載
                DataRow dr = dt.Rows[0];
                oUIControls.txtDocNo.Text          = dr["MBLNR"].ToString();      //主單號
                oUIControls.txtRDocNo.Text         = dr["MBLNR_A"].ToString();    //Link 單號
                oUIControls.txtCostCenter.Text     = dr["KOSTL"].ToString();      //成本中心
                oUIControls.txtDepartment.Text     = dr["ABTEI"].ToString();      //部門
                oUIControls.txtApplication.Text    = dr["Applicant"].ToString();  //LoginID
                oUIControls.txtReturn.Text         = dr["RTNIF"].ToString();      // Return Flag
                oUIControls.txtWERKS.Text          = dr["WERKS"].ToString();      //廠別
                oUIControls.txtMaterial.Text       = dr["MATNR"].ToString();      //料號
                oUIControls.txtZEILE.Text          = dr["ZEILE"].ToString();      //料號對應的ITEM
                oUIControls.txtAmount.Text         = dr["Amount"].ToString();     //金額
                oUIControls.txtIADocNo.Text        = dr["IADocNo"].ToString();    //關聯IA單
                oUIControls.txtI6DocNo.Text        = dr["I6DocNo"].ToString();    //關聯I6單
                oUIControls.txtReason.Text         = dr["Reason"].ToString();     //REASON
                oUIControls.txtRemark.Text         = dr["Remark"].ToString();     //REMARK
                oUIControls.txtReturnQuantity.Text = dr["MENGE"].ToString();      //RETURN 數量
                oUIControls.txtDOA.Text            = dr["Settingxml"].ToString(); //Settingxml
                #endregion

                #region 控件顯示
                oUIControls.btnLink.Hidden             = true;
                oUIControls.frmUserInfo.Hidden         = true;
                oUIControls.txtDocNo.ReadOnly          = true;
                oUIControls.txtRDocNo.ReadOnly         = true;
                oUIControls.txtCostCenter.ReadOnly     = true;
                oUIControls.txtDepartment.ReadOnly     = true;
                oUIControls.txtApplication.ReadOnly    = true;
                oUIControls.txtReturn.ReadOnly         = true;
                oUIControls.txtMaterial.ReadOnly       = true;
                oUIControls.txtZEILE.ReadOnly          = true;
                oUIControls.txtAmount.ReadOnly         = true;
                oUIControls.txtIADocNo.ReadOnly        = true;
                oUIControls.txtI6DocNo.ReadOnly        = true;
                oUIControls.txtReason.ReadOnly         = true;
                oUIControls.txtRemark.ReadOnly         = true;
                oUIControls.txtReturnQuantity.ReadOnly = true;
                #endregion
            }
            #endregion


            #region 通過異常單的Link單號 抓取正常單中的Head和Detail
            DataTable dtHead   = oStandard.GetdtHead(oUIControls.txtRDocNo.Text.Trim());
            DataTable dtDetail = oStandard.GetdtDetail(oUIControls.txtRDocNo.Text.Trim());
            oUIControls.txtWERKS.Text = dtHead.Rows[0]["WERKS"].ToString(); //廠別
            oUIControls.txtAPTYP.Text = dtHead.Rows[0]["APTYP"].ToString(); //單據類型
            string xmlstrHead = oStandard.DataTableToXMLStr(dtHead);
            oUIControls.txtHead.Text = xmlstrHead;                          //Head
            string xmlstrDetail = oStandard.DataTableToXMLStr(dtDetail);
            oUIControls.txtDetail.Text = xmlstrDetail;                      //Detail
            //string tempWEKS = DOA.GetXMLConfigName(dtHead);//CALL FUNCTION獲取XML配置檔名
            //SettingParser x = new SettingParser(tempWEKS, oUIControls.txtAPTYP.Text);//讀取XML配置檔信息
            //oUIControls.txtDOA.Text = x.ApproveXML.Replace("&lt1;", "<").Replace("&gt1;", ">"); ;//抓取DOA的簽核邏輯
            #endregion
        }
    }