Example #1
0
 public int Upd(Iinvd i)
 {
     try
     {
         //IstockChange m = new IstockChange();
         //m.item_id = i.item_id;
         //m.sc_trans_type = 1;
         //m.sc_num_old = GetProqtyByItemid(int.Parse(i.item_id.ToString()));
         //m.sc_num_chg = i.prod_qty - GetProqtyByItemid(int.Parse(i.item_id.ToString()));
         //m.sc_num_new = i.prod_qty;
         //m.sc_time = i.change_dtim;
         //m.sc_user = i.create_user;
         //if (_istockdao.insert(m) > 0)
         //{
         //    return _ivddao.Upd(i);
         //}
         //else
         //{
         //    return 0;
         //}
         return _ivddao.Upd(i);
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdMgr-->Upd-->" + ex.Message, ex);
     }
 }
Example #2
0
        public int Insert(Iinvd i)
        {
            try
            {
                //IstockChange m = new IstockChange();
                //m.item_id = i.item_id;
                //m.sc_trans_type = 1;
                //m.sc_num_old = GetProqtyByItemid(int.Parse(i.item_id.ToString()));
                //m.sc_num_chg = i.prod_qty;
                //m.sc_num_new = GetProqtyByItemid(int.Parse(i.item_id.ToString())) + i.prod_qty;
                //m.sc_time = i.create_dtim;
                //m.sc_user = i.create_user;
                return _ivddao.Insert(i);

            }
            catch (Exception ex)
            {
                throw new Exception("IinvdMgr-->Insert-->" + ex.Message, ex);
            }
        }
 public HttpResponseBase AboutItemidLocid()
 {
     string json = string.Empty;
     Iinvd invd = new Iinvd();
     int result = 0;
     try
     {
         invd.plas_loc_id = Request.Params["tloc_id"].ToUpper();
         invd.item_id = Convert.ToUInt32(Request.Params["titem_id"]);
         _iinvd = new IinvdMgr(mySqlConnectionString);
         result = _iinvd.AboutItemidLocid(invd);
         if (result > 0)
         {
             json = "{success:true}";//返回json數據
         }
         else
         {
             json = "{success:true,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);
         json = "{success:false,totalCount:0,data:[]}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Example #4
0
 public int Updateiinvdstqty(Iinvd invd)
 {
     try
     {
         return _ivddao.Updateiinvdstqty(invd);
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdMgr-->Updateiinvdstqty-->" + ex.Message, ex);
     }
 }
Example #5
0
 public int AboutItemidLocid(Iinvd invd)
 {
     try
     {
         return _ivddao.AboutItemidLocid(invd);
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdMgr-->AboutItemidLocid-->" + ex.Message, ex);
     }
 }
Example #6
0
 public int kucunTiaozheng(Iinvd invd)
 {
     try
     {
         return _ivddao.kucunTiaozheng(invd);
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdMgr-->kucunTiaozheng-->" + ex.Message, ex);
     }
 }
Example #7
0
 public int Selnum(Iinvd m)
 {
     try
     {
         return _ivddao.Selnum(m);
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdMgr-->Selnum-->" + ex.Message, ex);
     }
 }        
Example #8
0
 public int Updateiinvdstqty(Iinvd invd)
 {
     StringBuilder sb = new StringBuilder();
     try
     {
         sb.AppendFormat("update iinvd set st_qty='{0}',create_user='******',create_dtim='{2}' where row_id='{3}'", invd.st_qty, invd.create_user, CommonFunction.DateTimeToString(invd.create_dtim), invd.row_id);
         return _access.execCommand(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdDao-->AboutItemidLocid-->" + ex.Message + sb.ToString(), ex);
     }
 }
Example #9
0
 public List<Iinvd> GetIinvd(Iinvd i)
 {
     StringBuilder sb = new StringBuilder();
     try
     {
         if (i.row_id > 0)
         {
             sb.AppendFormat("SELECT row_id,prod_qty,plas_loc_id,item_id,cde_dt,made_date from iinvd where row_id='{0}' LIMIT 1;", i.row_id);
             return _access.getDataTableForObj<Iinvd>(sb.ToString());
         }
         else
         {
             return null;
         }
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdDao-->GetIinvd-->" + ex.Message + sb.ToString(), ex);
     }
 }
Example #10
0
 public int sum(Iinvd i, string lcat_id)
 {
     StringBuilder sb = new StringBuilder();
     int sum = 0;
     if (!String.IsNullOrEmpty(i.item_id.ToString()) && !String.IsNullOrEmpty(lcat_id))
     {
         sb.AppendFormat("SELECT sum(prod_qty) AS prod_qty from iinvd i LEFT JOIN iloc il ON i.plas_loc_id=il.loc_id where item_id='{0}' AND ista_id='A' AND il.lcat_id='{1}' ", i.item_id, lcat_id);
     }
     if (!string.IsNullOrEmpty(i.made_date.ToString()) && i.made_date != DateTime.MinValue)
     {
         sb.AppendFormat(" AND i.made_date='{0}' ", i.made_date.ToShortDateString());
     }
     try
     {
         if (string.IsNullOrEmpty(_access.getDataTable(sb.ToString()).Rows[0]["prod_qty"].ToString()))
         {
             sum = 0;
         }
         else
         {
             sum = int.Parse(_access.getDataTable(sb.ToString()).Rows[0]["prod_qty"].ToString());
         }
         return sum;
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdDao-->sum-->" + ex.Message + sb.ToString(), ex);
     }
 }
Example #11
0
        /// <summary>
        /// chaojie1124j添加于2015/6/1 通過商品編號查詢所有的庫存。
        /// 實現料位管理->料位移動記錄的庫存欄位
        /// </summary>
        /// <param name="i"></param>
        /// <returns></returns>
        public int SumProd_qty(Iinvd i)
        {
            StringBuilder sb = new StringBuilder();
            int sum = 0;
            try
            {

                if (!String.IsNullOrEmpty(i.item_id.ToString()))
                {
                    sb.AppendFormat("SELECT sum(prod_qty) AS prod_qty from iinvd i  where i.item_id='{0}' ", i.item_id);
                }
                if (string.IsNullOrEmpty(_access.getDataTable(sb.ToString()).Rows[0]["prod_qty"].ToString()))
                {
                    sum = 0;
                }
                else
                {
                    sum = int.Parse(_access.getDataTable(sb.ToString()).Rows[0]["prod_qty"].ToString());
                }
                return sum;
            }
            catch (Exception ex)
            {
                throw new Exception("IinvdDao-->SumProd_qty-->" + ex.Message + sb.ToString(), ex);
            }
        }
Example #12
0
 public int AboutItemidLocid(Iinvd invd)
 {
     StringBuilder str = new StringBuilder();
     StringBuilder sb = new StringBuilder();
     StringBuilder sql = new StringBuilder();
     str.AppendFormat(@"SELECT plas_id FROM iplas WHERE loc_id='{0}' and item_id='{1}'", invd.plas_loc_id, invd.item_id);
     try
     {
         DataTable _dtone = _access.getDataTable(str.ToString());
         if (_dtone.Rows.Count > 0)
         {
             return _dtone.Rows.Count;
         }
         else
         {
             sb.AppendFormat(@" select row_id from iinvd where item_id='{0}' and plas_loc_id='{1}' ", invd.item_id, invd.plas_loc_id);
             DataTable dt = _access.getDataTable(sb.ToString());
             if (dt.Rows.Count > 0)
             {
                 return dt.Rows.Count;
             }
             else
             {
                 sql.AppendFormat(@" SELECT row_id FROM iloc WHERE loc_id='{0}' and loc_status=1 and lcat_id='R'", invd.plas_loc_id);
                 DataTable _locDt = new DataTable();
                 _locDt = _access.getDataTable(sql.ToString());
                 return _locDt.Rows.Count;
             }
         }
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdDao-->AboutItemidLocid-->" + ex.Message + sb.ToString(), ex);
     }
 }
Example #13
0
 public DataTable GetRowMsg(Iinvd invd)
 {
     StringBuilder sb = new StringBuilder();
     sb.AppendFormat(@"SELECT made_date,cde_dt from iinvd where row_id='{0}' limit 1 ", invd.row_id);
     try
     {
         return _access.getDataTable(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdDao.GetRowMsg-->" + ex.Message + sb.ToString(), ex);
     }
 }
Example #14
0
        public HttpResponseBase Updateiinvdstqty()
        {
            int result = 0;
            string json = string.Empty;
            Iinvd invd = new Iinvd();

            if (!string.IsNullOrEmpty(Request.Params["row_id"].Trim()))
            {
                invd.row_id = Convert.ToInt32(Request.Params["row_id"].Trim());//獲取工作編號
            }
            if (!string.IsNullOrEmpty(Request.Params["stqty"].Trim()))
            {
                invd.st_qty = Convert.ToInt32(Request.Params["stqty"].Trim());//獲取工作編號
            }
            invd.create_dtim = DateTime.Now;       //創建時間
            invd.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;
            try
            {
                _iinvd = new IinvdMgr(mySqlConnectionString);
                result = _iinvd.Updateiinvdstqty(invd);
                if (result > 0)
                {
                    json = "{success:true}";//返回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);
                json = "{success:false,totalCount:0,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Example #15
0
        public int HuiruInsertiialg(System.Data.DataRow[] dr, out int iialgtotal, out int iinvdtotal)
        {
            int result = 0;
            iialgtotal = 0;
            iinvdtotal = 0;
            DataTable dt = new DataTable();
            Iinvd invd = new Iinvd();
            IialgQuery ialg = new IialgQuery();
            StringBuilder sb = new StringBuilder();
            StringBuilder invdsb = new StringBuilder();
            StringBuilder ialgsb = new StringBuilder();
            ialg.doc_no = "K" + DateTime.Now.ToString("yyyyMMddHHmmss");//庫調單號
            for (int i = 1; i < dr.Length; i++)
            {
                string row_id = string.Empty;
                row_id = dr[i][0].ToString().Trim();
                if (!string.IsNullOrEmpty(row_id))
                {
                    invd.row_id = int.Parse(dr[i][0].ToString().Trim());
                    invd.prod_qty = int.Parse(dr[i][5].ToString().Trim());
                    invdsb.AppendFormat(" update iinvd set prod_qty ='{0}' where row_id='{1}'; ", invd.prod_qty, invd.row_id);
                    iialgtotal++;
                    if (!string.IsNullOrEmpty(dr[i][4].ToString().Trim()))//當存在復盤值時
                    {
                        ialg.row_id = int.Parse(dr[i][0].ToString().Trim());
                        ialg.qty_o = int.Parse(dr[i][5].ToString().Trim());
                        ialg.adj_qty = int.Parse(dr[i][4].ToString().Trim()) - int.Parse(dr[i][5].ToString().Trim());
                        ialg.loc_id = dr[i][1].ToString().Trim();
                        ialg.item_id = Convert.ToUInt32(dr[i][3].ToString().Trim());
                        if (!string.IsNullOrEmpty(dr[i][10].ToString().Trim()))
                        {
                            ialg.made_dttostr = dr[i][10].ToString().Trim();
                        }
                        if (!string.IsNullOrEmpty(dr[i][11].ToString().Trim()))
                        {
                            ialg.cde_dttostr = dr[i][11].ToString().Trim();
                        }
                        ialg.create_dtim = DateTime.Now;
                        ialg.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;
                        ialg.iarc_id = "PC";
                        ialg.po_id = string.Empty;
                        ialgsb.AppendFormat(@"insert into iialg (loc_id,item_id,iarc_id,qty_o,create_dtim,create_user,doc_no,po_id, made_dt,cde_dt,adj_qty)
 values ('{0}','{1}','{2}','{3}', '{4}','{5}', '{6}','{7}','{8}','{9}','{10}'); ", ialg.loc_id, ialg.item_id, ialg.iarc_id, ialg.qty_o, CommonFunction.DateTimeToString(ialg.create_dtim),
  ialg.create_user, ialg.doc_no, ialg.po_id, ialg.made_dttostr, ialg.cde_dttostr, ialg.adj_qty);
                        iinvdtotal++;
                    }
                }
            }
            sb.AppendFormat(invdsb.ToString()+ialgsb.ToString());
            MySqlCommand mySqlCmd = new MySqlCommand();
            MySqlConnection mySqlConn = new MySqlConnection(connStr);
            try
            {
                if (mySqlConn != null && mySqlConn.State == System.Data.ConnectionState.Closed)
                {
                    mySqlConn.Open();
                }
                mySqlCmd.Connection = mySqlConn;
                mySqlCmd.Transaction = mySqlConn.BeginTransaction();
                mySqlCmd.CommandType = System.Data.CommandType.Text;
           
                mySqlCmd.CommandText = sb.ToString();
                result = mySqlCmd.ExecuteNonQuery();
                mySqlCmd.Transaction.Commit();
            }
            catch (Exception ex)
            {
                mySqlCmd.Transaction.Rollback();
                throw new Exception("IialgDao.HuiruInsertiialg-->" + ex.Message + sb.ToString(), ex);
            }
            finally
            {
                if (mySqlConn != null && mySqlConn.State == System.Data.ConnectionState.Open)
                {
                    mySqlConn.Close();
                }
            }
            return result;
        }
Example #16
0
 public int Insert(Iinvd ivd)
 {
     StringBuilder sql = new StringBuilder();
     sql.AppendLine(@"insert into iinvd (lic_plt_id,dc_id,whse_id,po_id,plas_id,prod_qty,");
     sql.AppendLine(@"rcpt_id,lot_no,hgt_used,create_user,create_dtim,");
     sql.AppendLine(@"change_user,change_dtim,cde_dt,ista_id,receipt_dtim,");
     sql.AppendLine(@"stor_ti,stor_hi,inv_pos_cat,qity_id,");
     sql.AppendLine(@"plas_loc_id,item_id,plas_prdd_id,made_date) VALUES (");
     sql.AppendFormat(@"'{0}','{1}','{2}','{3}',", ivd.lic_plt_id, ivd.dc_id, ivd.whse_id, ivd.po_id);
     sql.AppendFormat(@"'{0}','{1}','{2}','{3}',", ivd.plas_id, ivd.prod_qty, ivd.rcpt_id, ivd.lot_no);
     sql.AppendFormat(@"'{0}','{1}','{2}','{3}',", ivd.hgt_used, ivd.create_user, CommonFunction.DateTimeToString(ivd.create_dtim), ivd.create_user);
     sql.AppendFormat(@"'{0}','{1}','{2}','{3}',", CommonFunction.DateTimeToString(ivd.change_dtim), CommonFunction.DateTimeToString(ivd.cde_dt), ivd.ista_id, CommonFunction.DateTimeToString(ivd.receipt_dtim));
     sql.AppendFormat(@"'{0}','{1}','{2}','{3}',", ivd.stor_ti, ivd.stor_hi, ivd.inv_pos_cat, ivd.qity_id);
     sql.AppendFormat(@"'{0}','{1}','{2}','{3}')", ivd.plas_loc_id.ToString().ToUpper(), ivd.item_id, ivd.plas_prdd_id, CommonFunction.DateTimeToString(ivd.made_date));
     try
     {
         return _access.execCommand(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdDao-->Insert-->" + ex.Message + sql.ToString(), ex);
     }
 }
Example #17
0
 public int IsUpd(Iinvd i,IstockChangeQuery stock=null)/*chaojie1124j添加,區分是庫存調整,還是收貨上架*/
 {
     try
     {
         IstockChange m = new IstockChange();
         m.item_id = i.item_id;
         if (stock.sc_trans_type == 1)//收貨上架
         {
             m.sc_trans_type = 1;//1.收貨上架,2表示庫調
             m.sc_istock_why = 3;//3.收貨上架,2.庫調,1.庫鎖
         }
         if (stock.sc_trans_type == 0)//庫存調整
         {
             m.sc_trans_type = 2;
             m.sc_istock_why = 2;//2表示庫調
             m.sc_trans_id = stock.sc_trans_id;
             m.sc_cd_id = stock.sc_cd_id;
             m.sc_note = stock.sc_note;
         }
         m.sc_num_old = GetProqtyByItemid(int.Parse(i.item_id.ToString()));
         m.sc_num_chg = i.prod_qty;
         m.sc_num_new = GetProqtyByItemid(int.Parse(i.item_id.ToString())) + i.prod_qty;
         m.sc_time = i.change_dtim;
         m.sc_user = i.create_user;
        
         _istockdao.insert(m);
         return _ivddao.IsUpd(i);
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdMgr-->IsUpd-->" + ex.Message, ex);
     }
 }
Example #18
0
 public int Upd(Iinvd m)
 {
     StringBuilder sql = new StringBuilder();
     StringBuilder sb = new StringBuilder();
     if (m.prod_qty > 0)
     {
         sql.Append("set sql_safe_updates = 0;");
         sql.AppendFormat("UPDATE iinvd SET prod_qty='{2}',change_dtim='{3}',change_user='******' WHERE plas_loc_id='{0}' and cde_dt='{4}' AND item_id='{1}';", m.plas_loc_id, m.item_id, m.prod_qty, CommonFunction.DateTimeToString(m.change_dtim), CommonFunction.DateTimeToString(m.cde_dt), m.create_user);
         sql.Append("set sql_safe_updates = 1;");
     }
     else
     {
         sb.AppendFormat("select item_id from iinvd where plas_loc_id='{0}' AND item_id='{1}';", m.plas_loc_id, m.item_id);
         DataTable dt = _access.getDataTable(sb.ToString());
         if (dt.Rows.Count > 1)
         {
             sql.AppendFormat("Delete from iinvd where plas_loc_id='{0}' AND item_id='{1}' AND cde_dt='{2}';", m.plas_loc_id, m.item_id, CommonFunction.DateTimeToString(m.cde_dt));
         }
         else
         {
             sql.Append("set sql_safe_updates = 0;");
             sql.AppendFormat("UPDATE iloc SET Ista_id='F'  where lcat_id='R' AND plas_loc_id='{0}';", m.plas_loc_id);
             sql.Append("set sql_safe_updates = 1;");
             sql.AppendFormat("Delete from iinvd where plas_loc_id='{0}' AND item_id='{1}' AND cde_dt='{2}';", m.plas_loc_id, m.item_id, CommonFunction.DateTimeToString(m.cde_dt));
         }
     }
     try
     {
         return _access.execCommand(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdDao-->Upd-->" + ex.Message + sql.ToString(), ex);
     }
 }
Example #19
0
 public int UpdateIinvdLock(Iinvd i,IialgQuery q)
 {
     try
     {
         IstockChange m = new IstockChange();
         m.item_id = GetIinvd(i).FirstOrDefault().item_id;
         m.sc_trans_type = 1;
         m.sc_num_old = GetProqtyByItemid(int.Parse(m.item_id.ToString()));
         m.sc_num_chg = GetIinvd(i).FirstOrDefault().prod_qty;
         if (i.ista_id=="H")
         {
             m.sc_num_chg = -m.sc_num_chg;                
         }
         m.sc_num_new = m.sc_num_old + m.sc_num_chg;
         m.sc_time = i.change_dtim;
         m.sc_user = i.change_user;
         m.sc_trans_id = q.po_id;
         m.sc_note = q.remarks;
         m.sc_istock_why = 1;
         if (_istockdao.insert(m) > 0)
         {
             return _ivddao.UpdateIinvdLock(i);
         }
         else
         {
             return 0;
         }
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdMgr-->UpdateIinvdLock-->" + ex.Message, ex);
     }
 }
Example #20
0
 public string UpdProdqty(Iinvd m)
 {
     StringBuilder sql = new StringBuilder();
     StringBuilder sb = new StringBuilder();
     try
     {
         if (m.prod_qty > 0)
         {
             sql.Append("set sql_safe_updates = 0;");
             sql.AppendFormat("UPDATE iinvd SET prod_qty='{1}',change_dtim='{2}',change_user='******' WHERE row_id='{0}';", m.row_id, m.prod_qty, CommonFunction.DateTimeToString(m.change_dtim), m.change_user);
             sql.Append("set sql_safe_updates = 1;");
         }
         else
         {
             sb.AppendFormat("SELECT plas_loc_id from iinvd where plas_loc_id=(select plas_loc_id from iinvd where row_id='{0}');", m.row_id);
             DataTable dt = _access.getDataTable(sb.ToString());
             if (dt.Rows.Count > 1)
             {
                 sql.AppendFormat("Delete from iinvd where row_id='{0}';", m.row_id);
             }
             else
             {
                 sql.Append("set sql_safe_updates = 0;");
                 sql.AppendFormat("UPDATE iloc SET lsta_id='F'  where lcat_id='R' AND loc_id='{0}';", dt.Rows[0]["plas_loc_id"].ToString());
                 sql.Append("set sql_safe_updates = 1;");
                 sql.AppendFormat("Delete from iinvd where row_id='{0}';", m.row_id);
             }
         }
         return sql.ToString();
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdDao-->UpdProdqty-->" + ex.Message + sql.ToString(), ex);
     }
 }
Example #21
0
 public string UpdProdqty(Iinvd m)
 {
     try
     {
         return _ivddao.UpdProdqty(m);
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdMgr-->UpdProdqty-->" + ex.Message, ex);
     }
 }
Example #22
0
 public int IsUpd(Iinvd m)
 {//是否編輯
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.AppendFormat("SELECT row_id from iinvd where plas_loc_id='{0}' AND item_id='{1}' AND cde_dt='{2}';", m.plas_loc_id, m.item_id, m.cde_dt.ToShortDateString());
         return _access.getDataTable(sql.ToString()).Rows.Count;
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdDao-->IsUpd-->" + ex.Message + sql.ToString(), ex);
     }
 }
Example #23
0
 public DataTable GetRowMsg(Iinvd invd)
 {
     try
     {
         return _ivddao.GetRowMsg(invd);
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdMgr-->GetRowMsg-->" + ex.Message, ex);
     }
 }
Example #24
0
 public int Selnum(Iinvd m)
 {//查詢之前庫存
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.AppendFormat("SELECT prod_qty from iinvd where plas_loc_id='{0}' AND item_id='{1}' AND cde_dt='{2}';", m.plas_loc_id, m.item_id, CommonFunction.DateTimeToShortString(m.cde_dt));
         DataTable table = _access.getDataTable(sql.ToString());
         if(table.Rows.Count>0)
         {
             return Int32.Parse(table.Rows[0]["prod_qty"].ToString());
         }
         return 0;   
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdDao-->Selnum-->" + ex.Message + sql.ToString(), ex);
     }
 }//
Example #25
0
 public int sum(Iinvd i, string lcat_id)
 {
     try
     {
         return _ivddao.sum(i, lcat_id);
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdMgr-->sum-->" + ex.Message, ex);
     }
 }
Example #26
0
 public int UpdateIinvdLock(Iinvd nvd)
 {
     StringBuilder sb = new StringBuilder();
     sb.AppendFormat(@" update iinvd set ista_id='{0}',change_user='******',change_dtim='{2}',qity_id='{3}' where row_id='{4}' ", nvd.ista_id, nvd.change_user, Common.CommonFunction.DateTimeToString(nvd.change_dtim), nvd.qity_id, nvd.row_id);
     try
     {
         return _access.execCommand(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdDao-->UpdateIinvdLock-->" + ex.Message + sb.ToString(), ex);
     }
 }
Example #27
0
 public List<Iinvd> GetIinvd(Iinvd i)
 {
     try
     {
         return _ivddao.GetIinvd(i);
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdMgr-->GetIinvd-->" + ex.Message, ex);
     }
 }
Example #28
0
 public int kucunTiaozheng(Iinvd invd)
 {
     StringBuilder sb = new StringBuilder();
     if (invd.prod_qty == 0)
     {
         StringBuilder sbstr = new StringBuilder();
         StringBuilder sbstr2 = new StringBuilder();
         sbstr.AppendFormat("select plas_loc_id from iinvd where row_id ='{0}';", invd.row_id);
         DataTable qtdt = _access.getDataTable(sbstr.ToString());
         sbstr2.AppendFormat("select row_id from iinvd where plas_loc_id='{0}';", qtdt.Rows[0][0]);
         DataTable qtdt2 = _access.getDataTable(sbstr2.ToString());
         sb.Append("set sql_safe_updates = 0;");
         sb.AppendFormat("delete from iinvd where row_id='{0}';", invd.row_id);
         sb.Append("set sql_safe_updates = 1;");
         if (qtdt2.Rows.Count < 2)
         {
             sb.AppendFormat("set sql_safe_updates = 0;");
             sb.AppendFormat("update iloc set lsta_id='F' where loc_id='{0}' and lcat_id='R';", qtdt.Rows[0][0]);
             sb.AppendFormat("set sql_safe_updates = 1;");
         }
     }
     else
     {
         sb.AppendFormat("set sql_safe_updates = 0;");
         sb.AppendFormat(@" update iinvd set prod_qty='{0}',change_user='******',change_dtim='{2}' where row_id='{3}'; ", invd.prod_qty, invd.change_user, Common.CommonFunction.DateTimeToString(invd.change_dtim), invd.row_id);
         sb.AppendFormat("set sql_safe_updates = 1;");
     }
     try
     {
         return _access.execCommand(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdDao-->kucunTiaozheng-->" + ex.Message + sb.ToString(), ex);
     }
 }
Example #29
0
        public int SumProd_qty(Iinvd i) 
        {
            try
            {

                return _ivddao.SumProd_qty(i);
               
            }
            catch (Exception ex)
            {
                throw new Exception("IinvdMgr-->SumProd_qty-->" + ex.Message, ex);
            }
        }
Example #30
0
        public HttpResponseBase InsertIialg()
        {
            string json = string.Empty;
            IialgQuery iagQuery = new IialgQuery();
            Iinvd invd = new Iinvd();
            int result = 0;
            try
            {
                invd.row_id = Convert.ToInt32(Request.Params["row_id"]);//行號碼 
                _iinvd = new IinvdMgr(mySqlConnectionString);
                DataTable dt = _iinvd.GetRowMsg(invd);//首先根據row_id 獲取到製造日期和有效日期
                iagQuery.made_dt = Convert.ToDateTime(dt.Rows[0]["made_date"]);//製造日期
                iagQuery.cde_dt = Convert.ToDateTime(dt.Rows[0]["cde_dt"]);//有效日期
                if (!string.IsNullOrEmpty(Request.Params["item_id"]))//商品細項編號
                {
                    iagQuery.item_id = Convert.ToUInt32(Request.Params["item_id"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["po_id"]))
                {
                    iagQuery.po_id = Request.Params["po_id"];//採購單編號
                }
                if (!string.IsNullOrEmpty(Request.Params["iarc_id"]))
                {
                    iagQuery.iarc_id = Request.Params["iarc_id"];//庫調原因
                }
                if (!string.IsNullOrEmpty(Request.Params["ktloc_id"]))
                {
                    iagQuery.loc_id = Request.Params["ktloc_id"].ToUpper();//料位編號
                }
                if (!string.IsNullOrEmpty(Request.Params["doc_no"]))
                {
                    iagQuery.doc_no = Request.Params["doc_no"];//庫調單號
                }
                if (!string.IsNullOrEmpty(Request.Params["remarks"]))
                {
                    iagQuery.remarks = Request.Params["remarks"];//庫調單號
                }
                if (!string.IsNullOrEmpty(Request.Params["made_date"]))//創建時間
                {
                    iagQuery.made_dt = Convert.ToDateTime(Request.Params["made_date"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["end_date"]))//有效日期
                {
                    iagQuery.cde_dt = Convert.ToDateTime(Request.Params["end_date"]);//庫調單號
                }
                int kucuncount = Convert.ToInt32(Request.Params["benginnumber"]);//庫存數量
                int tiaozhengcount = Convert.ToInt32(Request.Params["changenumber"]);//調整數量
                int kucuntype = Convert.ToInt32(Request.Params["kutiaotype"]);//庫存類型
                if (kucuntype == 1)
                {
                    iagQuery.adj_qty = tiaozhengcount; //調整庫存
                }
                else
                {
                    iagQuery.adj_qty = tiaozhengcount * (-1);//調整庫存
                }
                iagQuery.qty_o = kucuncount;//原來庫存
                iagQuery.create_dtim = DateTime.Now;
                iagQuery.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;

                if (!string.IsNullOrEmpty(Request.Params["ktloc_id"]))
                {
                    iagQuery.loc_id = Request.Params["ktloc_id"];
                }
                if (!string.IsNullOrEmpty(Request.Params["doc_no"]))
                {
                    iagQuery.doc_no = Request.Params["doc_no"];
                }
                _iagMgr = new IialgMgr(mySqlConnectionString);
                result = _iagMgr.insertiialg(iagQuery);
                if (result > 0)
                {
                    json = "{success:true}";//返回json數據
                }
                else
                {
                    json = "{success:false}";//返回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);
                json = "{success:false,totalCount:0,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }