예제 #1
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;
 }
예제 #2
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;
        }