private void ButtonLoginOnClick(object sender, EventArgs eventArgs) { if (editText_User.Text == string.Empty) { textView_Login.Text = Resources.GetText(Resource.String.userEmpty); editText_User.Focusable = true; return; } if (editText_Password.Text == string.Empty) { textView_Login.Text = Resources.GetText(Resource.String.passwordEmpty); editText_Password.Focusable = true; return; } var service = new WebReference.Service(); service.loginCompleted += ServiceOnLoginCompleted; service.loginAsync(editText_User.Text, editText_Password.Text); textView_Login.Text = Resources.GetText(Resource.String.validating); button_Login.Enabled = false; progressBar_Login.Visibility = ViewStates.Visible; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); View v = inflater.Inflate(Resource.Layout.listarclientes, null); var ignored = base.OnCreateView(inflater, container, savedInstanceState); Dialog.SetTitle(Resources.GetText(Resource.String.titleFragmentListarClientes)); sv_teste = v.FindViewById <SearchView>(Resource.Id.sv_teste); lv_teste = v.FindViewById <ListView>(Resource.Id.lv_teste); sv_teste.QueryTextChange += delegate(object sender, SearchView.QueryTextChangeEventArgs args) { var service = new WebReference.Service(); service.ListaClienteAsync(args.NewText.ToUpper()); service.ListaClienteCompleted += ServiceOnListaClienteCompleted; }; return(v); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); View view = inflater.Inflate(Resource.Layout.login_fragment, container, false); Button btnLogin = view.FindViewById <Button>(Resource.Id.btnLoginConfirm); fragmentContext = Android.App.Application.Context; prefs = PreferenceManager.GetDefaultSharedPreferences(fragmentContext); mLayoutManager = new LinearLayoutManager(fragmentContext); relativeLayout = view.FindViewById <RelativeLayout>(Resource.Id.login_list_container); progressBar = new ProgressBar(fragmentContext); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(200, 200); layoutParams.AddRule(LayoutRules.CenterInParent); relativeLayout.AddView(progressBar, layoutParams); progressBar.Visibility = ViewStates.Gone; editTextAccount = view.FindViewById <EditText>(Resource.Id.accountInput); editTextPassword = view.FindViewById <EditText>(Resource.Id.passwordInput); btnLogin.Click += (sender, e) => { Log.Debug(TAG, "=== start ==="); progressBar.Visibility = ViewStates.Visible; WebReference.Service dx = new WebReference.Service(); try { bool is_exist = dx.check_emp_exist(editTextAccount.Text.ToString()); if (!is_exist) { Log.Debug("emp is ", "not exist."); progressBar.Visibility = ViewStates.Gone; toast(fragmentContext.GetString(Resource.String.login_no_emp).ToString()); //Intent intent = new Intent(); //intent.SetAction(Constants.ACTION_LOGIN_FAIL); //context.SendBroadcast(intent); } else //emp is exist, then check password { bool ret = dx.check_emp_password(editTextAccount.Text.ToString(), editTextPassword.Text.ToString()); if (!ret) { Log.Debug("Password is ", "not matched."); progressBar.Visibility = ViewStates.Gone; Intent intent = new Intent(); intent.SetAction(Constants.ACTION_LOGIN_FAIL); fragmentContext.SendBroadcast(intent); toast(fragmentContext.Resources.GetString(Resource.String.login_password_error)); } else { progressBar.Visibility = ViewStates.Gone; editor = prefs.Edit(); editor.PutString("EMP_NO", editTextAccount.Text.ToString()); editor.Apply(); Intent intent = new Intent(); intent.SetAction(Constants.ACTION_LOGIN_SUCCESS); intent.PutExtra("ACCOUNT", editTextAccount.Text.ToString()); intent.PutExtra("PASSWORD", editTextPassword.Text.ToString()); fragmentContext.SendBroadcast(intent); } } } catch (SocketTimeoutException ex) { ex.PrintStackTrace(); Intent timeoutIntent = new Intent(Constants.ACTION_SOCKET_TIMEOUT); fragmentContext.SendBroadcast(timeoutIntent); } catch (SoapException ex) { Intent failIntent = new Intent(Constants.SOAP_CONNECTION_FAIL); fragmentContext.SendBroadcast(failIntent); } /*string ret = ""; * btnLogin.Enabled = false; * // Perform action on click * Log.Debug(TAG, "Click"); * //send login action to launch progress * Intent loginIntent = new Intent(); * loginIntent.SetAction(Constants.ACTION_LOGIN_ACTION); * context.SendBroadcast(loginIntent); * * String input = "<user_no>" + editTextAccount.Text.ToString() + "</user_no>"; * Log.Debug(TAG, "=== start ==="); * ret = SoapService.CallWebService(context, "check_emp_exist", input); * Log.Debug("ret = ", ret); * * if (ret.Length > 0) * { * * bool ret_act = WebServiceParse.parseToBoolean(ret, "check_emp_existResponse"); * * if (ret_act) * { * Log.Debug("emp is ", "exist."); * is_emp_exist = true; * input = "<user_no>" + editTextAccount.Text.ToString() + "</user_no>"; * input += "<password>" + editTextPassword.Text.ToString() + "</password>"; * * ret = SoapService.CallWebService(context, "check_emp_password", input); * Log.Debug("ret = ", ret); * * bool ret_act2 = WebServiceParse.parseToBoolean(ret, "check_emp_passwordResponse"); * * if (ret_act2) * { * Log.Debug("Password is ", "matched."); * Intent intent = new Intent(); * intent.SetAction(Constants.ACTION_LOGIN_SUCCESS); * intent.PutExtra("ACCOUNT", editTextAccount.Text.ToString()); * intent.PutExtra("PASSWORD", editTextPassword.Text.ToString()); * context.SendBroadcast(intent); * } * else * { * Log.Debug("Password is ", "not matched."); * Intent intent = new Intent(); * intent.SetAction(Constants.ACTION_LOGIN_FAIL); * context.SendBroadcast(intent); * * toast(context.Resources.GetString(Resource.String.login_fail_msg)); * } * } * else * { * Log.Debug("emp is ", "not exist."); * is_emp_exist = false; * Intent intent = new Intent(); * intent.SetAction(Constants.ACTION_LOGIN_FAIL); * context.SendBroadcast(intent); * } * * } * else * { * toast(context.GetString(Resource.String.soap_connection_failed)); * btnLogin.Enabled = true; * }*/ Log.Debug(TAG, "=== end ==="); }; if (!isRegister) { IntentFilter filter = new IntentFilter(); mReceiver = new MyBoradcastReceiver(); filter.AddAction(Constants.SOAP_CONNECTION_FAIL); filter.AddAction(Constants.ACTION_SOCKET_TIMEOUT); fragmentContext.RegisterReceiver(mReceiver, filter); isRegister = true; } return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); View view = inflater.Inflate(Resource.Layout.allocation_msg_fragment, container, false); fragmentContext = Application.Context; //get default prefs = PreferenceManager.GetDefaultSharedPreferences(fragmentContext); //emp_no emp_no = prefs.GetString("EMP_NO", ""); mLayoutManager = new LinearLayoutManager(fragmentContext); relativeLayout = view.FindViewById <RelativeLayout>(Resource.Id.allocation_msg_list_container); progressBar = new ProgressBar(fragmentContext); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(200, 200); layoutParams.AddRule(LayoutRules.CenterInParent); relativeLayout.AddView(progressBar, layoutParams); progressBar.Visibility = ViewStates.Gone; msgListRecyclerView = view.FindViewById <RecyclerView>(Resource.Id.listViewAllocationMsg); btnDelete = view.FindViewById <Button>(Resource.Id.btnMsgDelete); btnDelete.Click += (Sender, e) => { progressBar.Visibility = ViewStates.Visible; int found = -1; for (int i = 0; i < msg_list.Count; i++) { if (msg_list[i].isSelected()) { found = i; } } if (found > -1) { Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(fragmentContext); alert.SetTitle(Resource.String.action_allocation_msg); alert.SetIcon(Resource.Drawable.ic_warning_black_48dp); alert.SetMessage(Resource.String.delete + ":\n" + msg_list[found].getWork_order() + " ?"); alert.SetPositiveButton(Resource.String.ok, (senderAlert, args) => { progressBar.Visibility = ViewStates.Visible; }); alert.SetNegativeButton(Resource.String.cancel, (senderAlert, args) => { }); Dialog dialog = alert.Create(); dialog.Show(); } }; if (!isRegister) { IntentFilter filter = new IntentFilter(); mReceiver = new MyBoradcastReceiver(); filter.AddAction(Constants.SOAP_CONNECTION_FAIL); filter.AddAction(Constants.ACTION_SOCKET_TIMEOUT); filter.AddAction(Constants.ACTION_ALLOCATION_GET_MY_MESS_LIST_SUCCESS); filter.AddAction(Constants.ACTION_ALLOCATION_GET_MY_MESS_LIST_FAILED); filter.AddAction(Constants.ACTION_ALLOCATION_GET_MY_MESS_LIST_EMPTY); filter.AddAction(Constants.ACTION_ALLOCATION_GET_MY_MESS_DETAIL_FAILED); filter.AddAction(Constants.ACTION_ALLOCATION_GET_MY_MESS_DETAIL_SUCCESS); filter.AddAction(Constants.ACTION_ALLOCATION_CHECK_IS_DELETE_RIGHT_YES); filter.AddAction(Constants.ACTION_ALLOCATION_CHECK_IS_DELETE_RIGHT_NO); filter.AddAction(Constants.ACTION_ALLOCATION_CHECK_IS_DELETE_RIGHT_FAILED); filter.AddAction(Constants.ACTION_ALLOCATION_HANDLE_MSG_DELETE_SUCCESS); filter.AddAction(Constants.ACTION_ALLOCATION_HANDLE_MSG_DELETE_FAILED); filter.AddAction(Constants.ACTION_ALLOCATION_SWIPE_LAYOUT_UPDATE); filter.AddAction(Constants.ACTION_PRODUCT_DELETE_ITEM_CONFIRM); filter.AddAction("unitech.scanservice.data"); fragmentContext.RegisterReceiver(mReceiver, filter); isRegister = true; } WebReference.Service dx = new WebReference.Service(); //get msg progressBar.Visibility = ViewStates.Visible; try { string msgArray = dx.get_my_mess_list(emp_no); Log.Debug(TAG, "msgArray = " + msgArray + " ,length = " + msgArray.Length); if (msgArray.Length > 0) { System.String[] msg = msgArray.Trim().Split('$'); msg_list.Clear(); if (msg.Length > 0) { for (int i = 0; i < msg.Length; i++) { Log.Warn(TAG, "msg[" + i + "] = " + msg[i]); if (msg[i] != null && msg[i].Trim().Length > 0) { AllocationMsgItem item = new AllocationMsgItem(); item.setWork_order(msg[i]); msg_list.Add(item); } } Intent getSuccessIntent = new Intent(Constants.ACTION_ALLOCATION_GET_MY_MESS_LIST_SUCCESS); getSuccessIntent.PutExtra("ISS_NO", iss_no); fragmentContext.SendBroadcast(getSuccessIntent); } else { Intent getEmptyIntent = new Intent(Constants.ACTION_ALLOCATION_GET_MY_MESS_LIST_EMPTY); fragmentContext.SendBroadcast(getEmptyIntent); } } else { Intent getEmptyIntent = new Intent(Constants.ACTION_ALLOCATION_GET_MY_MESS_LIST_EMPTY); fragmentContext.SendBroadcast(getEmptyIntent); } } catch (SocketTimeoutException e) { e.PrintStackTrace(); Intent timeoutIntent = new Intent(Constants.ACTION_SOCKET_TIMEOUT); fragmentContext.SendBroadcast(timeoutIntent); } catch (SoapException ex) { Intent timeoutIntent = new Intent(Constants.SOAP_CONNECTION_FAIL); fragmentContext.SendBroadcast(timeoutIntent); } return(view); }
public override void OnReceive(Context context, Intent intent) { if (intent.Action == Constants.SOAP_CONNECTION_FAIL) { Log.Debug(TAG, "receive SOAP_CONNECTION_FAIL"); progressBar.Visibility = ViewStates.Gone; } else if (intent.Action == Constants.ACTION_SOCKET_TIMEOUT) { Log.Debug(TAG, "receive ACTION_SOCKET_TIMEOUT"); progressBar.Visibility = ViewStates.Gone; toast(fragmentContext.GetString(Resource.String.socket_timeout)); } else if (intent.Action == Constants.ACTION_ALLOCATION_GET_MY_MESS_LIST_FAILED) { Log.Debug(TAG, "receive ACTION_ALLOCATION_GET_MY_MESS_LIST_FAILED"); progressBar.Visibility = ViewStates.Gone; } else if (intent.Action == Constants.ACTION_ALLOCATION_GET_MY_MESS_LIST_EMPTY) { Log.Debug(TAG, "receive ACTION_ALLOCATION_GET_MY_MESS_LIST_EMPTY"); progressBar.Visibility = ViewStates.Gone; toast(fragmentContext.GetString(Resource.String.allocation_no_message)); } else if (intent.Action == Constants.ACTION_ALLOCATION_GET_MY_MESS_LIST_SUCCESS) { Log.Debug(TAG, "receive ACTION_ALLOCATION_GET_MY_MESS_LIST_SUCCESS"); string iss_no = intent.GetStringExtra("ISS_NO"); progressBar.Visibility = ViewStates.Gone; if (allocationMsgItemAdapter != null) { allocationMsgItemAdapter.NotifyDataSetChanged(); } else { allocationMsgItemAdapter = new AllocationMsgItemAdapter(fragmentContext, Resource.Layout.allocation_msg_list_item, msg_list); allocationMsgItemAdapter.ItemClick += (sender, e) => { for (int i = 0; i < msg_list.Count; i++) { if (i == e) { if (msg_list[i].isSelected()) { msg_list[i].setSelected(false); item_select = -1; btnDelete.Enabled = false; } else { msg_list[i].setSelected(true); item_select = e; //btnDelete.setEnabled(true); if (msg_list[i].isDelete()) { btnDelete.Enabled = true; } else { btnDelete.Enabled = false; } } } else { msg_list[i].setSelected(false); } } allocationMsgItemAdapter.NotifyDataSetChanged(); }; allocationMsgItemAdapter.ItemLongClick += (sender, e) => { progressBar.Visibility = ViewStates.Visible; WebReference.Service dx = new WebReference.Service(); try { msgDataTable = dx.get_my_mess_detail("MAT", iss_no); msgDataTable.TableName = "TYYC"; if (msgDataTable.Rows.Count > 0) { DataColumn scan_sp = new DataColumn("scan_sp"); DataColumn scan_desc = new DataColumn("scan_desc"); msgDataTable.Columns.Add(scan_sp); msgDataTable.Columns.Add(scan_desc); foreach (DataRow rx in msgDataTable.Rows) { rx["scan_sp"] = "N"; rx["scan_desc"] = ""; //rx.setValue("scan_sp", "N"); //rx.setValue("scan_desc", ""); } } System.String[] p_no = msg_list[e].getWork_order().Split('#'); iss_no = p_no[0]; string dateTime_0 = "", dateTime_1 = "", dateTime_2 = "", dateTime_3 = ""; if (p_no[2].Length > 0) { dateTime_0 = p_no[2].Substring(0, 4); dateTime_1 = p_no[2].Substring(4, 2); dateTime_2 = p_no[2].Substring(6, 2); dateTime_3 = p_no[2].Substring(9); } Intent detailIntent = new Intent(fragmentContext, typeof(AllocationMsgDetailActivity)); detailIntent.PutExtra("ISS_DATE", msgDataTable.Rows[0]["iss_date"].ToString()); detailIntent.PutExtra("MADE_NO", msgDataTable.Rows[0]["made_no"].ToString()); detailIntent.PutExtra("TAG_LOCATE_NO", msgDataTable.Rows[0]["tag_locate_no"].ToString()); detailIntent.PutExtra("TAG_STOCK_NO", msgDataTable.Rows[0]["tag_stock_no"].ToString()); detailIntent.PutExtra("IMA03", msgDataTable.Rows[0]["ima03"].ToString()); detailIntent.PutExtra("DATETIME_0", dateTime_0); detailIntent.PutExtra("DATETIME_1", dateTime_1); detailIntent.PutExtra("DATETIME_2", dateTime_2); detailIntent.PutExtra("DATETIME_3", dateTime_3); fragmentContext.StartActivity(detailIntent); } catch (SocketTimeoutException ex) { ex.PrintStackTrace(); Intent timeoutIntent = new Intent(Constants.ACTION_SOCKET_TIMEOUT); fragmentContext.SendBroadcast(timeoutIntent); } catch (SoapException ex) { Intent timeoutIntent = new Intent(Constants.SOAP_CONNECTION_FAIL); fragmentContext.SendBroadcast(timeoutIntent); } }; } } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.entering_warehouse_divided_dialog_activity); context = Android.App.Application.Context; //get virtual keyboard imm = (InputMethodManager)GetSystemService(Activity.InputMethodService); SetTitle(Resource.String.entering_warehouse_dialog_head); string in_no_string = Intent.GetStringExtra("IN_NO"); string item_no_string = Intent.GetStringExtra("ITEM_NO"); string part_no_string = Intent.GetStringExtra("PART_NO"); string quantity_string = Intent.GetStringExtra("QUANTITY"); string batch_no_string = Intent.GetStringExtra("BATCH_NO"); string locate_no_string = Intent.GetStringExtra("LOCATE_NO"); string stock_no_string = Intent.GetStringExtra("STOCK_NO"); string check_sp_string = Intent.GetStringExtra("CHECK_SP"); float quantity = float.Parse(quantity_string); quantity_int = (int)quantity; //string group_index = Intent.GetStringExtra("GROUP_INDEX"); //string child_index = Intent.GetStringExtra("CHILD_INDEX"); //string quantity_string = Intent.GetStringExtra("QUANTITY"); //Log.Debug(TAG, "group_index = " + group_index + ", child_index = " + child_index + ", quantity_string = " + quantity_string); //quantity_int = Convert.ToInt32(quantity_string); btnAdd = FindViewById <Button>(Resource.Id.btnAdd); textViewQuantity = FindViewById <TextView>(Resource.Id.textViewQuantity); btnCancel = FindViewById <Button>(Resource.Id.btnCancel); btnOk = FindViewById <Button>(Resource.Id.btnOk); listViewDivide = FindViewById <ListView>(Resource.Id.listViewDivide); btnAdd.Click += (Sender, e) => { DataRow ur = EnteringWarehouseFragment.dataTable_Batch_area.NewRow(); ur["rvv33"] = locate_no_string; ur["rvb33"] = "0"; ur["rvv32"] = stock_no_string; ur["rvv34"] = batch_no_string; EnteringWarehouseFragment.dataTable_Batch_area.Rows.Add(ur); DividedItem addItem = new DividedItem(); addItem.setQuantity(0); dividedList.Add(addItem); temp_count_list.Add(0); for (int i = 0; i < dividedList.Count; i++) { dividedList[i].setQuantity(temp_count_list[i]); } if (dividedItemAdapter != null) { dividedItemAdapter.NotifyDataSetChanged(); } }; btnOk.Click += (Sender, e) => { WebReference.Service dx = new WebReference.Service(); try { bool ret = dx.Get_TT_split_rvv_item("MAT", in_no_string, int.Parse(item_no_string), EnteringWarehouseFragment.dataTable_Batch_area, part_no_string, MainActivity.k_id); if (ret) { Intent successIntent = new Intent(Constants.ACTION_GET_TT_SPLIT_RVV_ITEM_SUCCESS); successIntent.PutExtra("IN_NO", in_no_string); successIntent.PutExtra("ITEM_NO", item_no_string); SendBroadcast(successIntent); } else { Intent failedIntent = new Intent(Constants.ACTION_GET_TT_SPLIT_RVV_ITEM_FAILED); SendBroadcast(failedIntent); } } catch (SocketTimeoutException ex) { ex.PrintStackTrace(); Intent timeoutIntent = new Intent(Constants.ACTION_SOCKET_TIMEOUT); SendBroadcast(timeoutIntent); } catch (SoapException ex) { Intent timeoutIntent = new Intent(Constants.SOAP_CONNECTION_FAIL); SendBroadcast(timeoutIntent); } //int base_index = Convert.ToInt32(group_index); /*Intent dividedIntent = new Intent(); * dividedIntent.SetAction(Constants.ACTION_ENTERING_WAREHOUSE_DIVIDED_CONFIRM); * dividedIntent.PutExtra("BASE_INDEX", group_index); * dividedIntent.PutExtra("DIVIDED_LIST_COUNT", (temp_count_list.Count).ToString()); * for (int i=0; i<temp_count_list.Count; i++) * { * string param = "DIVIDED_ITEM_INDEX_" + i.ToString(); * dividedIntent.PutExtra(param, temp_count_list[i].ToString()); * } * * SendBroadcast(dividedIntent); * * Finish();*/ }; btnCancel.Click += (Sender, e) => { Finish(); }; dividedList.Clear(); temp_count_list.Clear(); DividedItem dividedItem = new DividedItem(); dividedItem.setQuantity(quantity_int); dividedList.Add(dividedItem); temp_count_list.Add(quantity_int); string total = quantity_string + " / " + quantity_string; textViewQuantity.Text = total; dividedItemAdapter = new DividedItemAdapter(context, Resource.Layout.entering_warehouse_divide_dialog_item, dividedList, quantity_int); listViewDivide.SetAdapter(dividedItemAdapter); if (!isRegister) { IntentFilter filter = new IntentFilter(); mReceiver = new MyBoradcastReceiver(); filter.AddAction(Constants.ACTION_SOCKET_TIMEOUT); filter.AddAction(Constants.ACTION_ENTERING_WAREHOUSE_DIVIDED_DIALOG_TEXT_CHANGE); filter.AddAction(Constants.ACTION_GET_TT_SPLIT_RVV_ITEM_SUCCESS); filter.AddAction(Constants.ACTION_GET_TT_SPLIT_RVV_ITEM_FAILED); filter.AddAction(Constants.ACTION_DELETE_TT_RECEIVE_GOODS_IN_TEMP2_SUCCESS); filter.AddAction(Constants.ACTION_DELETE_TT_RECEIVE_GOODS_IN_TEMP2_FAILED); RegisterReceiver(mReceiver, filter); isRegister = true; } }
public override void OnReceive(Context context, Intent intent) { if (intent.Action == Constants.ACTION_ENTERING_WAREHOUSE_DIVIDED_DIALOG_TEXT_CHANGE) { Log.Debug(TAG, "receive ACTION_ENTERING_WAREHOUSE_DIVIDED_DIALOG_TEXT_CHANGE"); int count = 0; for (int i = 0; i < temp_count_list.Count; i++) { dividedList[i].setQuantity(temp_count_list[i]); count += temp_count_list[i]; } if (count == quantity_int) { string total = count.ToString() + " / " + quantity_int.ToString(); textViewQuantity.Text = total; //check temp_count_list, if there is more than one > 0, set btnOk enabled, else set disabled int bigger_than_zero = 0; for (int j = 0; j < temp_count_list.Count; j++) { if (temp_count_list[j] > 0) { bigger_than_zero++; } } if (bigger_than_zero > 1 && temp_count_list[0] > 0 && bigger_than_zero == temp_count_list.Count) { for (int i = 0; i < EnteringWarehouseFragment.dataTable_Batch_area.Rows.Count; i++) { EnteringWarehouseFragment.dataTable_Batch_area.Rows[i]["rvb33"] = temp_count_list[i].ToString(); } btnOk.Enabled = true; } else { btnOk.Enabled = false; } } else { btnOk.Enabled = false; string text = "<font color=#ce0000>" + count.ToString() + "</font> / <font color=#000000>" + quantity_int.ToString() + "</font>"; textViewQuantity.SetText(Html.FromHtml(text), TextView.BufferType.Spannable); } /*string position = intent.GetStringExtra("POSITION"); * * int delete_item = Convert.ToInt32(position); * * * dividedList.RemoveAt(delete_item); * * temp_count_list.RemoveAt(delete_item); * * for (int i = 0; i < dividedList.Count; i++) * { * dividedList[i].setQuantity(temp_count_list[i]); * } * * if (dividedItemAdapter != null) * dividedItemAdapter.NotifyDataSetChanged();*/ } else if (intent.Action == Constants.ACTION_GET_TT_SPLIT_RVV_ITEM_SUCCESS) { Log.Debug(TAG, "receive ACTION_GET_TT_SPLIT_RVV_ITEM_SUCCESS"); string in_no = intent.GetStringExtra("IN_NO"); string item_no = intent.GetStringExtra("ITEM_NO"); WebReference.Service dx = new WebReference.Service(); try { dx.Delete_TT_ReceiveGoods_IN__in_no_Temp(MainActivity.k_id, in_no, item_no); intent = new Intent(Constants.ACTION_DELETE_TT_RECEIVE_GOODS_IN_TEMP2_SUCCESS); context.SendBroadcast(intent); } catch (SocketTimeoutException ex) { ex.PrintStackTrace(); Intent timeoutIntent = new Intent(Constants.ACTION_SOCKET_TIMEOUT); context.SendBroadcast(timeoutIntent); } catch (SoapException ex) { Intent timeoutIntent = new Intent(Constants.SOAP_CONNECTION_FAIL); context.SendBroadcast(timeoutIntent); } /*string index = intent.GetStringExtra("INDEX"); * string value = intent.GetStringExtra("VALUE"); * Log.Warn(TAG, "index = "+ index + "value = "+ value); * //dividedList[Convert.ToInt32(index)].setQuantity(Convert.ToInt32(value)); * if (value.Length > 0) * { * temp_count_list[Convert.ToInt32(index)] = Convert.ToInt32(value); * } * else * { * temp_count_list[Convert.ToInt32(index)] = 0; * } * * * int count = 0; * * for (int i = 0; i < temp_count_list.Count; i++) * { * dividedList[i].setQuantity(temp_count_list[i]); * * count += temp_count_list[i]; * } * * if (count == quantity_int) * { * string total = count.ToString() + " / " + quantity_int.ToString(); * textViewQuantity.Text = total; * * //check temp_count_list, if there is more than one > 0, set btnOk enabled, else set disabled * int bigger_than_zero = 0; * * for (int j = 0; j < temp_count_list.Count; j++) * { * if (temp_count_list[j] > 0) * bigger_than_zero++; * } * * if (bigger_than_zero > 1 && temp_count_list[0] > 0 && bigger_than_zero == temp_count_list.Count) * btnOk.Enabled = true; * else * btnOk.Enabled = false; * * } * else * { * btnOk.Enabled = false; * * string text = "<font color=#ce0000>" + count.ToString() + "</font> / <font color=#000000>" + quantity_int.ToString() + "</font>"; * //textViewQuantity.Text = Html.fromHtml(text); * textViewQuantity.SetText(Html.FromHtml(text), TextView.BufferType.Spannable); * * }*/ } else if (intent.Action == Constants.ACTION_GET_TT_SPLIT_RVV_ITEM_FAILED) { Log.Debug(TAG, "receive ACTION_GET_TT_SPLIT_RVV_ITEM_FAILED"); toast(context.GetString(Resource.String.entering_warehouse_tt_split_rvv_failed)); } else if (intent.Action == Constants.ACTION_DELETE_TT_RECEIVE_GOODS_IN_TEMP2_SUCCESS) { Log.Debug(TAG, "receive ACTION_DELETE_TT_RECEIVE_GOODS_IN_TEMP2_SUCCESS"); //clear swipe_list only Intent clearIntent = new Intent(Constants.ACTION_SET_INSPECTED_RECEIVE_ITEM_CLEAN_ONLY); context.SendBroadcast(clearIntent); //reset item string /*String xx = ""; * int start_index = Integer.valueOf(item_no_string); * for (int i=0; i<dataTable_Batch_area.Rows.size(); i++) { * xx = xx + "rvv02="+start_index; * * if (i != dataTable_Batch_area.Rows.size() -1) { * xx = xx + " or "; * } * } * * xx = " ( "+xx+" ) "; * Log.e(TAG, "xx = "+xx); * * Intent splitIntent = new Intent(EnteringWarehouseDividedDialogActivity.this, GetReceiveGoodsInDataAXService.class); * splitIntent.setAction(Constants.ACTION.ACTION_GET_INSPECTED_RECEIVE_ITEM_AX_ACTION); * splitIntent.putExtra("IN_NO", in_no_string); * splitIntent.putExtra("ITEM_NO_LIST", xx); * splitIntent.putExtra("CHECK_SP", check_sp_string); * splitIntent.putExtra("ITEM_NO", item_no_string); * startService(splitIntent);*/ //Finish(); } else if (intent.Action == Constants.ACTION_DELETE_TT_RECEIVE_GOODS_IN_TEMP2_FAILED) { Log.Debug(TAG, "receive ACTION_DELETE_TT_RECEIVE_GOODS_IN_TEMP2_FAILED"); } }
public override void OnReceive(Context context, Intent intent) { if (intent.Action == Constants.SOAP_CONNECTION_FAIL) { Log.Debug(TAG, "receive SOAP_CONNECTION_FAIL"); progressBar.Visibility = ViewStates.Gone; } else if (intent.Action == Constants.ACTION_SOCKET_TIMEOUT) { Log.Debug(TAG, "receive ACTION_SOCKET_TIMEOUT"); progressBar.Visibility = ViewStates.Gone; toast(fragmentContext.GetString(Resource.String.socket_timeout)); } else if (intent.Action == Constants.ACTION_SEARCH_PART_BATCH_CLEAN) { Log.Debug(TAG, "receive ACTION_SEARCH_PART_BATCH_CLEAN"); } else if (intent.Action == Constants.ACTION_SEARCH_PART_BATCH_FAILED) { Log.Debug(TAG, "receive ACTION_SEARCH_PART_BATCH_FAILED"); //loadDialog.dismiss(); //toast(fragmentContext.getResources().getString(R.string.look_up_in_stock_no_match_batch)); } else if (intent.Action == Constants.ACTION_SEARCH_PART_BATCH_SUCCESS) { Log.Debug(TAG, "receive ACTION_SEARCH_PART_BATCH_SUCCESS"); //loadDialog.dismiss(); //String batch_no = intent.getStringExtra("BATCH_NO"); //Log.e(TAG, "batch_no = " + batch_no); } else if (intent.Action == Constants.ACTION_SEARCH_PART_WAREHOUSE_LIST_ACTION) { Log.Debug(TAG, "receive ACTION_SEARCH_PART_WAREHOUSE_LIST_ACTION"); //string ret = ""; //clear list searchList.Clear(); sortedSearchList.Clear(); string part_no; string stock_no; string locate_no; string batch_no; string ima02; string ima021; //start service try { Log.Debug(TAG, "=== start ==="); WebReference.Service dx = new WebReference.Service(); Log.Debug(TAG, "serachPartNo = " + serachPartNo.Text.Length + " ,searchBatchNo = " + searchBatchNo.Text.Length + " ,searchName = " + searchName.Text + " ,searchSpec = " + searchSpec.Text.Length); //set input //string input = "<SID>MAT</SID>"; if (serachPartNo.Text != null && serachPartNo.Text.Length > 0) { //input += "<part_no>" +serachPartNo.Text.ToString().ToUpper()+ "</part_no>"; part_no = serachPartNo.Text.ToString().ToUpper(); } else { //input += "<part_no></part_no>"; part_no = ""; } stock_no = ""; locate_no = ""; //input += "<stock_no></stock_no>"; //input += "<locate_no></locate_no>"; if (searchBatchNo.Text != null && searchBatchNo.Text.Length > 0) { //input += "<batch_no>" +searchBatchNo.Text+ "</batch_no>"; batch_no = searchBatchNo.Text; } else { //input += "<batch_no></batch_no>"; batch_no = ""; } if (searchName.Text != null && searchName.Text.Length > 0) { //input += "<ima02>" +searchName.Text.ToString().Trim()+ "</ima02>"; ima02 = searchName.Text.ToString().Trim(); } else { //input += "<ima02></ima02>"; ima02 = ""; } if (searchSpec.Text != null && searchSpec.Text.Length > 0) { //input += "<ima021>" +searchSpec.Text.ToString().Trim() + "</ima021>"; ima021 = searchSpec.Text.ToString().Trim(); } else { //input += "<ima021></ima021>"; ima021 = ""; } //input += "<query_all>Y</query_all>"; //Log.Debug("input = ", input); if (lookUpDataTable != null) { lookUpDataTable.Clear(); } else { lookUpDataTable = new DataTable(); } lookUpDataTable = dx.get_part_warehouse_list("MAT", part_no, stock_no, locate_no, batch_no, ima02, ima021, "Y"); //ret = SoapService.CallWebService(context, "get_part_warehouse_list", input); //Log.Debug("lookUpDataTable.column0 = ", lookUpDataTable.Columns[0].ColumnName); if (lookUpDataTable != null && lookUpDataTable.Rows.Count > 0) { for (int i = 0; i < lookUpDataTable.Rows.Count; i++) { SearchItem searchItem = new SearchItem(); //Log.Debug("lookUpDataTable.Rows["+i+"][0] = ", lookUpDataTable.Rows[i][0].ToString()); for (int j = 0; j < lookUpDataTable.Columns.Count; j++) { if (j == 0) { searchItem.setItem_IMG01(lookUpDataTable.Rows[i][j].ToString()); } else if (j == 1) { searchItem.setItem_IMA02(lookUpDataTable.Rows[i][j].ToString()); } else if (j == 2) { searchItem.setItem_IMA021(lookUpDataTable.Rows[i][j].ToString()); } else if (j == 3) { searchItem.setItem_IMG02(lookUpDataTable.Rows[i][j].ToString()); } else if (j == 4) { searchItem.setItem_IMD02(lookUpDataTable.Rows[i][j].ToString()); } else if (j == 5) { searchItem.setItem_IMG03(lookUpDataTable.Rows[i][j].ToString()); } else if (j == 6) { searchItem.setItem_IMG04(lookUpDataTable.Rows[i][j].ToString()); } else if (j == 7) { searchItem.setItem_IMG10(lookUpDataTable.Rows[i][j].ToString()); } else if (j == 8) { searchItem.setItem_IMA25(lookUpDataTable.Rows[i][j].ToString()); } else if (j == 9) { searchItem.setItem_IMG23(lookUpDataTable.Rows[i][j].ToString()); } else if (j == 10) { searchItem.setItem_IMA08(lookUpDataTable.Rows[i][j].ToString()); } else if (j == 11) { searchItem.setItem_STOCK_MAN(lookUpDataTable.Rows[i][j].ToString()); } else if (j == 12) { if (lookUpDataTable.Rows[i][j] != null) { searchItem.setItem_IMA03(lookUpDataTable.Rows[i][j].ToString()); } } else if (j == 13) { if (lookUpDataTable.Rows[i][j] != null) { searchItem.setItem_PMC03(lookUpDataTable.Rows[i][j].ToString()); } } } searchList.Add(searchItem); } Intent successIntent = new Intent(); successIntent.SetAction(Constants.ACTION_SEARCH_PART_WAREHOUSE_LIST_SUCCESS); successIntent.PutExtra("RECORDS", lookUpDataTable.Rows.Count.ToString()); context.SendBroadcast(successIntent); } else { Intent norecordIntent = new Intent(); norecordIntent.SetAction(Constants.ACTION_SEARCH_PART_WAREHOUSE_LIST_EMPTY); context.SendBroadcast(norecordIntent); } } catch (SocketTimeoutException e) { e.PrintStackTrace(); Intent timeoutIntent = new Intent(Constants.ACTION_SOCKET_TIMEOUT); context.SendBroadcast(timeoutIntent); } catch (SoapException ex) { Intent timeoutIntent = new Intent(Constants.SOAP_CONNECTION_FAIL); fragmentContext.SendBroadcast(timeoutIntent); } Log.Debug(TAG, "=== end ==="); } else if (intent.Action == Constants.ACTION_SEARCH_PART_WAREHOUSE_LIST_CLEAN) { Log.Debug(TAG, "receive ACTION_SEARCH_PART_WAREHOUSE_LIST_CLEAN"); progressBar.Visibility = ViewStates.Gone; //loadDialog.dismiss(); } else if (intent.Action == Constants.ACTION_SEARCH_PART_WAREHOUSE_LIST_FAILED) { Log.Debug(TAG, "receive ACTION_SEARCH_PART_WAREHOUSE_LIST_FAILED"); progressBar.Visibility = ViewStates.Gone; //loadDialog.dismiss(); //toast(fragmentContext.getResources().getString(R.string.look_up_in_stock_no_match_batch)); } else if (intent.Action == Constants.ACTION_SEARCH_PART_WAREHOUSE_LIST_SUCCESS) { Log.Debug(TAG, "receive ACTION_SEARCH_PART_WAREHOUSE_LIST_SUCCESS"); progressBar.Visibility = ViewStates.Gone; string records = intent.GetStringExtra("RECORDS"); Log.Warn(TAG, "searchList.size = " + searchList.Count); layoutResultView.Visibility = ViewStates.Visible; layoutSearchView.Visibility = ViewStates.Gone; if (searchItemAdapter != null) { Log.Warn(TAG, "searchItemAdapter! = null"); searchItemAdapter.NotifyDataSetChanged(); } else { Log.Warn(TAG, "searchList.size = " + searchList.Count); searchItemAdapter = new SearchItemAdapter(fragmentContext, Resource.Layout.look_up_in_stock_recyclerview_item, searchList); searchItemAdapter.ItemClick += (sender, e) => { Log.Debug(TAG, "Sender = " + sender.ToString() + " e = " + e.ToString()); SearchItem searchItem = searchList[e]; Intent detailIntent = new Intent(fragmentContext, typeof(LookupInStockDetailActivity)); detailIntent.PutExtra("IMG01", searchItem.getItem_IMG01()); detailIntent.PutExtra("IMA02", searchItem.getItem_IMA02()); detailIntent.PutExtra("IMA021", searchItem.getItem_IMA021()); detailIntent.PutExtra("IMG02", searchItem.getItem_IMG02()); detailIntent.PutExtra("IMD02", searchItem.getItem_IMD02()); detailIntent.PutExtra("IMG03", searchItem.getItem_IMG03()); detailIntent.PutExtra("IMG04", searchItem.getItem_IMG04()); detailIntent.PutExtra("IMG10", searchItem.getItem_IMG10()); detailIntent.PutExtra("IMA25", searchItem.getItem_IMA25()); detailIntent.PutExtra("IMG23", searchItem.getItem_IMG23()); detailIntent.PutExtra("IMA08", searchItem.getItem_IMA08()); detailIntent.PutExtra("STOCK_MAN", searchItem.getItem_STOCK_MAN()); detailIntent.PutExtra("IMA03", searchItem.getItem_IMA03()); detailIntent.PutExtra("PMC03", searchItem.getItem_PMC03()); fragmentContext.StartActivity(detailIntent); }; recyclerViewResult.SetAdapter(searchItemAdapter); } toast(context.GetString(Resource.String.look_up_in_stock_find_records, records)); } else if (intent.Action == Constants.ACTION_SEARCH_PART_WAREHOUSE_LIST_EMPTY) { Log.Debug(TAG, "receive ACTION_SEARCH_PART_WAREHOUSE_LIST_EMPTY"); progressBar.Visibility = ViewStates.Gone; /*loadDialog.dismiss(); * * if (searchItemAdapter != null) * searchItemAdapter.notifyDataSetChanged(); * * Intent showIntent = new Intent(Constants.ACTION.ACTION_SEARCH_MENU_HIDE_ACTION); * fragmentContext.sendBroadcast(showIntent); * * toast(fragmentContext.getResources().getString(R.string.look_up_in_stock_find_records, "0"));*/ toast(context.GetString(Resource.String.look_up_in_stock_find_records, "0")); } else if (intent.Action == Constants.ACTION_SEARCH_PART_WAREHOUSE_SORT_COMPLETE) { Log.Debug(TAG, "receive ACTION_SEARCH_PART_WAREHOUSE_SORT_COMPLETE"); /*searchItemAdapter = null; * * isSorted = true; * * searchItemAdapter = new SearchItemAdapter(fragmentContext, sortedSearchList); * recyclerViewResult.setAdapter(searchItemAdapter);*/ } else if (intent.Action == Constants.ACTION_SEARCH_PART_WAREHOUSE_GET_ORIGINAL_LIST) { Log.Debug(TAG, "receive ACTION_SEARCH_PART_WAREHOUSE_GET_ORIGINAL_LIST"); /*searchItemAdapter = null; * * isSorted = false; * * searchItemAdapter = new SearchItemAdapter(fragmentContext, searchList); * recyclerViewResult.setAdapter(searchItemAdapter);*/ } else if (intent.Action.Equals("unitech.scanservice.data")) { Log.Debug(TAG, "unitech.scanservice.data"); Bundle bundle = intent.Extras; if (bundle != null) { string text = bundle.GetString("text"); Log.Debug(TAG, "msg = " + text); if (text.Length > 0) { int counter = 0; for (int i = 0; i < text.Length; i++) { if (text.ToCharArray()[i] == '#') { counter++; } } Log.Debug(TAG, "counter = " + counter); if (counter >= 1) { System.String[] codeArray = text.Split('#'); serachPartNo.Text = codeArray[0]; //batchNo.setText(codeArray[1]); /*Intent getPartIntent = new Intent(fragmentContext, SearchPartNoByScanService.class); * getPartIntent.setAction(Constants.ACTION.ACTION_SEARCH_PART_BATCH_ACTION); * getPartIntent.putExtra("PART_NO", codeArray[0]); * getPartIntent.putExtra("BARCODE", text); * fragmentContext.startService(getPartIntent);*/ } /*if (counter == 8) * { * //renew kid * k_id = RandomString.GetRandomString(32); * Log.Debug(TAG, "session_id = " + k_id); * //editor = prefs.Edit(); * //editor.PutString("CURRENT_K_ID", k_id); * //editor.Apply(); * * System.String[] codeArray = text.Split('#'); * Intent scanResultIntent = new Intent(Constants.ACTION_SET_INSPECTED_RECEIVE_ITEM_CLEAN); * for (int i = 0; i < codeArray.Length; i++) * { * Log.Debug(TAG, "codeArray[" + i + "] = " + codeArray[i]); * string column = "COLUMN_" + Convert.ToInt32(i); * scanResultIntent.PutExtra(column, codeArray[i]); * } * * * scanResultIntent.PutExtra("BARCODE", text); * fragmentContext.SendBroadcast(scanResultIntent); * } * else * { * * toast(text); * * if (counter == 0) * { * if (no_list.Count > 0 && detailList.Count > 0) * { * * string head = no_list[current_expanded_group]; * DetailItem detailItem = detailList[head][7]; * detailItem.setName(text); * * Intent modifyIntent = new Intent(Constants.ACTION_MODIFIED_ITEM_COMPLETE); * context.SendBroadcast(modifyIntent); * } * } * * }*/ } } } }
private void DoReport_Job(object obj) { RemoteInterface.HC.ScheduleTask.ReportScheduleTask jobObj = (RemoteInterface.HC.ScheduleTask.ReportScheduleTask)obj; WebReference.Service servce = new WebReference.Service(); servce.Timeout = 1000 * 3600; servce.printReport(jobObj.reportId); // Program.matrix.WebService.printReport(jobObj.reportId); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); View view = inflater.Inflate(Resource.Layout.production_storage_fragment, container, false); fragmentContext = Application.Context; //get default prefs = PreferenceManager.GetDefaultSharedPreferences(fragmentContext); //emp_no emp_no = prefs.GetString("EMP_NO", ""); mLayoutManager = new LinearLayoutManager(fragmentContext); relativeLayout = view.FindViewById <RelativeLayout>(Resource.Id.production_storage_list_container); progressBar = new ProgressBar(fragmentContext); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(200, 200); layoutParams.AddRule(LayoutRules.CenterInParent); relativeLayout.AddView(progressBar, layoutParams); progressBar.Visibility = ViewStates.Gone; editTextInNo = view.FindViewById <EditText>(Resource.Id.editTextInNo); btnUserInputConfirm = view.FindViewById <Button>(Resource.Id.btnUserInputConfirm); c_in_no = view.FindViewById <TextView>(Resource.Id.c_in_no); c_in_date = view.FindViewById <TextView>(Resource.Id.c_in_date); c_made_no = view.FindViewById <TextView>(Resource.Id.c_made_no); c_dept_name = view.FindViewById <TextView>(Resource.Id.c_dept_name); productListRecyclerView = view.FindViewById <RecyclerView>(Resource.Id.productListView); btnInStockConfirm = view.FindViewById <Button>(Resource.Id.btnInStockConfirm); productList.Clear(); btnUserInputConfirm.Click += (Sender, e) => { progressBar.Visibility = ViewStates.Visible; WebReference.Service dx = new WebReference.Service(); try { bool ret = dx.Check_TT_product_Entry_already_confirm("MAT", editTextInNo.Text); if (!ret) { Intent checkResultIntent = new Intent(Constants.ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_NO); fragmentContext.SendBroadcast(checkResultIntent); } else { Intent checkResultIntent = new Intent(Constants.ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_YES); fragmentContext.SendBroadcast(checkResultIntent); } } catch (SocketTimeoutException ex) { ex.PrintStackTrace(); Intent timeoutIntent = new Intent(Constants.ACTION_SOCKET_TIMEOUT); fragmentContext.SendBroadcast(timeoutIntent); } catch (SoapException ex) { Intent timeoutIntent = new Intent(Constants.SOAP_CONNECTION_FAIL); fragmentContext.SendBroadcast(timeoutIntent); } }; btnInStockConfirm.Click += (Sender, e) => { bool found_product_not_scan = false; if (productList.Count > 0) { for (int i = 0; i < productList.Count; i++) { if (productList[i].getLocate_no_scan().Equals("")) { found_product_not_scan = true; break; } } if (!found_product_not_scan) { //all scanner, start in stock //unselect all for (int i = 0; i < productList.Count; i++) { productList[i].setSelected(false); } productionStorageItemAdapter.NotifyDataSetChanged(); item_select = -1; Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(fragmentContext); alert.SetTitle(Resource.String.production_storage_dialog_title); alert.SetIcon(Resource.Drawable.ic_warning_black_48dp); alert.SetMessage(Resource.String.production_storage_dialog_content); alert.SetPositiveButton(Resource.String.ok, (senderAlert, args) => { progressBar.Visibility = ViewStates.Visible; WebReference.Service dx = new WebReference.Service(); try { bool found_error = false; foreach (DataRow dr in dataTable_RR.Rows) { bool is_exist = dx.Check_stock_locate_no_exist("MAT", dr["stock_no"].ToString(), dr["locate_no"].ToString()); if (is_exist) //update product entry { dx.Update_TT_product_Entry_locate_no("MAT", dr["in_no"].ToString(), int.Parse(dr["item_no"].ToString()), dr["locate_no"].ToString()); } else { toast(fragmentContext.GetString(Resource.String.production_storage_in_stock_process_abort)); found_error = true; break; } } if (!found_error) { if (product_table_X_M != null) { product_table_X_M.Clear(); } else { product_table_X_M = new DataTable("X_M"); } DataColumn v1 = new DataColumn("script"); product_table_X_M.Columns.Add(v1); DataRow kr; kr = product_table_X_M.NewRow(); string script_string = "sh run_me 1 2 " + c_in_no.Text + " " + emp_no; Log.Warn(TAG, "script_string = " + script_string); kr["script"] = script_string; product_table_X_M.Rows.Add(kr); //execute Execute_Script_TT bool executeTT_ret = dx.Execute_Script_TT("MAT", product_table_X_M); Intent checkResultIntent; if (!executeTT_ret) { checkResultIntent = new Intent(Constants.ACTION_EXECUTE_TT_FAILED); fragmentContext.SendBroadcast(checkResultIntent); } else { checkResultIntent = new Intent(Constants.ACTION_PRODUCT_IN_STOCK_WORK_COMPLETE); checkResultIntent.PutExtra("IN_NO", c_in_no.Text); fragmentContext.SendBroadcast(checkResultIntent); } } //dx.Check_stock_locate_no_exist("MAT", productList[e].getStock_no(), barcode, k_id); /*Intent checkIntent = new Intent(fragmentContext, CheckStockLocateNoExistService.class); * checkIntent.setAction(Constants.ACTION.ACTION_PRODUCT_CHECK_STOCK_LOCATE_NO_EXIST_ACTION); * checkIntent.putExtra("STOCK_NO", productList.get(last).getStock_no()); * checkIntent.putExtra("LOCATE_NO", productList.get(last).getLocate_no()); * checkIntent.putExtra("CURRENT_INDEX", String.valueOf(last)); * fragmentContext.startService(checkIntent);*/ } catch (SocketTimeoutException ex) { ex.PrintStackTrace(); Intent timeoutIntent = new Intent(Constants.ACTION_SOCKET_TIMEOUT); fragmentContext.SendBroadcast(timeoutIntent); } catch (SoapException ex) { Intent timeoutIntent = new Intent(Constants.SOAP_CONNECTION_FAIL); fragmentContext.SendBroadcast(timeoutIntent); } }); alert.SetNegativeButton(Resource.String.cancel, (senderAlert, args) => { }); Dialog dialog = alert.Create(); dialog.Show(); } else { toast(fragmentContext.GetString(Resource.String.production_storage_product_locate_not_scanned)); } } }; if (!isRegister) { IntentFilter filter = new IntentFilter(); mReceiver = new MyBoradcastReceiver(); filter.AddAction(Constants.SOAP_CONNECTION_FAIL); filter.AddAction(Constants.ACTION_SOCKET_TIMEOUT); filter.AddAction(Constants.ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_YES); filter.AddAction(Constants.ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_NO); filter.AddAction(Constants.ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_FAILED); filter.AddAction(Constants.ACTION_GET_TT_PRODUCT_ENTRY_FAILED); filter.AddAction(Constants.ACTION_GET_TT_PRODUCT_ENTRY_SUCCESS); filter.AddAction(Constants.ACTION_GET_TT_PRODUCT_ENTRY_EMPTY); filter.AddAction(Constants.ACTION_PRODUCT_CHECK_STOCK_LOCATE_NO_EXIST_YES); filter.AddAction(Constants.ACTION_PRODUCT_CHECK_STOCK_LOCATE_NO_EXIST_NO); filter.AddAction(Constants.ACTION_PRODUCT_CHECK_STOCK_LOCATE_NO_EXIST_FAILED); filter.AddAction(Constants.ACTION_PRODUCT_UPDATE_TT_PRODUCT_ENTRY_LOCATE_NO_FAILED); filter.AddAction(Constants.ACTION_PRODUCT_UPDATE_TT_PRODUCT_ENTRY_LOCATE_NO_SUCCESS); filter.AddAction(Constants.ACTION_EXECUTE_TT_FAILED); filter.AddAction(Constants.ACTION_PRODUCT_IN_STOCK_WORK_COMPLETE); filter.AddAction(Constants.ACTION_PRODUCT_SWIPE_LAYOUT_UPDATE); filter.AddAction(Constants.ACTION_GET_TT_ERROR_STATUS_FAILED); filter.AddAction(Constants.ACTION_GET_TT_ERROR_STATUS_SUCCESS); filter.AddAction(Constants.ACTION_PRODUCT_DELETE_ITEM_CONFIRM); filter.AddAction("unitech.scanservice.data"); fragmentContext.RegisterReceiver(mReceiver, filter); isRegister = true; } return(view); }
public override void OnReceive(Context context, Intent intent) { if (intent.Action == Constants.SOAP_CONNECTION_FAIL) { Log.Debug(TAG, "receive SOAP_CONNECTION_FAIL"); progressBar.Visibility = ViewStates.Gone; } else if (intent.Action == Constants.ACTION_SOCKET_TIMEOUT) { Log.Debug(TAG, "receive ACTION_SOCKET_TIMEOUT"); progressBar.Visibility = ViewStates.Gone; toast(fragmentContext.GetString(Resource.String.socket_timeout)); } else if (intent.Action == Constants.ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_YES) { Log.Debug(TAG, "receive ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_YES"); toast(fragmentContext.GetString(Resource.String.production_storage_inbound_order_has_confirmed, editTextInNo.Text)); } else if (intent.Action == Constants.ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_NO) { Log.Debug(TAG, "receive ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_NO"); WebReference.Service dx = new WebReference.Service(); try { dataTable_RR = dx.Get_TT_product_Entry(editTextInNo.Text, "MAT"); if (dataTable_RR != null) { Log.Warn(TAG, "dataTable.Rows.size() = " + dataTable_RR.Rows.Count); if (dataTable_RR.Rows.Count == 0) { Intent getSuccessIntent = new Intent(Constants.ACTION_GET_TT_PRODUCT_ENTRY_EMPTY); fragmentContext.SendBroadcast(getSuccessIntent); } else { foreach (DataRow rx in dataTable_RR.Rows) { ProductionStorageItem item = new ProductionStorageItem(); item.setIn_no(rx["in_no"].ToString()); item.setItem_no(rx["item_no"].ToString()); item.setIn_date(rx["in_date"].ToString()); item.setMade_no(rx["made_no"].ToString()); item.setStore_type(rx["store_type"].ToString()); item.setDept_no(rx["dept_no"].ToString()); item.setDept_name(rx["dept_name"].ToString()); item.setPart_no(rx["part_no"].ToString()); item.setPart_desc(rx["part_desc"].ToString()); item.setStock_no(rx["stock_no"].ToString()); item.setLocate_no(rx["locate_no"].ToString()); item.setBatch_no(rx["batch_no"].ToString()); item.setQty(rx["qty"].ToString()); item.setStock_unit(rx["stock_unit"].ToString()); item.setEmp_name(rx["emp_name"].ToString()); item.setCount_no(rx["count_no"].ToString()); item.setStock_no_name(rx["stock_no_name"].ToString()); item.setLocate_no_scan(""); item.setSelected(false); productList.Add(item); } Intent getSuccessIntent = new Intent(Constants.ACTION_GET_TT_PRODUCT_ENTRY_SUCCESS); fragmentContext.SendBroadcast(getSuccessIntent); } } else { Intent getSuccessIntent = new Intent(Constants.ACTION_GET_TT_PRODUCT_ENTRY_EMPTY); fragmentContext.SendBroadcast(getSuccessIntent); } /* * Intent checkIntent = new Intent(fragmentContext, GetTTProductEntryService.class); * checkIntent.setAction(Constants.ACTION.ACTION_GET_TT_PRODUCT_ENTRY_ACTION); * checkIntent.putExtra("IN_NO", editTextInNo.getText().toString()); * fragmentContext.startService(checkIntent); * */ } catch (SocketTimeoutException ex) { ex.PrintStackTrace(); Intent timeoutIntent = new Intent(Constants.ACTION_SOCKET_TIMEOUT); fragmentContext.SendBroadcast(timeoutIntent); } catch (SoapException ex) { Intent timeoutIntent = new Intent(Constants.SOAP_CONNECTION_FAIL); fragmentContext.SendBroadcast(timeoutIntent); } } else if (intent.Action == Constants.ACTION_GET_TT_PRODUCT_ENTRY_EMPTY) { Log.Debug(TAG, "receive ACTION_GET_TT_PRODUCT_ENTRY_EMPTY"); progressBar.Visibility = ViewStates.Gone; toast(fragmentContext.GetString(Resource.String.production_storage_inbound_order_has_confirmed, editTextInNo.Text)); btnInStockConfirm.Enabled = false; } else if (intent.Action == Constants.ACTION_GET_TT_PRODUCT_ENTRY_SUCCESS) { Log.Debug(TAG, "receive ACTION_GET_TT_PRODUCT_ENTRY_SUCCESS"); progressBar.Visibility = ViewStates.Gone; if (productionStorageItemAdapter != null) { productionStorageItemAdapter.NotifyDataSetChanged(); } else { productionStorageItemAdapter = new ProductionStorageItemAdapter(fragmentContext, Resource.Layout.production_storage_fragment_list_item, productList); productionStorageItemAdapter.ItemClick += (sender, e) => { Log.Debug(TAG, "Click Sender = " + sender.ToString() + " e = " + e.ToString()); item_select = e; productionStorageItemAdapter.NotifyDataSetChanged(); }; productionStorageItemAdapter.ItemLongClick += (sender, e) => { Log.Debug(TAG, "Long Click Sender = " + sender.ToString() + " e = " + e.ToString()); Intent detailIntent = new Intent(fragmentContext, typeof(ProductionStorageDetailActivity)); detailIntent.PutExtra("INDEX", e.ToString()); detailIntent.PutExtra("IN_NO", productList[e].getIn_no()); detailIntent.PutExtra("ITEM_NO", productList[e].getItem_no()); detailIntent.PutExtra("IN_DATE", productList[e].getIn_date()); detailIntent.PutExtra("MADE_NO", productList[e].getMade_no()); detailIntent.PutExtra("STORE_TYPE", productList[e].getStore_type()); detailIntent.PutExtra("DEPT_NO", productList[e].getDept_no()); detailIntent.PutExtra("DEPT_NAME", productList[e].getDept_name()); detailIntent.PutExtra("PART_NO", productList[e].getPart_no()); detailIntent.PutExtra("PART_DESC", productList[e].getPart_desc()); detailIntent.PutExtra("STOCK_NO", productList[e].getStock_no()); detailIntent.PutExtra("LOCATE_NO", productList[e].getLocate_no()); detailIntent.PutExtra("LOCATE_NO_SCAN", productList[e].getLocate_no_scan()); detailIntent.PutExtra("BATCH_NO", productList[e].getBatch_no()); detailIntent.PutExtra("QTY", productList[e].getQty()); detailIntent.PutExtra("STOCK_UNIT", productList[e].getStock_unit()); detailIntent.PutExtra("COUNT_NO", productList[e].getCount_no()); detailIntent.PutExtra("STOCK_NO_NAME", productList[e].getStock_no_name()); fragmentContext.StartActivity(detailIntent); }; productListRecyclerView.SetAdapter(productionStorageItemAdapter); } c_in_no.Text = productList[0].getIn_no(); c_in_date.Text = productList[0].getIn_date(); c_made_no.Text = productList[0].getMade_no(); c_dept_name.Text = productList[0].getDept_name(); btnInStockConfirm.Enabled = true; } else if (intent.Action == Constants.ACTION_EXECUTE_TT_FAILED) { Log.Debug(TAG, "receive ACTION_EXECUTE_TT_FAILED"); progressBar.Visibility = ViewStates.Gone; toast(fragmentContext.GetString(Resource.String.production_storage_confirm_in_stock_fail)); } else if (intent.Action == Constants.ACTION_PRODUCT_IN_STOCK_WORK_COMPLETE) { Log.Debug(TAG, "receive ACTION_PRODUCT_IN_STOCK_WORK_COMPLETE"); string in_no = intent.GetStringExtra("IN_NO"); progressBar.Visibility = ViewStates.Gone; WebReference.Service dx = new WebReference.Service(); try { string ret = dx.Get_TT_error_status("MAT", in_no); if (ret != null) { Log.Debug(TAG, "receive ACTION_GET_TT_ERROR_STATUS_SUCCESS"); string ret_error_status = intent.GetStringExtra("ERROR_STATUS_RETURN"); System.String[] sv = ret_error_status.Split('#'); if (sv[1].Equals("OK")) { toast(fragmentContext.GetString(Resource.String.production_storage_in_stock_process_complete)); } else { toast(fragmentContext.GetString(Resource.String.production_storage_in_stock_error, sv[1], sv[0])); } } else { Log.Debug(TAG, "receive ACTION_GET_TT_ERROR_STATUS_FAILED"); } } catch (SocketTimeoutException ex) { ex.PrintStackTrace(); Intent timeoutIntent = new Intent(Constants.ACTION_SOCKET_TIMEOUT); fragmentContext.SendBroadcast(timeoutIntent); } catch (SoapException ex) { Intent timeoutIntent = new Intent(Constants.SOAP_CONNECTION_FAIL); fragmentContext.SendBroadcast(timeoutIntent); } } else if (intent.Action.Equals("unitech.scanservice.data")) { Log.Debug(TAG, "unitech.scanservice.data"); Bundle bundle = intent.Extras; if (bundle != null) { string text = bundle.GetString("text"); Log.Warn(TAG, "msg = " + text); if (text != null && text.Length > 0) { int counter = 0; for (int i = 0; i < text.Length; i++) { if (text.ToCharArray()[i] == '#') { counter++; } } Log.Warn(TAG, "counter = " + counter); if (counter >= 1) { toast(fragmentContext.GetString(Resource.String.production_storage_not_inbound_order)); } else { text = text.Replace("\\n", ""); toast(text); if (item_select != -1) { //scan locate if (text.Length != 16) { toast(text); if (dataTable_RR != null && dataTable_RR.Rows.Count > 0) { if (dataTable_RR.Rows[item_select] != null) { dataTable_RR.Rows[item_select]["locate_no"] = text; } } productList[item_select].setLocate_no_scan(text); productList[item_select].setLocate_no(text); //productListView.invalidateViews(); if (productionStorageItemAdapter != null) { productionStorageItemAdapter.NotifyDataSetChanged(); } //productListRecyclerView.InvalidateViews(); } } else { //item_select == -1 editTextInNo.Text = text; progressBar.Visibility = ViewStates.Visible; Log.Warn(TAG, "text.length() == " + text.Length); if (text.Length == 16) { productList.Clear(); if (productionStorageItemAdapter != null) { productionStorageItemAdapter.NotifyDataSetChanged(); } WebReference.Service dx = new WebReference.Service(); try { bool ret = dx.Check_TT_product_Entry_already_confirm("MAT", text); if (!ret) { Intent checkResultIntent = new Intent(Constants.ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_NO); fragmentContext.SendBroadcast(checkResultIntent); } else { Intent checkResultIntent = new Intent(Constants.ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_YES); fragmentContext.SendBroadcast(checkResultIntent); } /*Intent checkIntent = new Intent(fragmentContext, CheckTTProductEntryAlreadyConfirm.class); * checkIntent.setAction(Constants.ACTION.ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_ACTION); * checkIntent.putExtra("IN_NO", text); * fragmentContext.startService(checkIntent);*/ } catch (SocketTimeoutException ex) { ex.PrintStackTrace(); Intent timeoutIntent = new Intent(Constants.ACTION_SOCKET_TIMEOUT); fragmentContext.SendBroadcast(timeoutIntent); } catch (SoapException ex) { Intent timeoutIntent = new Intent(Constants.SOAP_CONNECTION_FAIL); fragmentContext.SendBroadcast(timeoutIntent); } } } } } } } }