Esempio n. 1
0
        public bool Remote_InsertICPOEntry(ICPOBILLMODEL billModel, ICPOBILLENTRYMODEL entryModel)
        {
            MApiAccess.AccessApi Mapi = new MApiAccess.AccessApi();
            if (string.IsNullOrEmpty(Global.g_token.tokenInfo.endDate) || DateTime.Parse(Global.g_token.tokenInfo.endDate) < DateTime.Now)
            {
                MApiModel.api1.Rootobject tempToken = new MApiModel.api1.Rootobject();
                tempToken.comid   = 101;
                tempToken.action  = "getToken";
                tempToken.khhm    = "300384";
                tempToken.openkey = "10011630";
                Global.g_token    = Mapi.AccessApi1(tempToken);
            }

            MApiModel.api3.Rootobject api3 = new MApiModel.api3.Rootobject();
            api3.action = "setMN_cp_24";
            api3.token  = Global.g_token.token;

            List <MApiModel.api3.Datum> listSubItems = new List <MApiModel.api3.Datum>();


            MApiModel.api3.Datum subItem = new MApiModel.api3.Datum();
            subItem.sourceno = billModel.FBILLNO;
            subItem.rq       = billModel.FDATESTR;
            subItem.comid    = "101";
            //subItem.khhm = billModel.Fcompany;
            //subItem.khmc=
            //subItem.pjhm = "";
            subItem.zdr = billModel.FBILLER;
            //产品品种
            //subItem.cppz=billModel
            //产品规格
            //subItem.cpgg = "";
            //产品型号
            subItem.cpxh = "";
            subItem.cpdj = entryModel.Flevel;
            subItem.cpsh = entryModel.FCOLORNO;
            //产品仓号
            subItem.cpcm    = entryModel.FstockNO;
            subItem.package = entryModel.FcontractNO;
            subItem.dw      = entryModel.Funit;
            //包装片数
            //subItem.ks=entryModel.
            subItem.sl = int.Parse(entryModel.FSRCQTY.ToString());
            subItem.je = int.Parse(entryModel.Famount.ToString());

            listSubItems.Add(subItem);

            api3.data = listSubItems.ToArray();

            MApiModel.recApi3.Rootobject recapi3 = Mapi.AccessApi3(api3);

            if (recapi3.status == 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public string Remote_InsertICPOEntry(MApiModel.api3.Rootobject getapi3)
        {
            try
            {
                MApiAccess.AccessApi Mapi = new MApiAccess.AccessApi();


                MApiModel.recToken.Rootobject g_token = new MApiModel.recToken.Rootobject();


                MApiModel.api1.Rootobject tempToken = new MApiModel.api1.Rootobject();
                tempToken.comid   = int.Parse(getapi3.comid);
                tempToken.action  = "getToken";
                tempToken.khhm    = "300384";
                tempToken.openkey = hn.Common.StringHelper.MD5string("10011630");
                g_token           = Mapi.AccessApi1(tempToken);


                LogHelper.WriteLog(JSONhelper.ToJson(g_token));

                getapi3.token = g_token.token;

                MApiModel.recApi3.Rootobject recapi3 = Mapi.AccessApi3(getapi3);
                LogHelper.WriteLog(JSONhelper.ToJson(recapi3));
                if (recapi3.status == 0)
                {
                    try
                    {
                        return(recapi3.resultInfo[0].pzhm);
                    }
                    catch
                    {
                        return("error:未返回编号");
                    }
                }
                else
                {
                    return("error:" + recapi3.msg);
                }
            }
            catch (Exception ee)
            {
                return("error:" + ee.ToString());
            }
        }
        public MApiModel.recApi2.Rootobject GetStockListMN(
            MApiModel.api2.Rootobject getapi2)
        {
            MApiAccess.AccessApi Mapi = new MApiAccess.AccessApi();

            if (Global.g_token == null || Global.g_token.tokenInfo == null || string.IsNullOrEmpty(Global.g_token.tokenInfo.endDate) || DateTime.Parse(Global.g_token.tokenInfo.endDate) < DateTime.Now)
            {
                MApiModel.api1.Rootobject tempToken = new MApiModel.api1.Rootobject();
                tempToken.comid   = 100;
                tempToken.action  = "getToken";
                tempToken.khhm    = "300384";
                tempToken.openkey = hn.Common.StringHelper.MD5string("10011630");
                Global.g_token    = Mapi.AccessApi1(tempToken);
            }

            getapi2.comid  = "100";
            getapi2.action = "getMN_cp_11";
            getapi2.token  = Global.g_token.token;

            MApiModel.recApi2.Rootobject rec = Mapi.AccessApi2(getapi2);

            return(rec);
        }
        public MApiModel.recApi2.Rootobject GetStockListMN_2(
            MApiModel.api2.Rootobject getapi2, int comid)
        {
            MApiAccess.AccessApi Mapi = new MApiAccess.AccessApi();


            MApiModel.api1.Rootobject tempToken = new MApiModel.api1.Rootobject();
            tempToken.comid   = comid;
            tempToken.action  = "getToken";
            tempToken.khhm    = "300384";
            tempToken.openkey = hn.Common.StringHelper.MD5string("10011630");


            MApiModel.recToken.Rootobject token = Mapi.AccessApi1(tempToken);


            getapi2.comid  = "100";
            getapi2.action = "getMN_cp_11";
            getapi2.token  = token.token;

            MApiModel.recApi2.Rootobject rec = Mapi.AccessApi2(getapi2);

            return(rec);
        }