Esempio n. 1
0
        public ActionResult InvoicePart()
        {
            token = appClass.CRM_Gettoken();
            CRM_HG_STAFF staff = crmModels.HG_STAFF.ReadBySTAFFID(appClass.CRM_GetStaffid(), token);
            CRM_KH_KH    kehu  = crmModels.KH_KH.ReadBySAPSN(staff.STAFFNO, token);

            CRM_MSG_INVOICEList[] data = crmModels.MSG_INVOICE.ReadByKHID(kehu.KHID, token);
            ViewBag.data = data;
            return(View());
        }
Esempio n. 2
0
        public ActionResult CPHWBS()
        {
            Session["location"] = 20003;
            token = appClass.CRM_Gettoken();
            MES_SY_GC cx_gc = new MES_SY_GC();

            cx_gc.STAFFID = appClass.CRM_GetStaffid();
            MES_SY_GC[] GC = mesModels.SY_GC.SELECT_BY_ROLE(cx_gc, token);
            ViewBag.GC = GC;
            return(View());
        }
Esempio n. 3
0
        public ActionResult CK_Setting()
        {
            Session["location"] = 20000;
            token = appClass.CRM_Gettoken();
            MES_SY_TYPEMX cx_ljxt = new MES_SY_TYPEMX();

            cx_ljxt.TYPEID = 39;
            MES_SY_TYPEMXLIST[] LJXT = mesModels.SY_TYPEMX.SELECT(cx_ljxt, token);
            ViewBag.LJXT = LJXT;

            MES_SY_GC cx_gc = new MES_SY_GC();

            cx_gc.STAFFID = appClass.CRM_GetStaffid();
            MES_SY_GC[] GC = mesModels.SY_GC.SELECT_BY_ROLE(cx_gc, token);
            ViewBag.GC = GC;

            return(View());
        }
Esempio n. 4
0
        public string Data_Select(string data)          //查询人员列表
        {
            token = appclass.CRM_Gettoken();
            Sonluk.UI.Model.CRM.HG_STAFFService.CRM_Report_STAFFModel report_model = JsonConvert.DeserializeObject <Sonluk.UI.Model.CRM.HG_STAFFService.CRM_Report_STAFFModel>(data);
            report_model.STAFFID = appclass.CRM_GetStaffid();
            Sonluk.UI.Model.CRM.HG_STAFFService.CRM_HG_STAFFList[] list = crmModels.HG_STAFF.Report(report_model, "staff", token);
            string s = Newtonsoft.Json.JsonConvert.SerializeObject(list);

            return(s);
        }
Esempio n. 5
0
        public string Insert_Invoice(string data)
        {
            token = appClass.CRM_Gettoken();
            FICO_FM_ElectricInvoice model = Newtonsoft.Json.JsonConvert.DeserializeObject <FICO_FM_ElectricInvoice>(data);

            FICO_FM_ElectricInvoice nnModel = new FICO_FM_ElectricInvoice();

            nnModel.FPDM = model.FPDM;
            nnModel.FPHM = model.FPHM;
            int x = crmModels.FM_ElectricInvoice.ReadBySCAN(nnModel, token);

            if (x > 0)
            {
                webmsg.KEY = x;
                webmsg.MSG = "发票重复报销,请检查数据";
                return(Newtonsoft.Json.JsonConvert.SerializeObject(webmsg));
            }

            model.CJR      = appClass.CRM_GetStaffid();
            model.XGR      = appClass.CRM_GetStaffid();
            model.ISACTIVE = 1;
            try
            {
                int i = crmModels.FM_ElectricInvoice.Create(model, token);
                if (i > 0)
                {
                    webmsg.KEY = i;
                    webmsg.MSG = "新增成功!";
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(webmsg));
                }
                else
                {
                    webmsg.KEY = i;
                    webmsg.MSG = "新增失败!";
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(webmsg));
                }
            }
            catch (Exception E)
            {
                return(E.Message);
            }
        }
Esempio n. 6
0
        public string Data_Insert_Menu(string data)
        {
            token = appClass.CRM_Gettoken();
            CRM_QYJS_MENU model = Newtonsoft.Json.JsonConvert.DeserializeObject <CRM_QYJS_MENU>(data);

            model.CJR = appClass.CRM_GetStaffid();
            int i = crmModels.QYJS_MENU.Create(model, token);

            if (i > 0)
            {
                webmsg.KEY = i;
                webmsg.MSG = "新增成功!";
            }
            else
            {
                webmsg.KEY = 0;
                webmsg.MSG = "新增失败!";
            }
            return(Newtonsoft.Json.JsonConvert.SerializeObject(webmsg));
        }
Esempio n. 7
0
        public ActionResult BHGDJ()
        {
            Session["location"] = 212;
            token = appClass.CRM_Gettoken();


            FIVES_STAFF_DEP DEPmodel = new FIVES_STAFF_DEP();

            DEPmodel.STAFFID = appClass.CRM_GetStaffid();

            FIVES_STAFF_DEP[] DEPdata = fivesmodels.STAFF_DEP.Read(DEPmodel, token);

            List <FIVES_STAFF_DEP> DEPlist = DEPdata.ToList();

            DEPlist         = DEPlist.DistinctBy(p => p.DEPTID).ToList();
            DEPdata         = DEPlist.ToArray();
            ViewBag.DeptArr = DEPdata;


            return(View());
        }
Esempio n. 8
0
        public string Data_Insert_Invoice(string data)
        {
            token = appClass.CRM_Gettoken();
            CRM_MSG_INVOICE model = Newtonsoft.Json.JsonConvert.DeserializeObject <CRM_MSG_INVOICE>(data);

            model.CJR      = appClass.CRM_GetStaffid();
            model.ISACTIVE = 1;
            int i = crmModels.MSG_INVOICE.Create(model, token);

            webmsg.KEY = i;
            if (i > 0)
            {
                webmsg.MSG = "新增成功";
            }
            else
            {
                webmsg.MSG = "新增失败!";
            }
            return(Newtonsoft.Json.JsonConvert.SerializeObject(webmsg));
        }
Esempio n. 9
0
        public string Create_MSG_SENDWAY(string data)
        {
            token = appClass.CRM_Gettoken();
            MSG_MSG_SENDWAY model = Newtonsoft.Json.JsonConvert.DeserializeObject <MSG_MSG_SENDWAY>(data);

            model.ISACTIVE = 10;
            model.CJR      = appClass.CRM_GetStaffid();
            int id = msgModels.MSG_SENDWAY.Create(model, token);

            if (id > 0)
            {
                webmsg.KEY = 1;
                webmsg.MSG = "新增成功";
            }
            else
            {
                webmsg.KEY = 0;
                webmsg.MSG = "新增失败";
            }
            return(Newtonsoft.Json.JsonConvert.SerializeObject(webmsg));
        }
Esempio n. 10
0
        public ActionResult Insert_Order()
        {
            token = appClass.CRM_Gettoken();
            CRM_HG_STAFF STAFF = crmModels.HG_STAFF.ReadBySTAFFID(appClass.CRM_GetStaffid(), token);    //STAFF为当前用户的数据

            ViewBag.STAFF = STAFF;

            string SAPSN = STAFF.STAFFNO;

            CRM_KH_KH[] SDF = crmModels.KH_KH.ReadSDFbyPKH(SAPSN, token);
            ViewBag.SDF = SDF;

            CRM_KH_KH KH = crmModels.KH_KH.ReadBySAPSN(SAPSN, token);     //kh为当前客户的数据

            ViewBag.KH = KH;

            DateTime now = DateTime.Now;

            ViewBag.startdate = now.AddMonths(-1).ToString("yyyy-MM-dd");
            ViewBag.enddate   = now.ToString("yyyy-MM-dd");

            return(View());
        }
