Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            SFIS_WCF.IService1 ss = new SFIS_WCF.Service1();
            MessageBox.Show(ss.getuserid("eee"));


            listBox1.Items.Clear();

            List <string>    lszz = new List <string>();
            Z_RFC_AUFNR_MIGO zfc  = new Z_RFC_AUFNR_MIGO();

            zfc.EMP_NO     = "K001947";
            zfc.EMP_NAME   = "TEST";
            zfc.PartNumber = "900000258";
            zfc.STGE_LOC   = "1000";
            zfc.QTY        = 10;
            zfc.MOVE_STLOC = "1033";


            lszz = WHS_MOVE_Z_RFC_AUFNR_MIGO(zfc, "");
            for (int x = 0; x < lszz.Count; x++)
            {
                listBox1.Items.Add(lszz[x]);
                richTextBox1.AppendText(lszz[x] + "\r\n");
            }
        }
Ejemplo n.º 2
0
        public List <string> WHS_MOVE_Z_RFC_AUFNR_MIGO(Z_RFC_AUFNR_MIGO RFCAufnrMigo, string TestFlag)
        {
            List <string> LsMsg = new List <string>();

            try
            {
                #region GM_CODE是和SAP的T-code相关

                /*01 MB01
                *  02 MB31
                *  03 MB1A
                *  04 MB1B
                *  05 MB1C
                *  06 MB11*/
                #endregion


                RfcDestination destination = RfcDestinationManager.GetDestination(this.GetCfgParameters());
                IRfcFunction   rfcFunction = destination.Repository.CreateFunction("Z_RFC_AUFNR_MIGO");

                IRfcStructure IS_HEAD = rfcFunction.GetStructure("IS_HEAD");
                IS_HEAD.SetValue("GM_CODE", "04");
                IS_HEAD.SetValue("PSTNG_DATE", string.IsNullOrEmpty(RFCAufnrMigo.PSTNG_DATE) ? DateTime.Now.ToString("yyyyMMdd") : RFCAufnrMigo.PSTNG_DATE);
                IS_HEAD.SetValue("DOC_DATE", string.IsNullOrEmpty(RFCAufnrMigo.DOC_DATE) ? DateTime.Now.ToString("yyyyMMdd") : RFCAufnrMigo.DOC_DATE);
                IS_HEAD.SetValue("HEADER_TXT", RFCAufnrMigo.EMP_NO + RFCAufnrMigo.EMP_NAME); //人员权限
                rfcFunction.SetValue("IS_HEAD", IS_HEAD);                                    //设置参数

                IRfcStructure IS_ITEM = rfcFunction.GetStructure("IS_ITEM");
                IS_ITEM.SetValue("MATERIAL", RFCAufnrMigo.PartNumber);
                IS_ITEM.SetValue("PLANT", "2100");
                IS_ITEM.SetValue("STGE_LOC", RFCAufnrMigo.STGE_LOC); //转出仓
                IS_ITEM.SetValue("MOVE_TYPE", "311");                //仓库之间转移
                IS_ITEM.SetValue("ENTRY_QNT", RFCAufnrMigo.QTY);
                IS_ITEM.SetValue("MOVE_PLANT", "2100");
                IS_ITEM.SetValue("MOVE_STLOC", RFCAufnrMigo.MOVE_STLOC);
                rfcFunction.SetValue("IS_ITEM", IS_ITEM); //设置参数

                rfcFunction.SetValue("I_TYPE", "3");      //1成品入库 2出库  03 移库
                if (!string.IsNullOrEmpty(TestFlag))
                {
                    rfcFunction.SetValue("TESTRUN", "X"); //检查入库,不过账
                }
                rfcFunction.Invoke(destination);

                string        SAP_STOCKNO = rfcFunction.GetValue("E_MBLNR").ToString().TrimStart('0'); //物料凭证号码
                IRfcStructure ES_RETURN   = rfcFunction.GetStructure("ES_RETURN");
                string        SAP_TYPE    = ES_RETURN.GetValue("TYPE").ToString();                     //是否成功 S 表示成功
                string        SAP_E_ID    = ES_RETURN.GetValue("ID").ToString();
                string        SAP_E_NUM   = ES_RETURN.GetValue("NUMBER").ToString();
                string        SAP_MSG     = ES_RETURN.GetValue("MESSAGE").ToString();


                LsMsg.Add(SAP_STOCKNO);
                LsMsg.Add(SAP_TYPE);
                LsMsg.Add(SAP_E_ID);
                LsMsg.Add(SAP_E_NUM);
                LsMsg.Add(SAP_MSG);
                return(LsMsg);
            }
            catch (Exception ex)
            {
                LsMsg.Add(ex.Message);
                return(LsMsg);
            }
        }