Esempio n. 1
0
 public HttpResponseBase GetProdInfo()
 {
     string jsonStr = String.Empty;
     try
     {
         string pid = Request.Params["id"].ToString();
         DataTable dt = new DataTable();
         _ipalet = new PalletMoveMgr(mySqlConnectionString);
         dt = _ipalet.GetProdInfo(pid);
         if (dt.Rows.Count > 0)
         {
             jsonStr = "{success:true,msg:\"" + dt.Rows[0]["product_name"] + "\",locname:'" + dt.Rows[0]["loc_id"] + "',yunsongtype:'" + dt.Rows[0]["product_mode"] + "',vendor_id:'" + dt.Rows[0]["vendor_id"] + "'}";//返回json數據
         }
         else
         {
             jsonStr = "{success:false,msg:0}";//返回json數據
         }
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
         jsonStr = "{success:false,msg:0}";
     }
     this.Response.Clear();
     this.Response.Write(jsonStr.ToString());
     this.Response.End();
     return this.Response;
 }
Esempio n. 2
0
 public void OutPalletSuggest()
 {
     IinvdQuery model = new IinvdQuery();
     _iinvd = new IinvdMgr(mySqlConnectionString);
     _ipalet = new PalletMoveMgr(mySqlConnectionString);
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["item_id"]))
         {
             string itemid = Request.Params["item_id"];
             DataTable dt = _ipalet.GetProdInfo(itemid);
             if (dt.Rows.Count > 0)
             {
                 model.item_id = uint.Parse(dt.Rows[0]["item_id"].ToString());
             }
             else
             {
                 model.item_id = 0;
             }
         }
         if (!string.IsNullOrEmpty(Request.Params["locid"]))
         {
             model.loc_id = Request.Params["locid"].ToUpper();
         }
         if (!string.IsNullOrEmpty(Request.Params["startIloc"]))
         {
             model.startIloc = Request.Params["startIloc"].ToUpper();
         }
         if (!string.IsNullOrEmpty(Request.Params["endIloc"]))
         {
             model.endIloc = Request.Params["endIloc"] + "Z";
             model.endIloc = model.endIloc.ToUpper();
         }
         if (!string.IsNullOrEmpty(Request.Params["number"]))
         {
             model.sums = int.Parse(Request.Params["number"]);
         }
         if (Request.Params["Auto"] == "true")
         {
             model.auto = 1;
         }
         DataTable dtHZ=_iinvd.ExportExcel(model);
         if(dtHZ.Rows.Count>0)
         {
             string fileName = "補貨建議報表_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
             MemoryStream ms = ExcelHelperXhf.ExportDT(dtHZ, "補貨建議報表(FIFO;副料位到主料位_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ")");
             Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
             Response.BinaryWrite(ms.ToArray());
         }
         else
         {
             Response.Clear();
             this.Response.Write("無數據存在<br/>");
         }
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
     }
 }
Esempio n. 3
0
        public HttpResponseBase GetIPlasEdit()
        {
            string json = string.Empty;
            IplasQuery iplas = new IplasQuery();
            Iloc iloc = new Iloc();
            Iupc upc = new Iupc();
            _IiplasMgr = new IplasMgr(mySqlConnectionString);
            _IlocMgr = new IlocMgr(mySqlConnectionString);
            _ipalet = new PalletMoveMgr(mySqlConnectionString);
            try
            {
                if (string.IsNullOrEmpty(Request.Params["plas_id"]))//首先考慮添加情況
                {
                    string itemid = Request.Params["item_id"];
                    DataTable dt = _ipalet.GetProdInfo(itemid);
                    if (dt.Rows.Count > 0)
                    {
                        iplas.item_id = uint.Parse(dt.Rows[0]["item_id"].ToString());
                    }
                    else
                    {
                        iplas.item_id = 0;
                    }
                    if (_IiplasMgr.IsTrue(iplas) == "false")
                    {
                        json = "{success:false,msg:\"" + "商品編號不存在" + "\"}";
                        this.Response.Clear();
                        this.Response.Write(json);
                        this.Response.End();
                        return this.Response;
                    }
                    if (_IiplasMgr.GetIplasid(iplas) > 0)
                    {
                        json = "{success:false,msg:\"" + "此商品已存在主料位" + "\"}";
                        this.Response.Clear();
                        this.Response.Write(json);
                        this.Response.End();
                        return this.Response;
                    }
                    iloc.loc_id = Request.Params["loc_id"].ToString().ToUpper();
                    if (_IiplasMgr.GetLocCount(iloc) <= 0)
                    {
                        json = "{success:false,msg:\"" + "非主料位或主料位已鎖定" + "\"}";
                        this.Response.Clear();
                        this.Response.Write(json);
                        this.Response.End();
                        return this.Response;
                    }
                    iplas.loc_id = Request.Params["loc_id"].ToString().ToUpper();
                    if (_IiplasMgr.GetIplasCount(iplas).Count > 0)//主料位重複
                    {
                        json = "{success:false,msg:\"" + "主料位重複" + "\"}";
                        this.Response.Clear();
                        this.Response.Write(json);
                        this.Response.End();
                        return this.Response;
                    }
                    iplas.loc_stor_cse_cap = int.Parse(Request.Params["loc_stor_cse_cap"]);
                    iplas.create_user = (Session["caller"] as Caller).user_id;
                    iplas.create_dtim = DateTime.Now;
                    iplas.change_user = (Session["caller"] as Caller).user_id;
                    iplas.change_dtim = DateTime.Now;
                    _IiplasMgr.InsertIplas(iplas);//判斷主料位和商品編號沒有問題,插入Iplas表的同時.操作iloc表,設置其為已指派料位
                    json = "{success:true}";
                }
                else//編輯
                {
                    iplas.plas_id = int.Parse(Request.Params["plas_id"]);
                    upc.upc_id = Request.Params["upcid"];
                    iplas.item_id = uint.Parse(Request.Params["item_id"]);
                    iplas.loc_id = Request.Params["loc_id"].ToString().ToUpper();
                    iloc.loc_id = iplas.loc_id;
                    if (_IiplasMgr.GetLocCount(iloc) <= 0)
                    {
                        json = "{success:false,msg:\"" + "非主料位或主料位已鎖定" + "\"}";
                        this.Response.Clear();
                        this.Response.Write(json);
                        this.Response.End();
                        return this.Response;
                    }
                    if (_IiplasMgr.GetIplasCount(iplas).Count > 0)//主料位重複
                    {
                        json = "{success:false,msg:\"" + "該主料位不可用!" + "\"}";
                        this.Response.Clear();
                        this.Response.Write(json);
                        this.Response.End();
                        return this.Response;
                    }
                    iplas.loc_stor_cse_cap = int.Parse(Request.Params["loc_stor_cse_cap"]);
                    iplas.change_user = (Session["caller"] as Caller).user_id;
                    iplas.change_dtim = DateTime.Now;
                    _IiplasMgr.UpIplas(iplas);
                    json = "{success:true}";
                }
            }
            catch (Exception ex)
            {

                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:false}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }