Exemplo n.º 1
0
        public void XSMXSave(T_THMXModels model)
        {
            int result = 0;

            try
            {
                if (model.Tag == "Add")
                {
                    model.DataModel.FLAG = 2;
                    result = T_THMXDomain.GetInstance().AddModel(model.DataModel);
                    T_KC KCmodel = new T_KC();
                    KCmodel       = T_KCDomain.GetInstance().GetKCid(model.DataModel.CKID);
                    KCmodel.CPNUM = KCmodel.CPNUM + 1;
                    T_KCDomain.GetInstance().UpdateModel(KCmodel, KCmodel.CKID);
                }
                else if (model.Tag == "Edit")
                {
                    model.DataModel.FLAG = 2;
                    result = T_THMXDomain.GetInstance().UpdateModel(model.DataModel, model.DataModel.CPID);
                }
            }
            catch { }
            Response.ContentType = "text/json";
            if (result > 0)
            {
                Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"closeCurrentReloadTab\",\"forwardUrl\":\"/T_THMX/Index\"}");
            }
            else
            {
                Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}");
            }
        }
Exemplo n.º 2
0
        public void GetCkByCPPH(string cpid, string ckid)
        {
            string result1 = "";
            Dictionary <string, string> dict = new Dictionary <string, string>();

            try
            {
                StringBuilder result = new StringBuilder();
                result.Append("[[\"\",\"请选择\"]");
                //result.Append("[");
                if (string.IsNullOrEmpty(cpid) || string.IsNullOrEmpty(ckid))
                {
                    result.Append("]");
                    result1 = result.ToString();
                }
                T_KC kc = new T_KC();
                kc.CPID = int.Parse(cpid);
                kc.CKID = int.Parse(ckid);
                var list = T_KCDomain.GetInstance().GetAllT_KC(kc);
                foreach (var item in list)
                {
                    result.Append(",[");
                    result.Append("\"" + item.CPPH + "\",");
                    result.Append("\"" + item.CPPH + "\"");
                    result.Append("]");
                }
                result.Append("]");
                result1 = result.ToString();
            }
            catch (Exception ex)
            {
            }
            Response.ContentType = "text/json";
            Response.Write(result1);
        }
Exemplo n.º 3
0
        public void GetCkByCPID(string id)
        {
            string result1 = "";
            Dictionary <string, string> dict = new Dictionary <string, string>();

            try
            {
                StringBuilder result = new StringBuilder();
                result.Append("[[\"\",\"请选择\"]");
                //result.Append("[");
                if (string.IsNullOrEmpty(id))
                {
                    result.Append("]");
                    result1 = result.ToString();
                }
                T_KC kc = new T_KC();
                kc.CPID = int.Parse(id);
                var list = T_KCDomain.GetInstance().GetAllT_KC(kc);
                if (list != null && list.Count > 0)
                {
                    Hashtable ht = new Hashtable();
                    foreach (var item in list)
                    {
                        if (!ht.ContainsKey(item.T_CK.CKID))
                        {
                            ht.Add(item.T_CK.CKID, item.T_CK.CKMC);
                        }
                    }
                    foreach (var key in ht.Keys)
                    {
                        result.Append(",[");
                        result.Append("\"" + key + "\",");
                        result.Append("\"" + ht[key].ToString() + "\"");
                        result.Append("]");
                    }
                }

                result.Append("]");
                result1 = result.ToString();
            }
            catch (Exception ex)
            {
            }
            Response.ContentType = "text/json";
            Response.Write(result1);
        }
Exemplo n.º 4
0
        public JsonResult GetCPByCPPH(string cpid, string ckid, string cpph)
        {
            if (string.IsNullOrEmpty(cpid) || string.IsNullOrEmpty(ckid) || string.IsNullOrEmpty(cpph))
            {
                return(Json(""));
            }
            T_KC kc = new T_KC();

            kc.CPID = int.Parse(cpid);
            kc.CKID = int.Parse(ckid);
            kc.CPPH = cpph;
            var list = T_KCDomain.GetInstance().GetAllT_KC(kc);

            if (list.Count > 0)
            {
                T_KC   kcp       = list[0];
                string resultStr = JsonConvert.SerializeObject(new
                {
                    CPBH     = (kcp.T_YLCP != null && kcp.T_YLCP.CPBH != null) ? kcp.T_YLCP.CPBH : "",
                    SupMC    = (kcp.T_SupQY1 != null && !string.IsNullOrEmpty(kcp.T_SupQY1.SupMC)) ? kcp.T_SupQY1.SupMC : "",
                    CPGG     = (kcp.T_YLCP != null && kcp.T_YLCP.CPGG != null) ? kcp.T_YLCP.CPGG : "",
                    CPXH     = (kcp.T_YLCP != null && kcp.T_YLCP.CPXH != null) ? kcp.T_YLCP.CPXH : "",
                    CPDW     = (kcp.T_YLCP != null && kcp.T_YLCP.CPDW != null) ? kcp.T_YLCP.CPDW : "",
                    CPNUM    = kcp.CPNUM ?? 0,
                    CPSCRQ   = kcp.CPSCRQ.HasValue ? kcp.CPSCRQ.Value.ToString("yyyy/MM/dd") : "",
                    CPYXQ    = kcp.CPYXQ.HasValue ? kcp.CPYXQ.Value.ToString("yyyy/MM/dd") : "",
                    CPZCZ    = (kcp.T_YLCP != null && kcp.T_YLCP.CPZCZ != null) ? kcp.T_YLCP.CPZCZ : "",
                    SupXKZBH = (kcp.T_SupQY1 != null && kcp.T_SupQY1.SupXKZBH != null) ? kcp.T_SupQY1.SupXKZBH : ""
                });
                return(Json(resultStr));
            }
            else
            {
                return(Json(""));
            }
        }
Exemplo n.º 5
0
        public int Sh(int id, int status)
        {
            int result = 0;

            using (MedicalApparatusManageEntities hContext1 = new MedicalApparatusManageEntities())
            {
                try
                {
                    var model = hContext1.Set <T_RKD>().Find(id);
                    model.ISSH = status;
                    if (status == 1) //审核通过,修改库存
                    {
                        var lst = hContext1.Set <T_RKMX>().Where(p => p.RKID == id).ToList();
                        if (lst != null && lst.Count > 0)
                        {
                            lst.ForEach(item =>
                            {
                                //对新库存数据进行修改
                                //DbSet<T_KC> kcdb = hContext1.Set<T_KC>();
                                //var kc = kcdb.Where(p => p.CPID == item.CPID && p.CPPH == item.CPPH && p.CKID == item.CKID).FirstOrDefault();
                                //if (kc != null)
                                //{
                                //    kc.CPNUM = kc.CPNUM - Convert.ToInt32(item.CPNUM);
                                //}

                                DbSet <T_KC> kcdb = hContext1.Set <T_KC>();
                                var newkc         = kcdb.Where(p => p.CPID == item.CPID && p.CPPH == item.CPPH && p.CKID == item.CKID).FirstOrDefault();
                                if (newkc == null)
                                {
                                    T_KC newKc = new T_KC()
                                    {
                                        CPID   = item.CPID,
                                        CKID   = item.CKID,
                                        CPNUM  = Convert.ToInt32(item.CPNUM),
                                        FlAG   = 1,
                                        CPPH   = item.CPPH,
                                        CPSCRQ = item.CPSCRQ,
                                        CPYXQ  = item.CPYXQ,
                                        SupID  = item.SupID,
                                        ScqyID = item.ScqyID
                                    };
                                    kcdb.Add(newKc);
                                }
                                else
                                {
                                    newkc.CPNUM  = newkc.CPNUM + Convert.ToInt32(item.CPNUM);
                                    newkc.CPYXQ  = item.CPYXQ;
                                    newkc.CPSCRQ = item.CPSCRQ;
                                }
                            });
                        }
                    }
                    hContext1.SaveChanges();
                    result = 1;
                }
                catch (Exception ex)
                {
                }
            }
            return(result);
        }