Esempio n. 11
0
        public string Data_Insert_PM(string data, string isTuiHuo)
        {
            token = appClass.CRM_Gettoken();
            try
            {
                CRM_BC_PMLIST model = Newtonsoft.Json.JsonConvert.DeserializeObject <CRM_BC_PMLIST>(data);
                model.CJR = appClass.CRM_GetStaffid();
                CRM_BC_PMLISTList[] xianyouData = crmModels.BC_PMLIST.SelectByGD(model.AUFNR, token);
                if (xianyouData.Length != 0)    //已经有该工单的数据
                {
                    if (xianyouData[0].CHARG != model.CHARG)
                    {
                        return("已存在该工单,且日期唛不一致");
                    }
                    if (xianyouData[0].PM == "" && xianyouData[xianyouData.Length - 1].PM == "") //数据库里有该工单的信息,但箱码还未生成喷码
                    {
                        int error = crmModels.BC_PMLIST.UpdatePM(token);                         //生成喷码
                        if (error != 0)
                        {
                            return("喷码生成失败,请重试");
                        }
                    }
                    else         //该工单的箱码已经生成了喷码
                    {
                        MODEL_ZBCFUN_TM_READ TMmodel = crmModels.BarCode.GET_ZBCFUN_TM_READ(model.AUFNR, "F", token);
                        if (TMmodel.ET_TM.Length == 0)
                        {
                            return("该工单没有所属箱码");
                        }

                        List <ZSL_BCT100> ET_TM = TMmodel.ET_TM.ToList();
                        //ET_TM = (from o in ET_TM orderby (o.DXM.Substring(2,o.DXM.Length-2)) select o).ToList();
                        ET_TM = ET_TM.OrderBy(u => u.TPM.Substring(2, u.TPM.Length - 2)).ThenBy(u => u.DXM.Substring(2, u.DXM.Length - 2)).ToList();

                        string PM = "";
                        if (isTuiHuo == "1")       //如果是退货的话喷码统一为ZAA
                        {
                            PM = "ZAA";
                        }
                        string TPM_temp = "";
                        int    isexist  = 0;                  //变成1表示当前行是这回刚增进去的,所以其对应的托码整个都要增进去
                        for (int x = 0; x < ET_TM.Count; x++) //按箱码进行循环
                        {
                            CRM_BC_PMLIST cxmodel = new CRM_BC_PMLIST();
                            if (ET_TM[x].TPM != TPM_temp)                   //当托码变化时,去数据库看下这个托码是否已经存在
                            {
                                isexist        = 0;
                                cxmodel.AUFNR  = model.AUFNR;
                                cxmodel.TPM    = ET_TM[x].TPM;
                                cxmodel.PMTYPE = 1;
                                CRM_BC_PMLIST[] cxresult = crmModels.BC_PMLIST.SelectByModel(cxmodel, "", "", token);
                                if (cxresult.Length != 0 && isexist == 0)          //已经有这个托码了,就跳过
                                {
                                    continue;
                                }
                                else          //这个托码还没生成喷码
                                {
                                    isexist   = 1;
                                    model.DXM = ET_TM[x].DXM;
                                    model.TPM = ET_TM[x].TPM;

                                    model.PM     = PM;
                                    model.PMTYPE = 1;   //根据工单
                                    int i = crmModels.BC_PMLIST.Create(model, token);
                                    if (i <= 0)
                                    {
                                        return("生成失败!");
                                    }
                                }
                            }
                            else
                            {
                                if (isexist == 1)
                                {
                                    model.DXM = ET_TM[x].DXM;
                                    model.TPM = ET_TM[x].TPM;

                                    model.PM     = PM;
                                    model.PMTYPE = 1;   //根据工单
                                    int i = crmModels.BC_PMLIST.Create(model, token);
                                    if (i <= 0)
                                    {
                                        return("生成失败!");
                                    }
                                }
                                else
                                {
                                    continue;
                                }
                            }

                            TPM_temp = ET_TM[x].TPM;
                        }
                    }
                }
                else        //数据库里没有该工单的数据
                {
                    MODEL_ZBCFUN_TM_READ TMmodel = crmModels.BarCode.GET_ZBCFUN_TM_READ(model.AUFNR, "F", token);
                    if (TMmodel.ET_TM.Length == 0)
                    {
                        return("该工单没有所属箱码");
                    }

                    List <ZSL_BCT100> ET_TM = TMmodel.ET_TM.ToList();
                    //ET_TM = (from o in ET_TM orderby (o.DXM.Substring(2,o.DXM.Length-2)) select o).ToList();
                    ET_TM = ET_TM.OrderBy(u => u.TPM.Substring(2, u.TPM.Length - 2)).ThenBy(u => u.DXM.Substring(2, u.DXM.Length - 2)).ToList();

                    string PM = "";
                    if (isTuiHuo == "1")       //如果是退货的话喷码统一为ZAA
                    {
                        PM = "ZAA";
                    }
                    for (int x = 0; x < ET_TM.Count; x++)
                    {
                        model.DXM = ET_TM[x].DXM;
                        model.TPM = ET_TM[x].TPM;

                        model.PM     = PM;
                        model.PMTYPE = 1;   //根据工单
                        int i = crmModels.BC_PMLIST.Create(model, token);
                        if (i <= 0)
                        {
                            return("生成失败!");
                        }
                    }
                    //if (isTuiHuo == "0")       //不是退货的话需要生成喷码
                    //{
                    //    int error = crmModels.BC_PMLIST.UpdatePM(token);    //生成喷码
                    //    if (error != 0)
                    //    {
                    //        return "喷码生成失败,请重试";
                    //    }
                    //}
                }
            }
            catch (Exception e)
            {
                return(e.Message);
            }


            return("生成成功!");
        }
Esempio n. 12
0
        public string Data_TongBuSAPCH_ByKH()              //更新今天某客户的发货数据
        {
            token = appClass.CRM_Gettoken();
            WebMSG msg = new WebMSG();
            //return Newtonsoft.Json.JsonConvert.SerializeObject(msg);
            int staffid = appClass.CRM_GetStaffid();

            CRM_KH_KHList[] KHdata = crmModels.KH_KH.ReadBySTAFFID(appClass.CRM_GetStaffid(), token);
            if (KHdata.Length == 0)
            {
                msg.KEY = 1;
                msg.MSG = "没有需要同步的客户";
                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
            }

            //CRM_KH_KHList[] KHdata = new CRM_KH_KHList[1];
            //KHdata[0] = new CRM_KH_KHList();
            //KHdata[0].SAPSN = "100016";


            MODEL_ZBCFUN_DLV_GET SAPdata = crmModels.BarCode.GET_ZBCFUN_DLV_GET2(Newtonsoft.Json.JsonConvert.SerializeObject(KHdata), token);        //获取SAP数据

            if (SAPdata.ET_TTXX.Length == 0)
            {
                msg.KEY = 1;
                msg.MSG = "没有需要同步的信息";
                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
            }
            int delete = crmModels.BC_CHTT_FAKE.TTMXDelete(token);        //把FAKE表的数据清光

            if (delete != 0)
            {
                msg.KEY = 0;
                msg.MSG = "出货抬头同步发生异常,请重试";
                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
            }
            for (int i = 0; i < SAPdata.ET_TTXX.Length; i++)       //抬头新增
            {
                CRM_BC_CHTT TTmodel = new CRM_BC_CHTT();
                TTmodel.VBELN     = SAPdata.ET_TTXX[i].VBELN;
                TTmodel.WERKS     = SAPdata.ET_TTXX[i].WERKS;
                TTmodel.POSNR     = SAPdata.ET_TTXX[i].POSNR;
                TTmodel.MATNR     = SAPdata.ET_TTXX[i].MATNR;
                TTmodel.KUNAG     = SAPdata.ET_TTXX[i].KUNAG;
                TTmodel.LGORT     = SAPdata.ET_TTXX[i].LGORT;
                TTmodel.WADAT_IST = SAPdata.ET_TTXX[i].WADAT_IST;
                TTmodel.XGR       = SAPdata.ET_TTXX[i].XGR;

                int id = crmModels.BC_CHTT_FAKE.TTCreate(TTmodel, token);
                if (id == 0)
                {
                    msg.KEY = 0;
                    msg.MSG = "出货抬头同步失败,请重试";
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                }
            }
            for (int i = 0; i < SAPdata.ET_HXMXX.Length; i++)      //行项目新增
            {
                Sonluk.UI.Model.CRM.BC_CHTT_FAKEService.CRM_BC_CHMX MXmodel = new Sonluk.UI.Model.CRM.BC_CHTT_FAKEService.CRM_BC_CHMX();
                MXmodel.VBELN = SAPdata.ET_HXMXX[i].VBELN;
                MXmodel.POSNR = SAPdata.ET_HXMXX[i].POSNR;
                MXmodel.TPM   = SAPdata.ET_HXMXX[i].TPM;
                MXmodel.DXM   = SAPdata.ET_HXMXX[i].DXM;
                MXmodel.NHM   = SAPdata.ET_HXMXX[i].NHM;
                MXmodel.CHARG = SAPdata.ET_HXMXX[i].CHARG;
                MXmodel.LWEDT = SAPdata.ET_HXMXX[i].LWEDT;
                MXmodel.QXBS  = SAPdata.ET_HXMXX[i].QXBS;

                int id = crmModels.BC_CHTT_FAKE.MXCreate(MXmodel, token);
                if (id == 0)
                {
                    msg.KEY = 0;
                    msg.MSG = "出货行项目同步失败,请重试";
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                }
            }

            int error = crmModels.BC_CHTT.Modify(token);      //数据更新

            if (error == 0)
            {
                msg.KEY = 1;
                msg.MSG = "同步完成";
                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
            }
            else
            {
                msg.KEY = 0;
                msg.MSG = "同步失败,请重试";
                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
            }
        }