Exemplo n.º 1
0
 public string Insert(Aseld m)
 {
     try
     {
         return _aseldDao.Insert(m);
     }
     catch (Exception ex)
     {
         throw new Exception("AseldMgr-->Insert-->" + ex.Message, ex);
     }
 }
Exemplo n.º 2
0
 //通過工作代號判斷在表中是否存在
 public HttpResponseBase GetAseldMasterAssgCount()
 {
     string json = string.Empty;
     Aseld ase = new Aseld();
     AseldMaster aseMaster = new AseldMaster();
     int count = 0;
     try
     {
         _aseldmasterMgr = new AseldMasterMgr(mySqlConnectionString);
         if (!String.IsNullOrEmpty(Request.Params["number"].ToString().Trim()))//如果是新增
         {
             aseMaster.assg_id = Request.Params["number"].ToString().Trim();
             ase.assg_id = aseMaster.assg_id;
         }
         ase.change_dtim = DateTime.Now;
         ase.change_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;
         count = _aseldmasterMgr.SelectCount(aseMaster);
         _iasdMgr = new AseldMgr(mySqlConnectionString);
         if (count > 0)
         {//輸入的項目編號裡面有商品需要揀貨,把aseld裡面的scaned欄位初始化為0(主要在第二次揀貨時)
             _iasdMgr.UpdScaned(ase);
         }
         IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
         //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
         timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
         json = "{success:true,data:" + count + "}";//返回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;
 }
Exemplo n.º 3
0
        //根據工作代號、細項編號 獲取商品數據
        public HttpResponseBase GetAseldListByItemid()
        {//判斷寄倉或者調度
            string json = String.Empty;

            Aseld m = new Aseld();
            List<AseldQuery> list = new List<AseldQuery>();
            _iasdMgr = new AseldMgr(mySqlConnectionString);
            try
            {
                m.assg_id = Request.Params["assg_id"].ToString().Trim();
                if (!string.IsNullOrEmpty(Request.Params["item_id"]))
                {
                    m.item_id = Convert.ToUInt32(Request.Params["item_id"].ToString().Trim());
                }
                if (_iasdMgr.GetCountByItem(m) == 0)
                {
                    json = "{success:true,totalCount:" + 0 + ",msg:1,data:" + JsonConvert.SerializeObject(list, Formatting.Indented) + "}";//返回json數據     
                }
                else
                {
                    list = _iasdMgr.GetAseldListByItemid(m);
                    foreach (var item in list)
                    {
                        m.seld_id = item.seld_id;
                    }
                    m.wust_id = "BSY";
                    m.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;
                    _iasdMgr.Updwust(m);
                    json = "{success:true,totalCount:" + list.Count + ",msg:0,data:" + JsonConvert.SerializeObject(list, Formatting.Indented) + "}";//返回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,msg:0}";
            }
            this.Response.Clear();
            this.Response.Write(json.ToString());
            this.Response.End();
            return this.Response;
        }
Exemplo n.º 4
0
 public string UpdAseld(Aseld a)
 {
     try
     {
         return _aseldDao.UpdAseld(a);
     }
     catch (Exception ex)
     {
         throw new Exception("AseldMgr-->UpdAseld-->" + ex.Message, ex);
     }
 }
Exemplo n.º 5
0
 public int UpdateScnd(Aseld m)
 {
     StringBuilder sb = new StringBuilder();
     sb.AppendFormat(@" set sql_safe_updates = 0; UPDATE aseld SET scaned='0',change_dtim='{1}',change_user='******' WHERE ord_id='{0}'; set sql_safe_updates = 1; ", m.ord_id, CommonFunction.DateTimeToString(m.change_dtim), m.change_user);
     try
     {
         return _access.execCommand(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("AseldDao.UpdateScnd-->" + ex.Message + sb.ToString(), ex);
     }
 }
Exemplo n.º 6
0
 public int SelectCount(Aseld m)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.AppendFormat(@"select item_id from aseld where ord_id='{0}' and commodity_type=3 and wust_id !='COM' ", m.ord_id);
         return _access.getDataTable(sql.ToString()).Rows.Count;//返回條數
     }
     catch (Exception ex)
     {
         throw new Exception("AseldDao-->SelectCount-->" + ex.Message + sql.ToString(), ex);
     }
 }
Exemplo n.º 7
0
 //該項目訂單是否完成
 public int SelComA(Aseld m)
 {//and scaned<>'0'
     StringBuilder sb = new StringBuilder();
     sb.AppendFormat(@"select item_id from aseld WHERE assg_id='{0}' and commodity_type=2 and  wust_id<>'COM' and scaned = '0'  ; ", m.assg_id);
     try
     {
         return _access.getDataTable(sb.ToString()).Rows.Count;
     }
     catch (Exception ex)
     {
         throw new Exception("AseldDao.SelComA-->" + ex.Message + sb.ToString(), ex);
     }
 }
Exemplo n.º 8
0
 public string UpdAseld(Aseld m)
 {//初始值AVL.ABN放弃不回头捡,留到下次启动JOB再捡.SKP跳过料位,待会回头捡.BSY正在捡这个料位.料位的预期捡货量满足了才变COM.
     StringBuilder sb = new StringBuilder();
     sb.AppendFormat(@"  UPDATE aseld SET wust_id='{1}',out_qty='{2}',act_pick_qty='{3}',change_dtim='{4}',scaned='1' WHERE seld_id='{0}';  ", m.seld_id, m.wust_id, m.out_qty, m.act_pick_qty, CommonFunction.DateTimeToString(DateTime.Now));
     try
     {
         return sb.ToString();
     }
     catch (Exception ex)
     {
         throw new Exception("AseldDao.UpdAseld-->" + ex.Message + sb.ToString(), ex);
     }
 }
Exemplo n.º 9
0
        public List<AseldQuery> GetAseldListByItemid(Aseld a)
        {
            StringBuilder sb = new StringBuilder();//left join iloc ic on i.plas_loc_id=ic.loc_id 
            sb.AppendFormat(@"SELECT seld_id,assg_id,case when ip.loc_id is null then 'YY999999' else ip.loc_id end as sel_loc,CONCAT('(',a.item_id,')',v.brand_name,'-',p.product_name) as description,concat(IFNULL(ps1.spec_name,''),IFNULL(ps2.spec_name,'')) as prod_sz,ord_qty,out_qty,ord_id,cust_name,a.item_id,ordd_id,upc_id,i.cde_dt,pe.cde_dt_shp,deliver_id,deliver_code,o.note_order,ic.hash_loc_id 
FROM aseld a LEFT JOIN iinvd i ON a.item_id=i.item_id 

LEFT JOIN product_ext pe ON i.item_id = pe.item_id 
LEFT JOIN iplas ip on a.item_id=ip.item_id 
left join iloc ic on ip.loc_id=ic.loc_id  
LEFT JOIN product_item pi ON a.item_id = pi.item_id 
LEFT JOIN product_spec ps1 ON pi.spec_id_1 = ps1.spec_id
LEFT JOIN product_spec ps2 ON pi.spec_id_2 = ps2.spec_id
LEFT JOIN product p ON pi.product_id=p.product_id 
LEFT JOIN vendor_brand v ON p.brand_id=v.brand_id
LEFT JOIN order_master o ON a.ord_id=o.order_id
            WHERE assg_id='{0}' AND wust_id<>'COM' AND commodity_type='2' and scaned='0' ", a.assg_id);
            if (a.item_id != 0)
            {
                sb.AppendFormat(" and a.item_id='{0}' ",a.item_id);
            }
            sb.AppendFormat(" ORDER BY sel_loc,seld_id LIMIT 1;");
            
            try
            {
                return _access.getDataTableForObj<AseldQuery>(sb.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("AseldDao.GetAseldListByItemid-->" + ex.Message + sb.ToString(), ex);
            }
        }
Exemplo n.º 10
0
 public int Updwust(Aseld a)
 {
     try
     {
         return _aseldDao.Updwust(a);
     }
     catch (Exception ex)
     {
         throw new Exception("AseldMgr-->Updwust-->" + ex.Message, ex);
     }
 }
Exemplo n.º 11
0
 public int UpdateScnd(Aseld ase)
 {
     try
     {
         return _aseldDao.UpdateScnd(ase);
     }
     catch (Exception ex)
     {
         throw new Exception("AseldMgr-->UpdateScnd-->" + ex.Message, ex);
     }
 }
Exemplo n.º 12
0
 public int UpdScaned(Aseld m)
 {
     try
     {
         return _aseldDao.UpdScaned(m);
     }
     catch (Exception ex)
     {
         throw new Exception("AseldMgr-->UpdScaned-->" + ex.Message, ex);
     }
 }
Exemplo n.º 13
0
 public string updgry(Aseld a, Dictionary<string, string> str)
 {
     try
     {
         return _iinvdDao.updgry(a,str);
     }
     catch (Exception ex)
     {
         throw new Exception("AseldMgr-->updgry-->" + ex.Message, ex);
     }
 }
Exemplo n.º 14
0
 public int SelectCount(Aseld m)
 {
     try
     {
         return _aseldDao.SelectCount(m);
     }
     catch (Exception ex)
     {
         throw new Exception("AseldMgr-->SelectCount-->" + ex.Message, ex);
     }
 }
Exemplo n.º 15
0
 public int SelComA(Aseld a)
 {
     try
     {
         return _aseldDao.SelComA(a);
     }
     catch (Exception ex)
     {
         throw new Exception("AseldMgr-->SelComA-->" + ex.Message, ex);
     }
 }
Exemplo n.º 16
0
 public List<AseldQuery> GetAseldList(Aseld ase)
 {
     try
     {
         return _aseldDao.GetAseldList(ase);
     }
     catch (Exception ex)
     {
         throw new Exception("AseldMgr-->GetAseldList-->" + ex.Message, ex);
     }
 }
Exemplo n.º 17
0
        public string Insert(Aseld m)
        {
            StringBuilder sql = new StringBuilder();
            try
            {
                sql.Append(@"INSERT INTO aseld (dc_id,whse_id,ord_id,sgmt_id,ordd_id,cust_id,item_id,prdd_id,assg_id,sety_id,
unit_ship_cse,prod_cub,prod_wgt,prod_qty,sel_loc,ckpt_id,curr_pal_no,cse_lbl_lmt,wust_id,lic_plt_id,
description,prod_sz,hzd_ind,cust_name,order_type_id,stg_dcpt_id,stg_dcpd_id,invc_id,route_id,stop_id,
batch_id,batch_seq,start_dtim,complete_dtim,change_dtim,change_user,create_dtim,create_user,ord_msg_id,door_dcpd_id,
door_dcpt_id,catch_wgt_cntl,lot_no,commodity_type,sect_id,ucn,hzd_class,pkde_id,ord_rqst_del_dt,ord_rqst_del_tim,
spmd_id,flow_dcpt_id,flow_dcpd_id,flow_assg_flg,sel_seq_loc,out_qty,eqpt_class_id,sel_x_coord,sel_y_coord,sel_z_coord,
upc_id,ft_id,ftd_id,act_pick_qty,ord_qty,family_group,deliver_id,deliver_code) VALUES (");
                sql.AppendFormat(@"'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}',", m.dc_id, m.whse_id, m.ord_id, m.sgmt_id, m.ordd_id, m.cust_id, m.item_id, m.prdd_id, m.assg_id, m.sety_id);
                sql.AppendFormat(@"'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}',", m.unit_ship_cse, m.prod_cub, m.prod_wgt, m.prod_qty, m.sel_loc, m.ckpt_id, m.curr_pal_no, m.cse_lbl_lmt, m.wust_id, m.lic_plt_id);
                sql.AppendFormat(@"'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}',", m.description, m.prod_sz, m.hzd_ind, m.cust_name, m.order_type_id, m.stg_dcpd_id, m.stg_dcpt_id, m.invc_id, m.route_id, m.stop_id);
                sql.AppendFormat(@"'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}',", m.batch_id, m.batch_seq, Common.CommonFunction.DateTimeToString(m.start_dtim), Common.CommonFunction.DateTimeToString(m.complete_dtim), Common.CommonFunction.DateTimeToString(m.change_dtim), m.change_user, Common.CommonFunction.DateTimeToString(m.create_dtim), m.create_user, m.ord_msg_id, m.door_dcpd_id);
                sql.AppendFormat(@"'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}',", m.door_dcpt_id, m.catch_wgt_cntl, m.lot_no, m.commodity_type, m.sect_id, m.ucn, m.hzd_class, m.pkde_id, Common.CommonFunction.DateTimeToString(m.ord_rqst_del_dt), Common.CommonFunction.DateTimeToString(m.ord_rqst_del_tim));
                sql.AppendFormat(@"'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}',", m.spmd_id, m.flow_dcpt_id, m.flow_dcpd_id, m.flow_assg_flg, m.sel_seq_loc, m.out_qty, m.eqpt_class_id, m.sel_x_coord, m.sel_y_coord, m.sel_z_coord);
                sql.AppendFormat(@"'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}');", m.upc_id, m.ft_id, m.ftd_id, m.act_pick_qty, m.ord_qty, m.family_group, m.deliver_id, m.deliver_code);
                return sql.ToString();
            }
            catch (Exception ex)
            {
                throw new Exception("AseldDao-->Insert-->" + ex.Message + sql.ToString(), ex);
            }
        }
Exemplo n.º 18
0
        //生成理货单
        public HttpResponseBase CreateTallyList()
        {
            string json = String.Empty;
            Aseld m = new Aseld();
            AseldMaster am = new AseldMaster();
            StringBuilder sql = new StringBuilder();
            List<AseldQuery> list = new List<AseldQuery>();
            _iasdMgr = new AseldMgr(mySqlConnectionString);
            _aseldmasterMgr = new AseldMasterMgr(mySqlConnectionString);

            //string order_id = Request.Params["order_id"];
            string deliver_id = Request.Params["deliver_id"];
            string fre = Request.Params["type_id"];
            int radioselect = Convert.ToInt32(Request.Params["radio"]);

            //string ticket = "";
            if (deliver_id != "" && fre != "")
            {
                DateTime dt = DateTime.Now;
                string type_id = "N";
                if (fre != "2" && fre == "92")
                {
                    type_id = "F";
                }
                string assg = type_id + dt.ToString("yyyyMMddHHmmss");
                try
                {
                    if (!string.IsNullOrEmpty(deliver_id))
                    {
                        deliver_id = deliver_id.Substring(0, deliver_id.Length - 1).ToString();
                        DataTable selDT = _iasdMgr.SelOrderDetail(deliver_id, fre, radioselect);

                        foreach (DataRow r in selDT.Rows)
                        {
                            m.ordd_id = Convert.ToInt32(r["detail_id"]);
                            _iasdMgr.ConsoleAseldBeforeInsert(Convert.ToInt32(r["detail_id"]));
                            //ticket = ticket + item.ticket_id.ToString() + ',';

                            m.deliver_id = Convert.ToInt32(r["deliver_id"]);

                            m.deliver_code = CreateDeliverCode(r["deliver_id"].ToString());

                            m.ord_id = Int32.Parse(r["order_id"].ToString());//order_id
                            m.ordd_id = Int32.Parse(r["detail_id"].ToString());//od.detail_id
                            m.cust_id = r["user_id"].ToString();//om.user_id
                            m.hzd_ind = r["item_id"].ToString(); //od.item_id
                            m.item_id = Convert.ToUInt32(r["item_id"]);//od.item_id
                            m.assg_id = assg;
                            m.prod_qty = Int32.Parse(r["buy_num"].ToString());
                            if (r["sel_loc"].ToString() == "YY999999")
                            {
                                m.sel_loc = null;
                            }
                            else
                            {
                                m.sel_loc = r["sel_loc"].ToString();// i.loc_id
                            }
                            m.curr_pal_no = int.Parse(r["order_id"].ToString() + "1");//om.order_id
                            m.wust_id = "AVL";
                            m.description = Convert.ToString(r["description"]);//od.product_name
                            m.prod_sz = r["prod_sz"].ToString();//od.product_spec_name
                            m.cust_name = r["cust_name"].ToString();//om.delivery_name
                            m.invc_id = int.Parse(r["order_id"].ToString());//om.order_id
                            m.commodity_type = r["product_mode"].ToString();//2寄倉或者3調度
                            //if (m.commodity_type == "3")
                            //{
                            //    m.sel_loc = "ZZ999999";
                            //}
                            if (Convert.ToInt32(r["item_mode"]) != 0 && Convert.ToInt32(r["parent_num"]) != 0)
                            {
                                m.out_qty = m.prod_qty * Int32.Parse(r["parent_num"].ToString());
                                m.ord_qty = m.out_qty;
                            }
                            else
                            {
                                m.out_qty = m.prod_qty;
                                m.ord_qty = m.out_qty;
                            }
                            m.upc_id = r["upc_id"].ToString();//iu.upc_id
                            m.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;
                            sql.Append(_iasdMgr.Insert(m));//add aseld sql
                        }
                        am.assg_id = assg;
                        am.create_time = dt;
                        am.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;
                        sql.AppendFormat(_aseldmasterMgr.Insert(am));//add aseld sql
                        sql.AppendFormat(_iasdMgr.UpdTicker(deliver_id));//upd deliver_id 

                        int msg = _iasdMgr.InsertSql(sql.ToString());
                        if (msg > 0)
                        {
                            json = "{success:true,assg:'" + assg + "'}";
                        }
                        else
                        {
                            json = "{success:false,msg:0}";
                        }
                    }
                    else
                    {
                        json = "{success:false,msg:0}";
                    }
                }
                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,msg:0}";
                }
            }
            this.Response.Clear();
            this.Response.Write(json.ToString());
            this.Response.End();
            return this.Response;
        }
Exemplo n.º 19
0
        public int GetCountByItem(Aseld a)
        {
            StringBuilder sql = new StringBuilder();
            try
            {
                sql.AppendFormat(@"SELECT count(seld_id) as totalCount  FROM aseld a where 1=1 ");

                if (!string.IsNullOrEmpty(a.assg_id))
                {
                    sql.AppendFormat(" and a.assg_id='{0}' ", a.assg_id);
                }
                if (a.item_id != 0)
                {
                    sql.AppendFormat(" and a.item_id='{0}' ", a.item_id);
                }

                DataTable _dt = _access.getDataTable(sql.ToString());

                return Convert.ToInt32(_dt.Rows[0]["totalCount"]);

            }
            catch (Exception ex)
            {
                throw new Exception("AseldDao.GetCountByItem-->" + ex.Message + sql.ToString(), ex);
            }

        }
Exemplo n.º 20
0
 public HttpResponseBase Getfreight()
 {
     string json = string.Empty;
     Aseld q = new Aseld();
     string fre;
     try
     {
         _iasdMgr = new AseldMgr(mySqlConnectionString);
         if (!String.IsNullOrEmpty(Request.Params["number"]))//如果是新增
         {
             q.ord_id = Convert.ToInt32(Request.Params["number"]);
         }
         fre = _iasdMgr.Getfreight(q.ord_id.ToString());
         if (!string.IsNullOrEmpty(fre))
         {
             fre = fre.Substring(0, 1);
         }
         json = "{success:true,fre:'" + fre + "'}";//返回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}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Exemplo n.º 21
0
 //是否還有沒有撿的商品
 public int SelCom(Aseld m)
 {//
     StringBuilder sb = new StringBuilder();
     sb.AppendFormat(@"select item_id from aseld WHERE assg_id='{0}' and ord_id='{1}' and wust_id <> 'COM' AND deliver_id='{2}' ; ", m.assg_id, m.ord_id, m.deliver_id);
     try
     {
         return _access.getDataTable(sb.ToString()).Rows.Count;
     }
     catch (Exception ex)
     {
         throw new Exception("AseldDao.SelCom-->" + ex.Message + sb.ToString(), ex);
     }
 }
Exemplo n.º 22
0
 //理貨員工作--寄倉--獲取商品數據
 public HttpResponseBase JudgeAssg()
 {//判斷寄倉或者調度
     string json = String.Empty;
     string id = Request.Params["assg_id"];
     Aseld m = new Aseld();
     List<AseldQuery> list = new List<AseldQuery>();
     _iasdMgr = new AseldMgr(mySqlConnectionString);
     try
     {
         if (id.Length > 9)
         {//獲取寄倉信息
             m.assg_id = id;
             list = _iasdMgr.GetAseldList(m);
             foreach (var item in list)
             {
                 m.seld_id = item.seld_id;
             }
             m.wust_id = "BSY";
             m.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;
             _iasdMgr.Updwust(m);
         }
         json = "{success:true,data:" + JsonConvert.SerializeObject(list, Formatting.Indented) + "}";//返回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,msg:0}";
     }
     this.Response.Clear();
     this.Response.Write(json.ToString());
     this.Response.End();
     return this.Response;
 }
Exemplo n.º 23
0
        //該項目訂單是否有臨時退/換貨的商品
        public int SelComC(Aseld m)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat(@"select a.item_id from aseld a 
LEFT JOIN order_slave os ON a.ord_id=os.order_id
LEFT JOIN order_detail od ON os.slave_id=od.slave_id AND a.item_id=od.item_id
 WHERE assg_id='{0}' and a.ord_id='{1}'  AND od.detail_status in (90,10,89,20,91,92) ;", m.assg_id, m.ord_id);
            try
            {
                return _access.getDataTable(sb.ToString()).Rows.Count;
            }
            catch (Exception ex)
            {
                throw new Exception("AseldDao.SelComC-->" + ex.Message + sb.ToString(), ex);
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// 撿貨——調度流程頁面加載數據
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase GetMarkTallyTW()
        {
            string json = string.Empty;
            string ord_id = Request.Params["ord_id"];
            string type = Request.Params["type"];
            AseldQuery ase = new AseldQuery();
            Aseld m = new Aseld();
            try
            {
                if (!string.IsNullOrEmpty(Request.Params["ord_id"]))
                {
                    ase.ord_id = int.Parse(Request.Params["ord_id"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["freight_set"]))
                {
                    ase.freight_set = Request.Params["freight_set"].Substring(0, 1);
                }
                //if (!string.IsNullOrEmpty(Request.Params["deliver_code"]))
                //{
                //    ase.deliver_code = Request.Params["deliver_code"].Substring(0, 1);
                //}
                if (!string.IsNullOrEmpty(Request.Params["item_id"]))
                {
                    if (Request.Params["item_id"].Length == 6)
                    {
                        ase.item_id = uint.Parse(Request.Params["item_id"]);
                    }
                    else
                    {
                        ase.upc_id = Request.Params["item_id"];
                    }
                }
                _iasdMgr = new AseldMgr(mySqlConnectionString);
                DataTable dt = _iasdMgr.GetOrderProductInformation(ase);
                //0代表加載工作代號
                if (type == "0")//141980010
                {
                    if (dt.Rows.Count > 0)
                    {
                        json = "\"" + "assg_id" + "\"" + ":" + "\"" + dt.Rows[0]["assg_id"].ToString() + "\"";
                        json += ",\r\n" + "\"" + "deliver_code" + "\"" + ":" + "\"" + dt.Rows[0]["deliver_code"].ToString() + "\"";
                    }
                }
                else
                {
                    if (dt.Rows.Count > 0)
                    {
                        //json = "\"" + "assg_id" + "\"" + ":" + "\"" + dr["assg_id"].ToString() + "\"";
                        if (!string.IsNullOrEmpty(dt.Rows[0]["prod_sz"].ToString()))
                        {
                            json = "\"" + "product_name" + "\"" + ":" + "\"" + dt.Rows[0]["description"].ToString() + " (" + dt.Rows[0]["prod_sz"].ToString() + ")\"";
                        }
                        else
                        {
                            json = "\"" + "product_name" + "\"" + ":" + "\"" + dt.Rows[0]["description"].ToString() + " " + dt.Rows[0]["prod_sz"].ToString() + "\"";
                        }
                        //json = "\"" + "product_name" + "\"" + ":" + "\"" + dt.Rows[0]["description"].ToString() + " " + dt.Rows[0]["prod_sz"].ToString() + "\"";
                        json += ",\r\n" + "\"" + "seld_id" + "\"" + ":" + "\"" + dt.Rows[0]["seld_id"].ToString() + "\"";//row_id.唯一的
                        json += ",\r\n" + "\"" + "ord_qty" + "\"" + ":" + "\"" + dt.Rows[0]["ord_qty"].ToString() + "\"";//訂貨量
                        json += ",\r\n" + "\"" + "out_qty" + "\"" + ":" + "\"" + dt.Rows[0]["out_qty"].ToString() + "\"";//缺貨量
                        json += ",\r\n" + "\"" + "ordd_id" + "\"" + ":" + "\"" + dt.Rows[0]["ordd_id"].ToString() + "\"";
                        json += ",\r\n" + "\"" + "deliver_id" + "\"" + ":" + "\"" + dt.Rows[0]["deliver_id"].ToString() + "\"";
                        json += ",\r\n" + "\"" + "deliver_code" + "\"" + ":" + "\"" + dt.Rows[0]["deliver_code"].ToString() + "\"";
                        json += ",\r\n" + "\"" + "note_order" + "\"" + ":" + "\"" + dt.Rows[0]["note_order"].ToString() + "\"";
                        if (!string.IsNullOrEmpty(dt.Rows[0]["cde_dt_shp"].ToString()))
                        {
                            json += ",\r\n" + "\"" + "cde_dt_shp" + "\"" + ":" + "\"" + dt.Rows[0]["cde_dt_shp"].ToString() + "\"";//商品的允出天數

                        }
                        else
                        {
                            json += ",\r\n" + "\"" + "cde_dt_shp" + "\"" + ":" + "\"" + "999999" + "\"";//商品的允出天數
                        }
                        if (!string.IsNullOrEmpty(dt.Rows[0]["pwy_dte_ctl"].ToString()))
                        {
                            json += ",\r\n" + "\"" + "pwy_dte_ctl" + "\"" + ":" + "\"" + dt.Rows[0]["pwy_dte_ctl"].ToString() + "\"";//有效期控管
                        }
                        else
                        {
                            json += ",\r\n" + "\"" + "pwy_dte_ctl" + "\"" + ":" + "\"" + "N" + "\"";//有效期控管
                        }
                        #region 查詢商品信息同時把wust_id更改為BSY
                        m.wust_id = "BSY";
                        m.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;
                        if (!string.IsNullOrEmpty(dt.Rows[0]["seld_id"].ToString()))
                        {
                            m.seld_id = int.Parse(dt.Rows[0]["seld_id"].ToString());
                        }
                        _iasdMgr.Updwust(m);
                        #endregion
                    }
                    else
                    {//判斷條碼輸入的是否正確
                        DataTable data = new DataTable();
                        Iupc i = new Iupc();
                        _IiupcMgr = new IupcMgr(mySqlConnectionString);
                        if (!string.IsNullOrEmpty(ase.upc_id))
                        {
                            i.upc_id = ase.upc_id;
                            data = _IiupcMgr.upcid(i);
                            if (data.Rows.Count > 0)
                            {
                                json = "\"" + "item_id" + "\"" + ":" + "\"" + data.Rows[0]["item_id"].ToString() + "\"";
                            }
                        }
                    }
                }
                json = "{success:true,data:\r\n  {\r\n" + json + "\r\n} \r\n" + "}";
            }
            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:true,data:\r\n  {\r\n" + "" + "\r\n} \r\n" + "}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Exemplo n.º 25
0
 public int UpdScaned(Aseld a)
 {
     StringBuilder sb = new StringBuilder();
     try
     {
         if (!string.IsNullOrEmpty(a.assg_id))
         {
             sb.AppendFormat(" set sql_safe_updates = 0;UPDATE aseld SET scaned='0' where assg_id ='{0}' and wust_id !='COM'; set sql_safe_updates = 1; ", a.assg_id);
         }
         return _access.execCommand(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("AseldDao-->UpdScaned-->" + ex.Message + sb.ToString(), ex);
     }
 }
Exemplo n.º 26
0
 public string updgry(Aseld a, Dictionary<string, string> iinvd)// need item_id,act_pick_qty
 {//理貨員減去庫存
     StringBuilder sql = new StringBuilder();
     StringBuilder sb = new StringBuilder();
     DataTable dt = new DataTable();
     int sum = GetProqtyByItemid(int.Parse(a.item_id.ToString()));
     try
     {
         foreach (KeyValuePair<string, string> item in iinvd)
         {
             sql.Clear();
             //查詢日期控管的商品
             sql.AppendFormat(" select row_id,i.item_id,prod_qty,i.cde_dt,i.made_date,pe.cde_dt_incr,pe.cde_dt_shp from iinvd i LEFT JOIN product_ext pe ON i.item_id = pe.item_id and pwy_dte_ctl='Y' WHERE row_id='{0}';", item.Key);
             dt = _access.getDataTable(sql.ToString());
             if (dt.Rows.Count > 0)
             {
                 string cde_dt_incr = dt.Rows[0]["cde_dt_incr"].ToString();
                 string made_date = dt.Rows[0]["made_date"].ToString();
                 string cde_dt = dt.Rows[0]["cde_dt"].ToString();
                 string cde_dt_shp = "0";
                 if (!string.IsNullOrEmpty(dt.Rows[0]["cde_dt_shp"].ToString()))
                 {
                     cde_dt_shp = dt.Rows[0]["cde_dt_shp"].ToString();
                 }
                 if (string.IsNullOrEmpty(cde_dt_incr))
                 {
                     cde_dt_incr = "0";
                 }
                 if (string.IsNullOrEmpty(made_date))
                 {
                     made_date = DateTime.Now.ToString();
                 }
                 if (string.IsNullOrEmpty(cde_dt))
                 {
                     cde_dt = DateTime.Now.ToString();
                 }
                 int value = 0;
                 if (int.TryParse(item.Value, out value))
                 {
                     value = int.Parse(item.Value);
                 }
                 if (dt.Rows[0]["prod_qty"].ToString() == value.ToString())
                 {//刪除收貨上架表庫存,往iwms_record表添加數據
                     sb.AppendFormat("Delete from iinvd where row_id='{0}' ;", dt.Rows[0]["row_id"], int.Parse(dt.Rows[0]["prod_qty"].ToString()) - a.act_pick_qty);
                     sb.AppendFormat("INSERT INTO iwms_record (order_id,detail_id,act_pick_qty,cde_dt,create_date,create_user_id,made_dt,cde_dt_incr,cde_dt_shp) VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}');", a.ord_id, a.ordd_id, value, CommonFunction.DateTimeToString(DateTime.Parse(cde_dt)), CommonFunction.DateTimeToString(DateTime.Now), a.change_user, CommonFunction.DateTimeToString(DateTime.Parse(made_date.ToString())), cde_dt_incr, cde_dt_shp);
                     sb.AppendFormat("insert into istock_change(sc_trans_id,item_id,sc_trans_type,sc_num_old,sc_num_chg,sc_num_new,sc_time,sc_user,sc_istock_why,sc_note) Values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}');", a.ord_id, dt.Rows[0]["item_id"], "3", sum, "-" + value.ToString(), sum - value, CommonFunction.DateTimeToString(DateTime.Now), a.change_user, 4, "理貨撿貨");
                     sum = sum - value;
                 }
                 else if (int.Parse(dt.Rows[0]["prod_qty"].ToString()) > value)
                 {//扣除收貨上架表數據,往iwms_record表添加數據
                     if (value > 0)
                     {
                         sb.AppendFormat("UPDATE iinvd SET prod_qty='{1}' where row_id='{0}' ;", dt.Rows[0]["row_id"], int.Parse(dt.Rows[0]["prod_qty"].ToString()) - value);
                         sb.AppendFormat("INSERT INTO iwms_record (order_id,detail_id,act_pick_qty,cde_dt,create_date,create_user_id,made_dt,cde_dt_incr,cde_dt_shp) VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}');", a.ord_id, a.ordd_id, value, CommonFunction.DateTimeToString(DateTime.Parse(cde_dt)), CommonFunction.DateTimeToString(DateTime.Now), a.change_user, CommonFunction.DateTimeToString(DateTime.Parse(made_date.ToString())), cde_dt_incr, cde_dt_shp);
                         sb.AppendFormat("insert into istock_change(sc_trans_id,item_id,sc_trans_type,sc_num_old,sc_num_chg,sc_num_new,sc_time,sc_user,sc_istock_why,sc_note) Values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}');", a.ord_id, dt.Rows[0]["item_id"], "3", sum, "-" + value.ToString(), sum - value, CommonFunction.DateTimeToString(DateTime.Now), a.change_user, 4, "理貨撿貨");
                         sum = sum - value;
                     }
                 }
             }
         }
         return sb.ToString();
     }
     catch (Exception ex)
     {
         throw new Exception("IinvdDao-->updgry-->" + ex.Message + sql.ToString() + " sb:" + sb.ToString(), ex);
     }
 }
Exemplo n.º 27
0
 public int Updwust(Aseld m)
 {//BSY正在捡这个料位S.
     StringBuilder sb = new StringBuilder();
     sb.AppendFormat(@" UPDATE aseld SET wust_id='{1}',change_dtim='{2}',create_user='******' WHERE seld_id='{0}'; ", m.seld_id, m.wust_id, CommonFunction.DateTimeToString(DateTime.Now), m.create_user);
     try
     {
         return _access.execCommand(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("AseldDao.Updwust-->" + ex.Message + sb.ToString(), ex);
     }
 }
Exemplo n.º 28
0
        /// <summary>
        /// 判斷itemid是否在某個工作項中
        /// </summary>
        /// <param name="ase"></param>
        /// <returns></returns>

        public int GetCountByItem(Aseld a)
        {
            try
            {
                return _aseldDao.GetCountByItem(a);
            }
            catch (Exception ex)
            {
                throw new Exception("AseldMgr-->GetCountByItem-->" + ex.Message, ex);
            }
        }