Exemplo n.º 1
0
 public MarketTallyMgr(string connectionString)
 {
     this.mySqlConnectionString = connectionString;
     _ivddao = new IinvdDao(connectionString);
     _aseldDao = new AseldDao(connectionString);
 }
Exemplo n.º 2
0
        public bool GETMarkTallyWD(AseldQuery ase, int act_pick_qty,string[] iinvd,string[] pick)
        {
            ////
            StringBuilder sb = new StringBuilder();
            string json = String.Empty;
            AseldQuery m = new AseldQuery();
            List<AseldQuery> list = new List<AseldQuery>();
            _aseldDao = new AseldDao(mySqlConnectionString);
            int flag = 2;
            int try1 = 0;
            try
            {
                m.seld_id = ase.seld_id;//aseld的流水號
                m.commodity_type = "2";//獲取寄倉2和調度3
                m.ord_qty = ase.ord_qty;//需要訂貨數量
                m.act_pick_qty = act_pick_qty;
                
                m.item_id = ase.item_id;
                m.out_qty = ase.out_qty - m.act_pick_qty;//缺貨數量
                m.act_pick_qty = m.ord_qty - m.out_qty;
                m.complete_dtim = DateTime.Now;
                m.assg_id = ase.assg_id;
                m.ord_id = ase.ord_id;
                m.ordd_id = ase.ordd_id;//商品細項編號。操作iwms_record需要
                m.change_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;
                m.deliver_code = ase.deliver_code;
                m.deliver_id = int.Parse(m.deliver_code.Substring(1, m.deliver_code.Length - 1).ToString());
                if (m.out_qty == 0)
                {//揀完了,判斷缺貨數量是否為0
                    m.wust_id = "COM";
                }
                else
                {//沒拿夠貨物
                    m.wust_id = "SKP";
                }
                sb.Append(_aseldDao.UpdAseld(m));
                if (m.commodity_type == "2")
                {
                    #region 寄倉--對庫存進行操作
                    Dictionary<string, string> dickuCun = new Dictionary<string, string>();
                    //if (Int32.TryParse(Request.Params["act_pick_qty"], out try1))
                    {
                        //string[] iinvd = Request.Params["pickRowId"].Split(',');
                        //string[] pick = Request.Params["pickInfo"].Split(',');
                        for (int i = 0; i < iinvd.Length; i++)
                        {
                            if (!dickuCun.Keys.Contains(iinvd[i]))
                            {
                                dickuCun.Add(iinvd[i], pick[i]);
                            }
                            else
                            {
                                dickuCun[iinvd[i]] = pick[i];
                            }
                        }
                    }
                    _iinvdDao = new IinvdDao(mySqlConnectionString);
                    if (!string.IsNullOrEmpty(_iinvdDao.updgry(m, dickuCun)))
                    {
                        sb.Append(_iinvdDao.updgry(m, dickuCun));
                    }
                    if (!string.IsNullOrEmpty(sb.ToString()))
                    {
                        _aseldDao.InsertSql(sb.ToString());//執行SQL語句裡面有事物處理
                    }
                    int ord = 1;
                    int can = 0;
                    #region  判斷項目狀態
                    if (_aseldDao.SelCom(m) == 0)
                    {
                        ord = 0;//訂單揀貨完成,可以封箱
                    }
                    if (_aseldDao.SelComA(m) == 0)
                    {
                        flag = 0;//項目訂單揀貨完成
                    }
                    if (ord == 0)
                    {//有沒有臨時取消的商品
                        if (_aseldDao.SelComC(m) > 0)
                        {
                            can = 1;
                        }
                    }
                    #endregion
                    json = "{success:true,qty:'" + m.out_qty + "',flag:'" + flag + "',ord:'" + ord + "',can:'" + can + "'}";//返回json數據  
                    //qty 該物品是否缺貨,如果為零揀貨完成,否則彈框提示缺貨數量。
                    //over:0表示該訂單已經揀貨完畢,如果qty為零則提示該訂單可以封箱,qty不為零則提示該訂單還缺物品的數量。不為零則不提示任何信息。
                    #endregion
                }
                
                //else if (m.commodity_type == "3")
                //{
                //    #region 調度--對庫存進行操作
                //    m.change_user = int.Parse((Session["caller"] as Caller).user_id.ToString());//操作iwms_record 需要插入create_uaer_id。对aseld中的change_user未做任何改变
                //    m.act_pick_qty = Int32.Parse(Request.Params["act_pick_qty"]);//下一步插入檢貨記錄表,每檢一次記錄一次,實際撿貨量以傳過來的值為標準
                //    if (_iasdMgr.getTime(m).Rows.Count > 0)
                //    {//獲取到有效期控管商品的保質期
                //        m.cde_dt_incr = int.Parse(_iasdMgr.getTime(m).Rows[0]["cde_dt_incr"].ToString());
                //        m.cde_dt_shp = int.Parse(_iasdMgr.getTime(m).Rows[0]["cde_dt_shp"].ToString());
                //    }
                //    if (!string.IsNullOrEmpty(Request.Params["cde_dt"]))
                //    {//獲取有效日期算出製造日期
                //        m.cde_dt = DateTime.Parse(Request.Params["cde_dt"]);
                //        if (m.cde_dt_incr > 0)
                //        {
                //            m.made_dt = m.cde_dt.AddDays(-m.cde_dt_incr);
                //        }
                //        else
                //        {
                //            m.made_dt = DateTime.Now;
                //        }
                //    }
                //    else if (!string.IsNullOrEmpty(Request.Params["made_dt"]))
                //    {//獲取製造日期獲取有效日期
                //        m.made_dt = DateTime.Parse(Request.Params["made_dt"]);
                //        if (m.cde_dt_incr > 0)
                //        {
                //            m.cde_dt = m.made_dt.AddDays(m.cde_dt_incr);
                //        }
                //        else
                //        {
                //            m.cde_dt = DateTime.Now;
                //        }
                //    }
                //    else
                //    {//不是有效期控管
                //        m.made_dt = DateTime.Now;
                //        m.cde_dt = DateTime.Now;
                //    }
                //    if (m.act_pick_qty > 0)
                //    {
                //        sb.Append(_iasdMgr.AddIwsRecord(m));
                //    }
                //    //m.act_pick_qty = m.ord_qty - m.out_qty;
                //    _iasdMgr.InsertSql(sb.ToString());//執行SQL語句裡面有事物處理
                //    int result = _iasdMgr.DecisionBulkPicking(m, 3);//判斷調度是否檢完,是否檢夠,是否可以裝箱

                //    json = "{success:true,msg:'" + result + "'" + "}";//返回json數據  
                //    #endregion
                //}
            }
            catch (Exception ex)
            {
                throw new Exception("MarketTallyMgr-->GETMarkTallyWD-->" + ex.Message, ex);
            }
            return true;
        }
Exemplo n.º 3
0
 public AseldMgr(string connectionStr)
 { 
     _aseldDao = new AseldDao(connectionStr);
     _iinvdDao = new IinvdDao(connectionStr);
 }