package com.jiaju.activity; import java.io.File; import java.io.IOException; import java.io.Serializable; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.jiaju.adapter.ProductClassifyAdapter; import com.jiaju.adapter.ReworkProcedureSpinnerAdapter; import com.jiaju.adapter.SwipeAdapter; import com.jiaju.model.DefectDeduction; import com.jiaju.model.DefectFines; import com.jiaju.model.DefectLocation; import com.jiaju.model.DefectNo; import com.jiaju.model.DutyPerson; import com.jiaju.model.ImagePath; import com.jiaju.model.ProductClassifyInfo; import com.jiaju.model.ProductDefectInfo; import com.jiaju.model.ProductionInfo; import com.jiaju.model.ResponsibilityProcedure; import com.jiaju.model.ReworkProcedureInfo; import com.jiaju.model.WorkNo; import com.jiaju.model.WorkType; import com.jiaju.net.OkAsyncHttpClient; import com.jiaju.net.WebClient; import com.jiaju.utils.CommonUtil; import com.jiaju.utils.Constants; import com.jiaju.utils.CustomToast; import com.jiaju.utils.Md5Utils; import com.jiaju.utils.PopupWindowCheckChoose; import com.jiaju.utils.PopupWindowCheckChoose.onEventLisenter; import com.jiaju.utils.ProcessDialogUtils; import com.jiaju.utils.ViewUtil; import com.jiaju.widget.DefectCommonPopMenu; import com.jiaju.widget.SwipeListView; import android.app.Activity; import android.app.Notification; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.content.res.Resources; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; import android.os.Message; import android.text.Editable; import android.text.InputFilter; import android.text.InputType; import android.text.Spanned; import android.text.TextUtils; import android.text.TextWatcher; import android.view.Gravity; import android.view.KeyEvent; import android.view.Menu; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; import android.view.View.OnTouchListener; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.RelativeLayout; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; /** * 质量登记 * * @author wangyingjie * */ public class CheckCollectModifyActivity extends Activity { private EditText barcode; private String accountCode; private static String checkCollectModify_userCode; private String password; private String sessionkey; private SharedPreferences preferences; private String ServerAddress_ip; private String ServerAddress_duankou; private HandlerThread thread; private Handler mHandler; private WebClient client = null; private ReworkProcedureSpinnerAdapter adapterReWorkProcedure; private List listReWorkProcedure = null;// 跳转信息列表 private int proId; private ProductionInfo productionInfo; private Button save; private ImageButton backBtn; private TextView back; private Spinner gotoSpin; private TextView productNumber; private TextView productCode, productName; private SwipeAdapter mAdapter; private int defectflag = 1; private List listProductClassify = null; private List listCheckLeak = null;// 漏气数据源 private List listCheckNourishingWater = null;// 养水数据源 private List listCheckNourishingWaterPosition = null;// 养水不合格位置数据源 private List listCheckWaterTest = null;// 试水数据源 private List listCheckWaterTestPosition = null;// 试水不合格位置数据源 private List listCheckRepairCrackPosition = null;// 补裂位置数据源 private List listCheckOfflineIdentificatio = null;// 下标划线数据源 private List list_null = new ArrayList();// 空数据源 private String defectLocation; private Spinner classifySpin; private Spinner check_leak;// 漏气 private Spinner check_nourishing_water;// 养水 private Spinner check_nourishing_water_position;// 养水不合格位置 private Spinner check_water_test;// 试水 private Spinner check_grinding_test;// 修磨 private Spinner check_water_test_position;// 试水不合格位置 private Spinner check_offline_identificatio;// 下线标识 private TextView check_repair_crack_position;// 补裂位置 private LinearLayout lay_check_repair_crack_position;// 补裂位置布局 private ProductClassifyInfo classifyInfo = null; private ProductClassifyAdapter adapterProductClassify; private ProductClassifyAdapter adapterCheckLeak;// 漏气适配器 private ProductClassifyAdapter adapterCheckNourishingWater;// 养水适配器 private ProductClassifyAdapter adapterCheckNourishingWaterPosition;// 养水不合格位置适配器 private ProductClassifyAdapter adapterCheckOfflineIdentificatio;// 下标划线适配器 private ProductClassifyAdapter adapterCheckWaterTest;// 试水适配器 private ProductClassifyAdapter adapterCheckWaterTestPosition;// 试水不合格位置适配器 private ProductClassifyAdapter adapterCheckRepairCrackPositionPosition;// 补裂位置适配器 private Button recordBug;// 记录缺陷按钮 private SwipeListView mListView; private int modelType; int productionDataId; private EditText worknoEdt; private int collectType; // 采集类型:1-集中 2-单点 private int nodeType; private TextView title; private boolean worknovalid; private boolean defectnovalid; private String userID = "";// 条码对应的产品ID private String worknouserCode; private boolean produceCodeIsValid = false; private String out_goodsID; private String out_goodsCode; private String out_goodsName; private String out_groutingUserCode; private String operationFlag; private String workNoName; private EditText bugnotxt; private String defectno; private DefectNo defectNo; private int defectId; private String defectName; private TextView bugnametxt; private EditText loctxt; private boolean defectlocationvalid; private DefectLocation dl; private boolean refineflag; private TextView refineEdt; private ImageView checkCollectModify; private boolean repairFlag; private TextView repairEdt; private LinearLayout repairLay; private ImageView productRecord; private RelativeLayout parent; private PopupWindow mPopupWindow; // 弹出框 private int refire; private String refireName; private String specialRepairFlag; private String specialRepairFlagName; private List worknolist = null; public View footerdivider; public Object obj = new Object(); private boolean dryRepairFlag = false; private ReworkProcedureInfo reworkProcedureInfo; private String timestamp; private TextView trademarkNameTxt; private TextView tvLeak; private TextView tvInternalLeak; private TextView tvPassBall; private String user; private boolean overdueFlag = false; private String checkTime; private String remarks; private EditText memoEdt; private TextView tvLocName; private Handler h = new Handler(); private ExceptionHandler exceptionHandler = new ExceptionHandler(this); private SaveValidHandler saveValidHandler = new SaveValidHandler(this); private ResultHandler handler = new ResultHandler(this); private Handler barcodeUpperH = new Handler(); private String barcodeUpper; private String checkFlag = "1"; private boolean deleteFlag; private int originalGoodsLevelTypeId; private static String repeatFlag = ""; private List productBugList = new ArrayList(); private OkAsyncHttpClient mClient; private String GOODSMODELforCheck = "";// 判断产品 是大件还是小件 通过扫描barcode BAR_CODE_VALID获得 private String RECYCLINGFLAG = ""; private String webServerAddress_port; private ArrayList mList = new ArrayList(); private PopupWindowCheckChoose mPopup; private String mCheckRepairCrackPositionDate = ""; private ProductClassifyInfo check_offline_identificatioInfo; private LinearLayout llay_cold_repair_category;// 冷补类别 private Spinner check_cold_repair_category;// 冷补类别 private List listCheckColdRepairCategory = null;// 冷补类别 private ProductClassifyAdapter adapterCheckColdRepairCategory;// 冷补类别适配器 private List listCheckGrinding = null;// 修磨数据源 private ProductClassifyAdapter adapterCheckGrinding;// 修磨适配器 private static String Mout_ReworkProcedureId = ""; private static String refireflag = ""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.update_check_collect); initView(); Bundle b = getIntent().getExtras(); String procedureName = b.getString("ProcedureName"); proId = b.getInt("procedureId"); modelType = b.getInt("modelType"); collectType = b.getInt("collectType"); procedureName = b.getString("procedureName"); nodeType = b.getInt("nodeType"); title.setText(procedureName);// 设置标题 gotoSpin.setEnabled(false); preferences = getSharedPreferences("user", Context.MODE_PRIVATE); ServerAddress_ip = preferences.getString("ServerAddress_ip", ""); mClient = OkAsyncHttpClient.getInstance(CheckCollectModifyActivity.this); ServerAddress_duankou = preferences.getString("ServerAddress_duankou", ""); // webServerAddress_port = preferences.getString("WebServerAddress_port", ""); webServerAddress_port = "9001"; accountCode = preferences.getString("AccountCode", ""); checkCollectModify_userCode = preferences.getString("UserCode", ""); password = preferences.getString("UserPassword", ""); sessionkey = preferences.getString("SessionKey", ""); CommonUtil.BarcodeMaxLength(barcode, 50); if (collectType == 1) { worknoEdt.setSelectAllOnFocus(true); worknoEdt.setFocusable(true); worknoEdt.requestFocus(); worknoEdt.findFocus(); } repeatFlag = System.currentTimeMillis() + "-" + checkCollectModify_userCode; // 标题包含漏气 漏气就能点击 包含养水 养水就能点击 包含试水 试水 就能点击 // 养水或者 试水不合格 那对应的 不合格位置 就会放开 否则就会 禁止点击 check_leak.setEnabled(false);// 漏气 check_nourishing_water.setEnabled(false);// 养水 check_water_test.setEnabled(false);// 试水 lay_check_repair_crack_position.setEnabled(false);// 补裂位置 if (title.getText().toString().indexOf("漏气") != -1) { check_leak.setEnabled(true);// 漏气 } else if (title.getText().toString().indexOf("养水") != -1) { check_nourishing_water.setEnabled(true);// 养水 } else if (title.getText().toString().indexOf("试水") != -1) { check_water_test.setEnabled(true);// 试水 } else if (title.getText().toString().indexOf("补裂") != -1) {// 放开补裂位置控件权限 lay_check_repair_crack_position.setEnabled(true);// 补裂位置 } else if (proId == 125) {// 三车间 三检 放开下线标识控件权限 check_offline_identificatio.setEnabled(true); // 下线标识 } if ((proId == 125) || (proId == 131)) { // todo 三检 的时候 增加 冷补类别 -- 外观: 冷补返工为冷补确认, --功能: 冷补返工为冷补交接 --注: // 产品等级选择为冷补后,必须选择[冷补类别] // llay_cold_repair_category.setVisibility(View.VISIBLE); } if (proId == 157 ) { //修模进 check_leak.setEnabled(true);// 漏气 } if (proId == 123 || proId == 157) { // 修模 养水 进 classifySpin.setEnabled(false); } check_nourishing_water_position.setEnabled(false); check_water_test_position.setEnabled(false); AllListeners(); } private void initView() { barcode = (EditText) findViewById(R.id.bar_code); barcode.setRawInputType(InputType.TYPE_CLASS_NUMBER); footerdivider = findViewById(R.id.footerdivider); repairEdt = (TextView) findViewById(R.id.repairtxt); backBtn = (ImageButton) findViewById(R.id.left_img); checkCollectModify = (ImageView) findViewById(R.id.modifyid); recordBug = (Button) findViewById(R.id.check_record_bug); save = (Button) findViewById(R.id.check_save); back = (TextView) findViewById(R.id.back); classifySpin = (Spinner) findViewById(R.id.check_classify); productNumber = (TextView) findViewById(R.id.check_product_number); productCode = (TextView) findViewById(R.id.check_product_code); productName = (TextView) findViewById(R.id.check_product_name); tvLeak = (TextView) findViewById(R.id.tvLeak); tvInternalLeak = (TextView) findViewById(R.id.tvInternalLeak); tvLocName = (TextView) findViewById(R.id.tvLocName); tvPassBall = (TextView) findViewById(R.id.tvPassBall); mListView = (SwipeListView) findViewById(R.id.listview); trademarkNameTxt = (TextView) findViewById(R.id.trademarkName); memoEdt = (EditText) findViewById(R.id.memoEdt); memoEdt.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View view, MotionEvent event) { if (view.getId() == R.id.memoEdt) { view.getParent().requestDisallowInterceptTouchEvent(true); switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_UP: view.getParent().requestDisallowInterceptTouchEvent(false); break; } } return false; } }); title = (TextView) findViewById(R.id.title); gotoSpin = (Spinner) findViewById(R.id.check_goto_job); check_leak = (Spinner) findViewById(R.id.check_leak);// 漏气 check_nourishing_water = (Spinner) findViewById(R.id.check_nourishing_water);// 养水 check_nourishing_water_position = (Spinner) findViewById(R.id.check_nourishing_water_position);// 养水不合格位置 check_water_test = (Spinner) findViewById(R.id.check_water_test);// 试水 check_grinding_test = (Spinner) findViewById(R.id.check_grinding_test);// 修磨 check_offline_identificatio = (Spinner) findViewById(R.id.check_offline_identificatio);// 下线标识 check_water_test_position = (Spinner) findViewById(R.id.check_water_test_position);// 试水不合格位置 lay_check_repair_crack_position = (LinearLayout) findViewById(R.id.lay_check_repair_crack_position);// 补裂位置 // 注册补裂位置控件 check_repair_crack_position = (TextView) findViewById(R.id.tv_check_repair_crack_position);// 补裂位置 注册补裂位置控件 worknoEdt = (EditText) findViewById(R.id.user_code); bugnotxt = (EditText) findViewById(R.id.bugnotxt); bugnotxt.setRawInputType(InputType.TYPE_CLASS_NUMBER); bugnametxt = (TextView) findViewById(R.id.bugnametxt); loctxt = (EditText) findViewById(R.id.loctxt); loctxt.setRawInputType(InputType.TYPE_CLASS_NUMBER); refineEdt = (TextView) findViewById(R.id.refinetxt); repairLay = (LinearLayout) findViewById(R.id.repairlay); productRecord = (ImageView) findViewById(R.id.search); productRecord.setVisibility(View.VISIBLE); parent = (RelativeLayout) findViewById(R.id.parentRel); // 冷补类别 llay_cold_repair_category = (LinearLayout) findViewById(R.id.llay_cold_repair_category); check_cold_repair_category = (Spinner) findViewById(R.id.check_cold_repair_category);// 冷补类别 mPopup = new PopupWindowCheckChoose(this, mList); } private void AllListeners() { // LoadRunnable 上来就调用 给 漏气 养水 养水不合格位置 试水 试水不合格位置 提供数据源 // start ----------------- thread = new HandlerThread("trademarkThread", 5); thread.start(); mHandler = new Handler(thread.getLooper()); LoadRunnable loadRunnable = new LoadRunnable(); mHandler.post(loadRunnable); // end ----------------- switch (collectType) { case 1: worknoEdt.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { JSONObject jsonObject = null; EditText e = (EditText) v; String workno = e.getText().toString(); if (!workno.contains("\n")) { workno = workno.trim(); if (!hasFocus) { if (!TextUtils.isEmpty(workno)) { ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this); worknoEdt.setEnabled(false); worknoEdt.setFocusable(false); worknoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); barcode.setEnabled(false); barcode.setFocusable(false); barcode.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); bugnotxt.setEnabled(false); bugnotxt.setFocusable(false); bugnotxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); loctxt.setEnabled(false); loctxt.setFocusable(false); loctxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); memoEdt.setEnabled(false); memoEdt.setFocusable(false); memoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); try { jsonObject = new JSONObject(); jsonObject.put("accountCode", accountCode); jsonObject.put("userCode", checkCollectModify_userCode); jsonObject.put("userPassword", password); jsonObject.put("sessionKey", sessionkey); // 生产工号检验请求数据 jsonObject.put("procedureID", proId);// 工序ID,菜单页面传过来的 jsonObject.put("procedureUserCode", workno);// 生产工号 thread = new HandlerThread("userThread", 5); thread.start(); mHandler = new Handler(thread.getLooper()); UserRunnable userRunnable = new UserRunnable(jsonObject); mHandler.post(userRunnable); } catch (JSONException e1) { e1.printStackTrace(); } } } } } } ); worknoEdt.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable arg0) { if (worknoEdt.getText().toString().contains("\n")) { String workno = worknoEdt.getText().toString().trim().replaceAll("\\n", ""); if (!TextUtils.isEmpty(workno)) { ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this); worknoEdt.setEnabled(false); worknoEdt.setFocusable(false); worknoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); barcode.setEnabled(false); barcode.setFocusable(false); barcode.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); bugnotxt.setEnabled(false); bugnotxt.setFocusable(false); bugnotxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); loctxt.setEnabled(false); loctxt.setFocusable(false); loctxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); memoEdt.setEnabled(false); memoEdt.setFocusable(false); memoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); JSONObject sendJsonHead = new JSONObject(); try { sendJsonHead.put("accountCode", accountCode); sendJsonHead.put("userCode", checkCollectModify_userCode); sendJsonHead.put("userPassword", password); sendJsonHead.put("sessionKey", sessionkey); // 生产工号检验请求数据 sendJsonHead.put("procedureID", proId);// 工序ID,菜单页面传过来的 sendJsonHead.put("procedureUserCode", workno);// 生产工号 thread = new HandlerThread("userThread", 5); thread.start(); mHandler = new Handler(thread.getLooper()); UserRunnable userRunnable = new UserRunnable(sendJsonHead); mHandler.post(userRunnable); } catch (JSONException e1) { e1.printStackTrace(); } } } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { user = worknoEdt.getText().toString(); // 判断输入的文字是否是小写 for (int i = 0; i < user.length(); i++) { if (user.charAt(i) - 0 >= 97 && user.charAt(i) - 0 <= 122) { h.postDelayed(UpperCase, 300); } } } }); break; case 2: worknoEdt.setText(checkCollectModify_userCode); worknoEdt.setEnabled(false); worknoEdt.setFocusable(false); worknoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); JSONObject sendJsonHead = new JSONObject(); try { sendJsonHead.put("accountCode", accountCode); sendJsonHead.put("userCode", checkCollectModify_userCode); sendJsonHead.put("userPassword", password); sendJsonHead.put("sessionKey", sessionkey); // 生产工号检验请求数据 sendJsonHead.put("procedureID", proId);// 工序ID,菜单页面传过来的 sendJsonHead.put("procedureUserCode", checkCollectModify_userCode);// 生产工号 } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this); thread = new HandlerThread("userThread", 5); thread.start(); mHandler = new Handler(thread.getLooper()); UserRunnable userRunnable = new UserRunnable(sendJsonHead); mHandler.post(userRunnable); break; } lay_check_repair_crack_position.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mPopup.showPop(check_repair_crack_position); } }); bugnotxt.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_NEXT) { ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this); defectno = bugnotxt.getText().toString().trim(); if (!TextUtils.isEmpty(defectno)) { thread = null; thread = new HandlerThread("bugnoThread", 5); thread.start(); mHandler = new Handler(thread.getLooper()); mHandler.post(bugnoRunnable); } else { Toast.makeText(getApplicationContext(), "缺陷号不能为空", Toast.LENGTH_SHORT).show(); ProcessDialogUtils.closeProgressDilog(); bugnotxt.setFocusable(true); bugnotxt.requestFocus(); return true; } } return true; } }); bugnotxt.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { defectnovalid = false; } }); productRecord.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int height = parent.getHeight() - v.getHeight(); DefectCommonPopMenu recordPopMenu = new DefectCommonPopMenu(CheckCollectModifyActivity.this, height); mPopupWindow = recordPopMenu.getMenu(); if (mPopupWindow == null) { return; } if (mPopupWindow.isShowing()) { mPopupWindow.dismiss(); return; } mPopupWindow.showAtLocation(parent, Gravity.BOTTOM, 0, 0); LinearLayout scanLay = (LinearLayout) recordPopMenu.menu.findViewById(R.id.scanlay); ImageView scanImg = (ImageView) recordPopMenu.menu.findViewById(R.id.scanimg); TextView scanTitle = (TextView) recordPopMenu.menu.findViewById(R.id.scantitle); scanTitle.setText("扫一扫"); scanImg.setBackgroundResource(R.drawable.scan); scanLay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent openCameraIntent = new Intent(CheckCollectModifyActivity.this, CaptureActivity.class); startActivityForResult(openCameraIntent, 102); if (mPopupWindow.isShowing()) { mPopupWindow.dismiss(); } } }); } }); loctxt.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_GO) { defectLocation = loctxt.getText().toString().trim(); if (!TextUtils.isEmpty(defectLocation)) { ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this); thread = null; thread = new HandlerThread("buglocationThread", 5); thread.start(); mHandler = null; mHandler = new Handler(thread.getLooper()); mHandler.post(bugLocationRunnable); return true; } else { ProcessDialogUtils.closeProgressDilog(); Toast.makeText(getApplicationContext(), "缺陷位置不能为空", Toast.LENGTH_SHORT).show(); loctxt.setFocusable(true); loctxt.requestFocus(); return true; } } return true; } }); loctxt.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { defectlocationvalid = false; } }); recordBug.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ProductClassifyInfo classifyInfo = (ProductClassifyInfo) classifySpin.getSelectedItem(); if (classifyInfo == null) { Toast.makeText(getApplicationContext(), "产品分级不能为空", Toast.LENGTH_SHORT).show(); return; } int GoodsLevelTypeID = classifyInfo.getGoodsLevelTypeID(); if (GoodsLevelTypeID == 4) { Toast.makeText(getApplicationContext(), "正品不能记录缺陷", Toast.LENGTH_SHORT).show(); return; } String code = productNumber.getText().toString(); if (TextUtils.isEmpty(code)) { Toast.makeText(getApplicationContext(), "产品条码信息不能为空", Toast.LENGTH_SHORT).show(); return; } String productIsbn = productCode.getText().toString(); if (TextUtils.isEmpty(productIsbn)) { Toast.makeText(getApplicationContext(), "产品编码不能为空", Toast.LENGTH_SHORT).show(); return; } defectno = bugnotxt.getText().toString().trim(); if (TextUtils.isEmpty(defectno)) { Toast.makeText(getApplicationContext(), "缺陷号不能为空", Toast.LENGTH_SHORT).show(); bugnotxt.setFocusable(true); bugnotxt.requestFocus(); return; } else { if (!defectnovalid) { Toast.makeText(getApplicationContext(), "请在缺陷号输入框内按回车键验证缺陷号", Toast.LENGTH_SHORT).show(); bugnotxt.setFocusable(true); bugnotxt.requestFocus(); return; } } defectLocation = loctxt.getText().toString().trim(); if (TextUtils.isEmpty(defectLocation)) { Toast.makeText(getApplicationContext(), "缺陷位置不能为空", Toast.LENGTH_SHORT).show(); loctxt.setFocusable(true); loctxt.requestFocus(); return; } else { if (!defectlocationvalid) { Toast.makeText(getApplicationContext(), "请在缺陷位置输入框内按回车键验证缺陷位置", Toast.LENGTH_SHORT).show(); loctxt.setFocusable(true); loctxt.requestFocus(); return; } } // 如果该条产品已经有废品标志,再点击记录缺陷按钮,则传一个标志位为True,否则传false Bundle bundle = new Bundle(); try { Intent intent = new Intent(); // bundle.putInt("scrapflag", 0); bundle.putString("out_goodsID", String.valueOf(productionInfo.getGoodsId())); bundle.putString("out_goodsCode", productionInfo.getGoodsCode()); bundle.putInt("proId", proId); bundle.putInt("modeltype", modelType); bundle.putString("repairFlag", specialRepairFlag); bundle.putString("barCode", productionInfo.getBarCode()); bundle.putString("operationFlag", "add"); bundle.putSerializable("defectNo", defectNo); bundle.putSerializable("defectLocation", dl); bundle.putSerializable("recyclingFlag", RECYCLINGFLAG); bundle.putSerializable("productBugList", (Serializable) productBugList); intent.putExtras(bundle); intent.setClass(CheckCollectModifyActivity.this, ProductBugActivity.class); startActivityForResult(intent, 100); } catch (Exception e) { } } }); barcode.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable arg0) { if (barcode.getText().toString().contains("\n")) { String code = barcode.getText().toString().trim().replaceAll("\\n", ""); String workno = worknoEdt.getText().toString(); if (TextUtils.isEmpty(workno)) { Toast.makeText(getApplicationContext(), "生产工号不能为空", Toast.LENGTH_SHORT).show(); worknoEdt.setEnabled(true); worknoEdt.setFocusable(true); worknoEdt.setFocusableInTouchMode(true); worknoEdt.requestFocus(); worknoEdt.findFocus(); worknoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); return; } else { if (!worknovalid) { Toast.makeText(getApplicationContext(), "请先验证生产工号", Toast.LENGTH_SHORT).show(); worknoEdt.setEnabled(true); worknoEdt.setFocusable(true); worknoEdt.setFocusableInTouchMode(true); worknoEdt.requestFocus(); worknoEdt.findFocus(); worknoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); return; } } ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this); recordBug.setEnabled(true); overdueFlag = false; productNumber.setText(""); memoEdt.setText(""); productCode.setText(""); productName.setText(""); refineEdt.setText(""); bugnotxt.setText(""); bugnametxt.setText(""); trademarkNameTxt.setText(""); loctxt.setText(""); repairEdt.setText(""); tvLeak.setText(""); tvInternalLeak.setText(""); tvPassBall.setText(""); if (classifySpin.getSelectedItem() != null) { listProductClassify.removeAll(listProductClassify); if (adapterProductClassify != null) { adapterProductClassify.notifyDataSetChanged(); } } if (gotoSpin.getSelectedItem() != null) { listReWorkProcedure.clear(); if (adapterReWorkProcedure != null) { adapterReWorkProcedure.notifyDataSetChanged(); } } save.setVisibility(View.VISIBLE); if (productBugList != null && productBugList.size() > 0) { productBugList.removeAll(productBugList); if (mAdapter != null) { mAdapter.notifyDataSetChanged(); } save.setText("保存(" + productBugList.size() + ")"); } barcode.setEnabled(false); barcode.setFocusable(false); barcode.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); bugnotxt.setEnabled(false); bugnotxt.setFocusable(false); bugnotxt.setFocusableInTouchMode(false); bugnotxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); loctxt.setEnabled(false); loctxt.setFocusable(false); loctxt.setFocusableInTouchMode(false); loctxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); thread = new HandlerThread("barcodeThread", 5); thread.start(); mHandler = new Handler(thread.getLooper()); BarcodeRunnable barcodeRunnable = new BarcodeRunnable(code, obj); mHandler.post(barcodeRunnable); } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { barcodeUpper = barcode.getText().toString(); // 判断输入的文字是否是小写 for (int i = 0; i < barcodeUpper.length(); i++) { if (barcodeUpper.charAt(i) - 0 >= 97 && barcodeUpper.charAt(i) - 0 <= 122) { barcodeUpperH.postDelayed(BarcodeUpperCase, 300); } } } }); barcode.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_GO) { String workno = worknoEdt.getText().toString(); if (TextUtils.isEmpty(workno)) { Toast.makeText(getApplicationContext(), "生产工号不能为空", Toast.LENGTH_SHORT).show(); worknoEdt.setEnabled(true); worknoEdt.setFocusable(true); worknoEdt.setFocusableInTouchMode(true); worknoEdt.requestFocus(); worknoEdt.findFocus(); worknoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); return true; } else { if (!worknovalid) { Toast.makeText(getApplicationContext(), "请先验证生产工号", Toast.LENGTH_SHORT).show(); worknoEdt.setEnabled(true); worknoEdt.setFocusable(true); worknoEdt.setFocusableInTouchMode(true); worknoEdt.requestFocus(); worknoEdt.findFocus(); worknoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); return true; } } String code = barcode.getText().toString().trim(); if (!TextUtils.isEmpty(code)) { recordBug.setEnabled(true); overdueFlag = false; productNumber.setText(""); productCode.setText(""); productName.setText(""); trademarkNameTxt.setText(""); refineEdt.setText(""); bugnotxt.setText(""); memoEdt.setText(""); bugnametxt.setText(""); trademarkNameTxt.setText(""); tvLeak.setText(""); tvInternalLeak.setText(""); tvPassBall.setText(""); loctxt.setText(""); repairEdt.setText(""); if (classifySpin.getSelectedItem() != null) { listProductClassify.removeAll(listProductClassify); if (adapterProductClassify != null) { adapterProductClassify.notifyDataSetChanged(); } } if (gotoSpin.getSelectedItem() != null) { listReWorkProcedure.clear(); if (adapterReWorkProcedure != null) { adapterReWorkProcedure.notifyDataSetChanged(); } } save.setVisibility(View.VISIBLE); if (productBugList != null && productBugList.size() > 0) { productBugList.removeAll(productBugList); if (mAdapter != null) { mAdapter.notifyDataSetChanged(); } save.setText("保存(" + productBugList.size() + ")"); } ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this); barcode.setEnabled(false); barcode.setFocusable(false); barcode.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); bugnotxt.setEnabled(false); bugnotxt.setFocusable(false); bugnotxt.setFocusableInTouchMode(false); bugnotxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); loctxt.setEnabled(false); loctxt.setFocusable(false); loctxt.setFocusableInTouchMode(false); loctxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); // startTime= System.currentTimeMillis(); thread = new HandlerThread("barcodeThread", 5); thread.start(); mHandler = new Handler(thread.getLooper()); BarcodeRunnable barcodeRunnable = new BarcodeRunnable(code, obj); mHandler.post(barcodeRunnable); return true; } } return true; } }); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (productBugList != null && productBugList.size() > 0) { productBugList.removeAll(productBugList); } finish(); } }); backBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (productBugList != null && productBugList.size() > 0) { productBugList.removeAll(productBugList); } finish(); } }); // 点击保存按钮 save.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { String workno = worknoEdt.getText().toString(); if (TextUtils.isEmpty(workno)) { Toast.makeText(getApplicationContext(), "生产工号不能为空", Toast.LENGTH_SHORT).show(); worknoEdt.setEnabled(true); worknoEdt.setFocusable(true); worknoEdt.setFocusableInTouchMode(true); worknoEdt.requestFocus(); worknoEdt.findFocus(); worknoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); return; } else { if (!worknovalid) { Toast.makeText(getApplicationContext(), "请先验证生产工号", Toast.LENGTH_SHORT).show(); worknoEdt.setEnabled(true); worknoEdt.setFocusable(true); worknoEdt.setFocusableInTouchMode(true); worknoEdt.requestFocus(); worknoEdt.findFocus(); worknoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); return; } } String code = productNumber.getText().toString(); if (TextUtils.isEmpty(code)) { Toast.makeText(getApplicationContext(), "产品条码信息不能为空", Toast.LENGTH_SHORT).show(); return; } String productIsbn = productCode.getText().toString(); if (TextUtils.isEmpty(productIsbn)) { Toast.makeText(getApplicationContext(), "产品编码不能为空", Toast.LENGTH_SHORT).show(); return; } ProductClassifyInfo classifyInfo = (ProductClassifyInfo) classifySpin.getSelectedItem(); if (classifyInfo == null) { Toast.makeText(getApplicationContext(), "产品分级不能为空", Toast.LENGTH_SHORT).show(); return; } ProductClassifyInfo check_leakInfo = (ProductClassifyInfo) check_leak.getSelectedItem(); ProductClassifyInfo check_nourishing_waterInfo = (ProductClassifyInfo) check_nourishing_water .getSelectedItem(); ProductClassifyInfo check_nourishing_water_positionInfo = (ProductClassifyInfo) check_nourishing_water_position .getSelectedItem(); // 当养水不合格 的 时候要判断 养水不合格位置 if ("不合格".equals(check_nourishing_waterInfo.getDefectFlagName()) && check_nourishing_water_positionInfo == null) { Toast.makeText(getApplicationContext(), "养水不合格位置不能为空", Toast.LENGTH_SHORT).show(); return; } ProductClassifyInfo check_water_testInfo = (ProductClassifyInfo) check_water_test.getSelectedItem(); ProductClassifyInfo check_water_test_positionInfo = (ProductClassifyInfo) check_water_test_position .getSelectedItem(); if (proId == 125) { // 三检 三车间 check_offline_identificatioInfo = (ProductClassifyInfo) check_offline_identificatio .getSelectedItem(); } // 当试水不合格 的 时候要判断 试水不合格位置 if ("不合格".equals(check_water_testInfo.getDefectFlagName()) && check_water_test_positionInfo == null) { Toast.makeText(getApplicationContext(), "试水不合格位置不能为空", Toast.LENGTH_SHORT).show(); return; } // if (title.getText().toString().indexOf("补裂") != -1) {// 2023/3/14 当页面为补裂的时候 校验补裂位置选项 // if ("".equals(mCheckRepairCrackPositionDate)) { // Toast.makeText(getApplicationContext(), "请选择补裂位置", Toast.LENGTH_SHORT).show(); // return; // } // } int GoodsLevelTypeID = classifyInfo.getGoodsLevelTypeID(); int GoodsLevelID = classifyInfo.getDefectFlagId(); if (!(proId == 123 || proId == 157)) { // 养水 3#修模 不判断产品等级缺陷 if (productBugList != null && productBugList.size() > 0) { if (classifyInfo.getGoodsLevelTypeID() == 4) { Toast.makeText(getApplicationContext(), "缺陷产品不能为正品", Toast.LENGTH_SHORT).show(); return; } if (gotoSpin.getSelectedItem() == null && classifyInfo.getGoodsLevelTypeID() == 6) { Toast.makeText(getApplicationContext(), "返工工序不能为空", Toast.LENGTH_SHORT).show(); return; } } else { if (classifyInfo.getGoodsLevelTypeID() > 4) { Toast.makeText(getApplicationContext(), "非正品需要选择缺陷", Toast.LENGTH_SHORT).show(); return; } } } if (operationFlag.equals("modify")) { boolean isModify = false; if (productBugList != null && productBugList.size() > 0) { for (int i = 0; i < productBugList.size(); i++) { ProductDefectInfo defectInfo = productBugList.get(i); if (defectInfo.getDeleteFlag().equals("local")) { isModify = true; } } } if ("不合格".equals(check_leakInfo.getDefectFlagName()) || "不合格".equals(check_nourishing_waterInfo.getDefectFlagName()) || "不合格".equals(check_water_testInfo.getDefectFlagName())) { isModify = true; } // if (!check_leakInfo.getDefectFlagName().equals(productionInfo.getOut_LeakFlag1Name())) { // 判断漏气 // // 数据是否改变 // isModify = true; // } // if (!check_nourishing_waterInfo.getDefectFlagName() // .equals(productionInfo.getOut_LeakFlag4Name())) { // 判断养水 数据是否改变 // isModify = true; // } // if (!check_water_testInfo.getDefectFlagName().equals(productionInfo.getOut_LeakFlag5Name())) { // 判断试水 // // 数据是否改变 // isModify = true; // } if (proId == 125) { // 三检 三车间 if (!((check_offline_identificatioInfo.getDefectFlagId() + "") .equals(productionInfo.getOfflineFlag()))) { // 判断下线标识 数据是否改变 isModify = true; } } if (proId != 157) { //不是修磨才进来判断,修磨不判断了 if (classifyInfo.getGoodsLevelTypeID() != 16) { // 产品等级 是冷补的时候 不校验 if ((!isModify) && (!deleteFlag) && (GoodsLevelTypeID == originalGoodsLevelTypeId)) { CustomToast.showToast(getApplicationContext(), "数据没有修改不能保存", 2000); return; } } } } reworkProcedureInfo = (ReworkProcedureInfo) gotoSpin.getSelectedItem(); remarks = memoEdt.getText().toString(); if (productBugList != null && productBugList.size() > 0) { if (operationFlag.equals("add")) { for (int i = 0; i < productBugList.size(); i++) { ProductDefectInfo pdf = productBugList.get(i); pdf.setCreateTime(null); } } } // 2023年10月16日 // if (classifyInfo.getDefectFlagName() == "冷补") {// 产品等级选择为冷补后,必须选择[冷补类别] // ProductClassifyInfo check_cold_repair_categoryInfo = (ProductClassifyInfo) check_cold_repair_category // .getSelectedItem(); // if (check_cold_repair_categoryInfo == null) { // Toast.makeText(getApplicationContext(), "产品等级选择为冷补后,必须选择[冷补类别]", Toast.LENGTH_SHORT).show(); // return; // } // } ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this); if (save.isEnabled()) { save.setEnabled(false); thread = null; thread = new HandlerThread("SaveThread", 5); thread.start(); mHandler = null; mHandler = new Handler(thread.getLooper()); SaveRunnable saveRunnable = new SaveRunnable(obj, GoodsLevelTypeID, GoodsLevelID); mHandler.post(saveRunnable); } } catch (Exception e) { e.printStackTrace(); } } }); classifySpin.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView arg0, View arg1, int arg2, long arg3) { classifyInfo = (ProductClassifyInfo) arg0.getItemAtPosition(arg2); int GoodsLevelTypeID = classifyInfo.getGoodsLevelTypeID();// 所选产品分级类型 // GoodsLevelID = classifyInfo.getDefectFlagId(); //2023年10月16日 // if (GoodsLevelTypeID == 16) { // 产品分级选中冷补 把冷补类别打开 // check_cold_repair_category.setEnabled(true); // } else { // check_cold_repair_category.setEnabled(false); // } if (GoodsLevelTypeID != 6) { gotoSpin.setEnabled(false); } if (GoodsLevelTypeID == 4) { if (listReWorkProcedure != null) { listReWorkProcedure.clear(); if (adapterReWorkProcedure != null) { adapterReWorkProcedure.notifyDataSetChanged(); } } } else { if (GoodsLevelTypeID == 6 || GoodsLevelTypeID == 16) { // 重烧 和冷补 可以进 try { JSONObject jsonObject = new JSONObject(); jsonObject.put("accountCode", accountCode); jsonObject.put("userCode", checkCollectModify_userCode); jsonObject.put("userPassword", password); jsonObject.put("sessionKey", sessionkey); jsonObject.put("procedureID", proId); thread = new HandlerThread("reworkProcedureThread", 5); thread.start(); mHandler = new Handler(thread.getLooper()); ReworkProcedureRunnable reworkProcedureRunnable = new ReworkProcedureRunnable(jsonObject); mHandler.post(reworkProcedureRunnable); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (!overdueFlag) { recordBug.setEnabled(true); } if (listReWorkProcedure != null) { listReWorkProcedure.clear(); if (adapterReWorkProcedure != null) { adapterReWorkProcedure.notifyDataSetChanged(); } } } // if ((proId == 125) || (proId == 131)) { // 三检 显示 // if (GoodsLevelTypeID != 16) { // 产品分级选择冷补的时候 给冷补类型赋值 其他清空 // adapterCheckColdRepairCategory = new ProductClassifyAdapter(list_null, getApplicationContext()); // check_cold_repair_category.setAdapter(adapterCheckColdRepairCategory); // } // // } } @Override public void onNothingSelected(AdapterView arg0) { } }); // 养水点击事件 check_nourishing_water.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView arg0, View arg1, int arg2, long arg3) { // 在养水页面的时候 养水的点击事件才会生效 classifyInfo = (ProductClassifyInfo) arg0.getItemAtPosition(arg2); String DefectFlagName = classifyInfo.getDefectFlagName();// 所选产品分级类型 if (title.getText().toString().indexOf("养水") != -1) { if ("不合格".equals(DefectFlagName)) { // 点击 不合格 默认 刷到第一个item check_nourishing_water_position.setEnabled(true); adapterCheckNourishingWaterPosition = new ProductClassifyAdapter( listCheckNourishingWaterPosition, getApplicationContext()); check_nourishing_water_position.setAdapter(adapterCheckNourishingWaterPosition); check_nourishing_water_position.setPrompt("请选择"); } else { check_nourishing_water_position.setEnabled(false); adapterCheckNourishingWaterPosition = new ProductClassifyAdapter(list_null, getApplicationContext()); check_nourishing_water_position.setAdapter(adapterCheckNourishingWaterPosition); check_nourishing_water_position.setPrompt("请选择"); } } } @Override public void onNothingSelected(AdapterView arg0) { } }); // 修磨事件 check_grinding_test.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView arg0, View arg1, int arg2, long arg3) { // 在养水页面的时候 养水的点击事件才会生效 classifyInfo = (ProductClassifyInfo) arg0.getItemAtPosition(arg2); String DefectFlagName = classifyInfo.getDefectFlagName();// 所选产品分级类型 } @Override public void onNothingSelected(AdapterView arg0) { } }); // 试水 点击事件 check_water_test.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView arg0, View arg1, int arg2, long arg3) { classifyInfo = (ProductClassifyInfo) arg0.getItemAtPosition(arg2); String DefectFlagName = classifyInfo.getDefectFlagName();// 所选产品分级类型 //在试水页面的时候 试水的点击事件才会生效 if (title.getText().toString().indexOf("试水") != -1) { if ("不合格".equals(DefectFlagName)) { check_water_test_position.setEnabled(true); adapterCheckWaterTestPosition = new ProductClassifyAdapter(listCheckWaterTestPosition, CheckCollectModifyActivity.this); check_water_test_position.setAdapter(adapterCheckWaterTestPosition); check_nourishing_water_position.setPrompt("请选择"); } else { check_water_test_position.setEnabled(false); adapterCheckWaterTestPosition = new ProductClassifyAdapter(list_null, CheckCollectModifyActivity.this); check_water_test_position.setAdapter(adapterCheckWaterTestPosition); check_nourishing_water_position.setPrompt("请选择"); } } } @Override public void onNothingSelected(AdapterView arg0) { } }); // 冷补类别 点击事件 check_cold_repair_category.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView arg0, View arg1, int arg2, long arg3) { classifyInfo = (ProductClassifyInfo) arg0.getItemAtPosition(arg2); String DefectFlagName = classifyInfo.getDefectFlagName();// 所选产品分级类型 ProductClassifyInfo check_cold_repair_categoryInfo = (ProductClassifyInfo) check_cold_repair_category .getSelectedItem(); // --外观: 冷补返工为冷补确认 --功能: 冷补返工为冷补交接 int position = 0; if (listReWorkProcedure != null && check_cold_repair_categoryInfo != null) { for (int i = 0; i < listReWorkProcedure.size(); i++) { if ("外观".equals(DefectFlagName)) { if (listReWorkProcedure.get(i).getReworkProcedureName().contains("冷补确认")) { position = i; break; } } if ("功能".equals(DefectFlagName)) { if (listReWorkProcedure.get(i).getReworkProcedureName().contains("冷补交接")) { position = i; break; } } } gotoSpin.setSelection(position); } } @Override public void onNothingSelected(AdapterView arg0) { } }); } /** * 数据 * * @return */ public ArrayList getPopList() { ArrayList popList = new ArrayList(); popList.add("asdasdsad1"); popList.add("asdasdsad2"); popList.add("asdasdsad3"); popList.add("asdasdsad4"); popList.add("asdasdsad5"); popList.add("asdasdsad6"); return popList; } // 调用数据源 养水数据接口 和 试水数据接口 和 补裂位置数据源 private class LoadRunnable implements Runnable { public LoadRunnable() { } @Override public void run() { try { { // 代码块 给 下线标识 赋值(写死 1:是 0:否) ProductClassifyInfo classifyInfo; listCheckOfflineIdentificatio = new ArrayList();// 试水不合格位置数据源 classifyInfo = new ProductClassifyInfo(); classifyInfo.setDefectFlagType(""); classifyInfo.setDefectFlagName("否"); classifyInfo.setDefectFlagId(0); listCheckOfflineIdentificatio.add(classifyInfo); classifyInfo = new ProductClassifyInfo(); classifyInfo.setDefectFlagType(""); classifyInfo.setDefectFlagName("是"); classifyInfo.setDefectFlagId(1); listCheckOfflineIdentificatio.add(classifyInfo); if (proId == 125) { // 三检 显示 adapterCheckOfflineIdentificatio = new ProductClassifyAdapter(listCheckOfflineIdentificatio, getApplicationContext()); check_offline_identificatio.setAdapter(adapterCheckOfflineIdentificatio); } } { // 代码块 给 冷补类别赋值 ProductClassifyInfo classifyInfo; listCheckColdRepairCategory = new ArrayList();// classifyInfo = new ProductClassifyInfo(); classifyInfo.setDefectFlagType(""); classifyInfo.setDefectFlagName("外观"); classifyInfo.setDefectFlagId(0); listCheckColdRepairCategory.add(classifyInfo); classifyInfo = new ProductClassifyInfo(); classifyInfo.setDefectFlagType(""); classifyInfo.setDefectFlagName("功能"); classifyInfo.setDefectFlagId(1); listCheckColdRepairCategory.add(classifyInfo); } { // 代码块 给修磨赋值 ProductClassifyInfo classifyInfo; listCheckGrinding = new ArrayList();// classifyInfo = new ProductClassifyInfo(); classifyInfo.setDefectFlagType(""); classifyInfo.setDefectFlagName("合格"); classifyInfo.setDefectFlagId(1); listCheckGrinding.add(classifyInfo); classifyInfo = new ProductClassifyInfo(); classifyInfo.setDefectFlagType(""); classifyInfo.setDefectFlagName("不合格"); classifyInfo.setDefectFlagId(0); listCheckGrinding.add(classifyInfo); adapterCheckGrinding = new ProductClassifyAdapter(listCheckGrinding, getApplicationContext()); check_grinding_test.setAdapter(adapterCheckGrinding); } // 先把数据源new 出来 client = null; client = new WebClient(); JSONObject js = new JSONObject(); js.put("accountCode", accountCode); js.put("userCode", checkCollectModify_userCode); js.put("userPassword", password); js.put("sessionKey", sessionkey); js.put("dicType", "TPC014"); // 养水不合格 String result = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/GetDataDictionaryByType", js.toString(), "application/json"); JSONObject j2 = new JSONObject(result); JSONObject j3 = j2.optJSONObject("d"); int status3 = j3.optInt("Status"); String message3 = j3.optString("Message"); String json = j3.getString("Result"); if (status3 == 0) { Message message = new Message(); Bundle b = new Bundle(); b.putString("result", json); message.what = 8; message.setData(b); handler.sendMessage(message); } else { ProcessDialogUtils.closeProgressDilog(); if (mHandler != null) { mHandler.removeCallbacksAndMessages(null); mHandler.getLooper().quit(); } CommonUtil.showAlertDialog(status3, message3, CheckCollectModifyActivity.this); } client = null; client = new WebClient(); JSONObject js1 = new JSONObject(); js1.put("accountCode", accountCode); js1.put("userCode", checkCollectModify_userCode); js1.put("userPassword", password); js1.put("sessionKey", sessionkey); js1.put("dicType", "TPC015");// 试水不合格 String result2 = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/GetDataDictionaryByType", js1.toString(), "application/json"); JSONObject j4 = new JSONObject(result2); JSONObject j5 = j4.optJSONObject("d"); int status5 = j5.optInt("Status"); String message5 = j5.optString("Message"); String json5 = j5.getString("Result"); if (status5 == 0) { Message message1 = new Message(); Bundle b = new Bundle(); b.putString("result", json5); message1.what = 9; message1.setData(b); handler.sendMessage(message1); } else { ProcessDialogUtils.closeProgressDilog(); if (mHandler != null) { mHandler.removeCallbacksAndMessages(null); mHandler.getLooper().quit(); } CommonUtil.showAlertDialog(status5, message5, CheckCollectModifyActivity.this); } if (title.getText().toString().indexOf("补裂") != -1) { // 页面为补裂 才可以调用 补裂位置数据源接口 client = null; client = new WebClient(); JSONObject js17 = new JSONObject(); js17.put("accountCode", accountCode); js17.put("userCode", checkCollectModify_userCode); js17.put("userPassword", password); js17.put("sessionKey", sessionkey); js17.put("dicType", "TPC017");// 补裂位置 String result17 = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/GetDataDictionaryByType", js17.toString(), "application/json"); JSONObject j17 = new JSONObject(result17); JSONObject j517 = j17.optJSONObject("d"); int status17 = j517.optInt("Status"); String message17 = j517.optString("Message"); String json17 = j517.getString("Result"); if (status17 == 0) { Message message117 = new Message(); Bundle b = new Bundle(); b.putString("result", json17); message117.what = 11; message117.setData(b); handler.sendMessage(message117); } else { ProcessDialogUtils.closeProgressDilog(); if (mHandler != null) { mHandler.removeCallbacksAndMessages(null); mHandler.getLooper().quit(); } CommonUtil.showAlertDialog(status17, message17, CheckCollectModifyActivity.this); } } } catch (Exception e) { e.printStackTrace(); Message m = new Message(); Bundle b = new Bundle(); b.putString("message", "网络连接异常"); m.setData(b); m.what = 0; exceptionHandler.sendMessage(m); } } }; Runnable BarcodeUpperCase = new Runnable() { @Override public void run() { // 小写转大写 barcode.setText(barcodeUpper.toUpperCase()); // 设置EditText光标位置 barcode.setSelection(barcodeUpper.length()); } }; private static class SaveValidHandler extends Handler { private final WeakReference mActivity; public SaveValidHandler(CheckCollectModifyActivity activity) { mActivity = new WeakReference(activity); } @Override public void handleMessage(Message msg) { final CheckCollectModifyActivity activity = (CheckCollectModifyActivity) mActivity.get(); switch (msg.what) { case 0: ProcessDialogUtils.closeProgressDilog(); Bundle b3 = msg.getData(); String msg3 = b3.getString("message"); CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); Toast.makeText(activity.getApplicationContext(), msg3, Toast.LENGTH_SHORT).show(); activity.save.setEnabled(true); break; case 3: ProcessDialogUtils.closeProgressDilog(); Bundle b = msg.getData(); String message = b.getString("message"); CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); // CommonUtil.showRepeatDialog(message,CheckCollectModifyActivity.this); Toast.makeText(activity.getApplicationContext(), message, Toast.LENGTH_SHORT).show(); activity.loctxt.setFocusable(true); activity.loctxt.requestFocus(); break; } } }; private class SaveRunnable implements Runnable { Object obj; int GoodsLevelTypeID; int GoodsLevelID; public SaveRunnable(Object obj, int GoodsLevelTypeID, int GoodsLevelID) { this.obj = obj; this.GoodsLevelTypeID = GoodsLevelTypeID; this.GoodsLevelID = GoodsLevelID; } @Override public void run() { synchronized (obj) { try { ProductClassifyInfo saveClassifyInfo = (ProductClassifyInfo) classifySpin.getSelectedItem(); if (saveClassifyInfo.getGoodsLevelTypeID() == 6) {// 重烧 不管界面 怎么选 写死 返回工序 HashMap params = new LinkedHashMap(); params.put("barcode", productNumber.getText().toString().trim().replaceAll("\\n", "")); String resultGOODS = mClient.requestGetBySyn( "http://" + ServerAddress_ip + ":9100" + "/main/login/api/UpdateReworkProduce.ashx", params); // JSONObject jGOODS = new JSONObject(resultGOODS); // String msgGOODSresult = jGOODS.optString("rows"); // JSONArray jarrayGOODS = new JSONArray(msgGOODSresult); // JSONObject jobjGOODS = jarrayGOODS.optJSONObject(0); // GOODSMODELforCheck = jobjGOODS.optString("GOODSTYPECODE"); // String GOODSTYPECODE = jobjGOODS.optString("GOODSTYPECODE").substring(0, 6); // if ("001001".equals(GOODSTYPECODE)) {// 大件 // reworkProcedureInfo.setReworkProcedureID("138"); // reworkProcedureInfo.setReworkProcedureName("重烧接收"); // } else if ("001002".equals(GOODSTYPECODE)) { // 小件 // reworkProcedureInfo.setReworkProcedureID("57"); // reworkProcedureInfo.setReworkProcedureName("4-5重烧交接"); // } } JSONObject jsonObject = new JSONObject(); if (productBugList != null && productBugList.size() > 0) { defectflag = 2; } jsonObject.put("accountCode", accountCode); jsonObject.put("userCode", checkCollectModify_userCode); jsonObject.put("userPassword", password); jsonObject.put("sessionKey", sessionkey); jsonObject.put("procedureID", proId); JSONArray productionDataEntitys = new JSONArray(); JSONObject productionData = new JSONObject(); productionData.put("CheckFlag", checkFlag); productionData.put("Barcode", productionInfo.getBarCode()); productionData.put("UserID", userID); productionData.put("UserCode", worknouserCode); productionData.put("OPTimeStampPDA", timestamp); productionData.put("UserName", workNoName); productionData.put("GoodsLevelTypeID", GoodsLevelTypeID); productionData.put("IsPDA", 1); productionData.put("Remarks", remarks); productionData.put("GoodsLevelID", GoodsLevelID); productionData.put("DefectFlag", defectflag); productionData.put("DataKey", repeatFlag); if (operationFlag.equals("modify")) { productionData.put("PDACheckTime", productionInfo.getCheckTime()); productionData.put("ProductionDataID", productionDataId); productionData.put("OrgGoodsLevelTypeID", productionInfo.getGoodsLevelTypeId()); } if (operationFlag.equals("add")) { if (dryRepairFlag) { productionData.put("ProductionDataID", productionDataId); } } if (productBugList != null && productBugList.size() > 0) { if (reworkProcedureInfo != null) { productionData.put("ReworkProcedureID", Double.parseDouble(reworkProcedureInfo.getReworkProcedureID())); productionData.put("ReworkProcedureName", reworkProcedureInfo.getReworkProcedureName()); } JSONArray productionDefects = new JSONArray(); for (int j = 0; j < productBugList.size(); j++) { ProductDefectInfo productDefectInfo = productBugList.get(j); JSONObject jsonObject2 = new JSONObject(); jsonObject2.put("IsPDA", "1"); jsonObject2.put("PDACheckTime", productDefectInfo.getCreateTime()); jsonObject2.put("DefectID", productDefectInfo.getDefectNo().getDefectId()); jsonObject2.put("DefectCode", productDefectInfo.getDefectNo().getDefectCode()); jsonObject2.put("DefectName", productDefectInfo.getDefectNo().getDefectName()); if (productDefectInfo.getDefectLocation() != null) { jsonObject2.put("DefectPositionID", productDefectInfo.getDefectLocation().getDefectPositionId()); jsonObject2.put("DefectPositionCode", productDefectInfo.getDefectLocation().getDefectPositionCode()); jsonObject2.put("DefectPositionName", productDefectInfo.getDefectLocation().getDefectPositionName()); } boolean IsSpecialDefectFlag = productDefectInfo.isSpecialDefectFlag(); if (IsSpecialDefectFlag) { jsonObject2.put("SpecialDefect", 1); } else { jsonObject2.put("SpecialDefect", 0); } if (productDefectInfo.getResponsibilityProcedure() != null) { if (productDefectInfo.getResponsibilityProcedure().getDutyProcedureId() > 0.0) { jsonObject2.put("DefectProcedureID", productDefectInfo.getResponsibilityProcedure().getDutyProcedureId()); jsonObject2.put("DefectProcedureCode", productDefectInfo.getResponsibilityProcedure().getDutyProcedureCode()); jsonObject2.put("DefectProcedureName", productDefectInfo.getResponsibilityProcedure().getDutyProcedureName()); } if (productDefectInfo.getResponsibilityProcedure().getDutyProcedureId() == 0.0) { if (productDefectInfo.getWorkno() != null) { jsonObject2.put("DefectUserID", productDefectInfo.getWorkno().getUserId()); jsonObject2.put("DefectUserCode", productDefectInfo.getWorkno().getUserCode()); jsonObject2.put("DefectUserName", productDefectInfo.getWorkno().getUserName()); } } else { if (productDefectInfo.getWorkno() != null) { jsonObject2.put("DefectProductionDataID", productDefectInfo.getWorkno().getProductionDataId()); jsonObject2.put("DefectUserID", productDefectInfo.getWorkno().getUserId()); jsonObject2.put("DefectUserCode", productDefectInfo.getWorkno().getUserCode()); jsonObject2.put("DefectUserName", productDefectInfo.getWorkno().getUserName()); } } } if (productDefectInfo.getResponsibilityProcedure() == null) { if (productDefectInfo.getWorkno() != null) { jsonObject2.put("DefectUserID", productDefectInfo.getWorkno().getUserId()); jsonObject2.put("DefectUserCode", productDefectInfo.getWorkno().getUserCode()); jsonObject2.put("DefectUserName", productDefectInfo.getWorkno().getUserName()); } } if (productDefectInfo.getWorkType() != null) { jsonObject2.put("DefectJobs", productDefectInfo.getWorkType().getJobsID()); } if (productDefectInfo.getDefectFines() != null && productDefectInfo.getDefectFines().getDefectFinesId() > 0.0) { jsonObject2.put("DefectFine", productDefectInfo.getDefectFines().getDefectFinesId()); } if (productDefectInfo.getDefectDeduction() != null) { jsonObject2.put("DefectDeductionNum", productDefectInfo.getDefectDeduction().getDefectDeductionNum()); } if (productDefectInfo.getMissingDefectWorkNo() != null && productDefectInfo.getMissingDefectWorkNo().getUserId() > 0.0) { jsonObject2.put("MissedUserID", productDefectInfo.getMissingDefectWorkNo().getUserId()); jsonObject2.put("MissedUserCode", productDefectInfo.getMissingDefectWorkNo().getUserCode()); jsonObject2.put("MissedUserName", productDefectInfo.getMissingDefectWorkNo().getUserName()); } JSONArray DefectResponsibles = new JSONArray(); List dutyPersonList = productBugList.get(j).getDutyPersonList(); if (dutyPersonList != null && dutyPersonList.size() > 0) { for (int k = 0; k < dutyPersonList.size(); k++) { JSONObject dutyPerson = new JSONObject(); dutyPerson.put("StaffID", dutyPersonList.get(k).getStaffId()); dutyPerson.put("UserID", dutyPersonList.get(k).getUserId()); dutyPerson.put("UserCode", dutyPersonList.get(k).getUserCode()); dutyPerson.put("UJobsID", dutyPersonList.get(k).getJobsId()); dutyPerson.put("StaffStatus", dutyPersonList.get(k).getStaffStatus()); dutyPerson.put("SJobsID", dutyPersonList.get(k).getsJobsId()); DefectResponsibles.put(dutyPerson); } jsonObject2.put("DefectResponsibles", DefectResponsibles); } JSONArray missingDefectDutyPersonArray = new JSONArray(); List missingDefectDutyPersonList = productBugList.get(j) .getMissingDefectDutyPersonList(); if (missingDefectDutyPersonList != null && missingDefectDutyPersonList.size() > 0) { for (int m = 0; m < missingDefectDutyPersonList.size(); m++) { JSONObject missingdefectdutyPerson = new JSONObject(); missingdefectdutyPerson.put("StaffID", missingDefectDutyPersonList.get(m).getStaffId()); missingdefectdutyPerson.put("UserID", missingDefectDutyPersonList.get(m).getUserId()); missingdefectdutyPerson.put("UserCode", missingDefectDutyPersonList.get(m).getUserCode()); missingdefectdutyPerson.put("UJobsID", missingDefectDutyPersonList.get(m).getJobsId()); missingdefectdutyPerson.put("SJobsID", missingDefectDutyPersonList.get(m).getsJobsId()); missingdefectdutyPerson.put("StaffStatus", missingDefectDutyPersonList.get(m).getStaffStatus()); missingDefectDutyPersonArray.put(missingdefectdutyPerson); } jsonObject2.put("DefectMissedResponsibles", missingDefectDutyPersonArray); } JSONArray DefectImages = new JSONArray(); List imgPathList = productBugList.get(j).getDefectImgPath(); if (imgPathList != null && imgPathList.size() > 0) { for (int m = 0; m < imgPathList.size(); m++) { String imagePath = imgPathList.get(m).getLocalPath(); File file = new File(imagePath); if (file.exists() && file.length() > 0) { File f = ViewUtil.compressImage(imagePath); long size = f.length(); if (size > 0) { WebClient client = new WebClient(); String json = client.uploadStream(imagePath, "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/SaveImg", CheckCollectModifyActivity.this); if (json != null) { JSONObject jo = new JSONObject(json); JSONObject js = (JSONObject) jo.opt("d"); int status = js.optInt("Status"); String message = js.optString("Message"); if (status == 0) { String imgpath = js.optString("Result"); if (imgpath != null) { JSONObject Path = new JSONObject(); Path.put("ImagePath", imgpath); DefectImages.put(m, Path); } } else { Message msg = new Message(); msg.what = 0; Bundle b1 = new Bundle(); b1.putString("message", message); msg.setData(b1); saveValidHandler.sendMessage(msg); return; } } else { Message m3 = new Message(); m3.what = 0; Bundle b = new Bundle(); b.putString("message", "附件上传失败"); m3.setData(b); saveValidHandler.sendMessage(m3); return; } } } } if (DefectImages != null && DefectImages.length() > 0) { jsonObject2.put("DefectImages", DefectImages); } } productionDefects.put(jsonObject2); } productionData.put("ProductionDefects", productionDefects); } ProductClassifyInfo check_leakInfo = (ProductClassifyInfo) check_leak.getSelectedItem(); ProductClassifyInfo check_nourishing_waterInfo = (ProductClassifyInfo) check_nourishing_water .getSelectedItem(); ProductClassifyInfo check_nourishing_water_positionInfo = (ProductClassifyInfo) check_nourishing_water_position .getSelectedItem(); ProductClassifyInfo check_water_testInfo = (ProductClassifyInfo) check_water_test.getSelectedItem(); ProductClassifyInfo check_water_test_positionInfo = (ProductClassifyInfo) check_water_test_position .getSelectedItem(); ProductClassifyInfo check_grinding_info = (ProductClassifyInfo) check_grinding_test .getSelectedItem(); ProductClassifyInfo check_offline_identificatioInfo = (ProductClassifyInfo) check_offline_identificatio .getSelectedItem(); ProductClassifyInfo check_cold_repair_categoryInfo = (ProductClassifyInfo) check_cold_repair_category .getSelectedItem(); productionData.put("LENGBUTYPE", check_cold_repair_categoryInfo == null ? "" : check_cold_repair_categoryInfo.getDefectFlagName());// 冷补类别 productionData.put("LeakFlag1", check_leakInfo.getDefectFlagId());// 漏气 productionData.put("LeakFlag4", check_nourishing_waterInfo.getDefectFlagId());// 养水 productionData.put("LeakFlag4Position", check_nourishing_water_positionInfo != null ? check_nourishing_water_positionInfo.getDefectFlagName() : "");// 养水 // 不合格位置 productionData.put("LeakFlag5", check_water_testInfo.getDefectFlagId());// 试水 productionData.put("LeakFlag5Position", check_water_test_positionInfo != null ? check_water_test_positionInfo.getDefectFlagName() : "");// 试水不合格位置 productionData.put("LeakFlag7", check_grinding_info != null ? check_grinding_info.getDefectFlagId() : "");// 修磨 productionData.put("LeakFlag6Position", mCheckRepairCrackPositionDate);// 补裂位置 传参 productionData.put("OfflineFlag", check_offline_identificatioInfo != null ? check_offline_identificatioInfo.getDefectFlagId() : "");// 下线标识 productionDataEntitys.put(productionData); jsonObject.put("productionDataEntitys", productionDataEntitys); WebClient client = new WebClient(); String result = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.SAVE_CHECK_INFO, jsonObject.toString(), "application/json"); Bundle b = new Bundle(); b.putString("result", result); Message m = new Message(); m.setData(b); m.what = 4; handler.sendMessage(m); } catch (JSONException e) { e.printStackTrace(); Message m3 = new Message(); m3.what = 0; Bundle b = new Bundle(); b.putString("message", "json数据异常"); m3.setData(b); saveValidHandler.sendMessage(m3); } catch (Exception e) { e.printStackTrace(); Message m3 = new Message(); m3.what = 0; Bundle b = new Bundle(); b.putString("message", "网络连接异常"); m3.setData(b); saveValidHandler.sendMessage(m3); } } } }; @Override protected void onDestroy() { super.onDestroy(); Mout_ReworkProcedureId = ""; } private Runnable bugLocationRunnable = new Runnable() { @Override public void run() { try { client = null; client = new WebClient(); JSONObject js = new JSONObject(); js.put("accountCode", accountCode); js.put("userCode", checkCollectModify_userCode); js.put("userPassword", password); js.put("sessionKey", sessionkey); js.put("goodsID", productionInfo.getGoodsId()); js.put("positionCode", defectLocation); String result = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/GetDefectPositionByGoodsIDAndPositionCode", js.toString(), "application/json"); Message m = new Message(); m.what = 7; Bundle b = new Bundle(); b.putString("buglocResult", result); m.setData(b); handler.sendMessage(m); } catch (Exception e) { e.printStackTrace(); Message m3 = new Message(); m3.what = 3; Bundle b = new Bundle(); b.putString("message", "网络连接异常"); m3.setData(b); saveValidHandler.sendMessage(m3); return; } } }; private class UserRunnable implements Runnable { JSONObject jsonObject; public UserRunnable(JSONObject jsonObject) { this.jsonObject = jsonObject; } @Override public void run() { Message message = new Message(); client = new WebClient(); try { Bundle b = new Bundle(); String result; result = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.PRODUCER_NO_VALID, jsonObject.toString(), "application/json"); b.putString("result", result); message.what = 0; message.setData(b); handler.sendMessage(message); } catch (JSONException e) { e.printStackTrace(); Message m = new Message(); m.what = 1; Bundle b = new Bundle(); b.putString("message", "json数据异常"); m.setData(b); exceptionHandler.sendMessage(m); return; } catch (Exception e) { e.printStackTrace(); Message m = new Message(); m.what = 1; Bundle b = new Bundle(); b.putString("message", "网络连接异常"); m.setData(b); exceptionHandler.sendMessage(m); return; } } } private Runnable bugnoRunnable = new Runnable() { @Override public void run() { try { client = null; client = new WebClient(); JSONObject js = new JSONObject(); js.put("accountCode", accountCode); js.put("userCode", checkCollectModify_userCode); js.put("userPassword", password); js.put("sessionKey", sessionkey); js.put("procedureID", proId); js.put("defectCode", defectno); String result = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/GetDefectByProcedureIDAndDefectCode", js.toString(), "application/json"); Message m = new Message(); m.what = 6; Bundle b = new Bundle(); b.putString("bugnoResult", result); m.setData(b); handler.sendMessage(m); } catch (Exception e) { Message m = new Message(); m.what = 4; Bundle b = new Bundle(); b.putString("message", "网络连接异常"); m.setData(b); exceptionHandler.sendMessage(m); return; } } }; Runnable UpperCase = new Runnable() { @Override public void run() { // 小写转大写 worknoEdt.setText(user.toUpperCase()); // 设置EditText光标位置 worknoEdt.setSelection(user.length()); } }; private class ReworkProcedureRunnable implements Runnable { JSONObject jsonObject; public ReworkProcedureRunnable(JSONObject jsonObject) { this.jsonObject = jsonObject; } @Override public void run() { Message message = new Message(); client = new WebClient(); String result; Bundle b = new Bundle(); try { result = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.GET_ENDPRODUCT_REWORK_PROCEDURE, jsonObject.toString(), "application/json"); b.putString("result", result); message.what = 3; message.setData(b); handler.sendMessage(message); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); Message m = new Message(); m.what = 5; Bundle b5 = new Bundle(); b5.putString("message", "json数据异常"); m.setData(b5); exceptionHandler.sendMessage(m); } catch (Exception e) { Message m = new Message(); m.what = 5; Bundle b5 = new Bundle(); b5.putString("message", "网络连接异常"); m.setData(b5); exceptionHandler.sendMessage(m); e.printStackTrace(); return; } } } private static class ExceptionHandler extends Handler { private final WeakReference mActivity; public ExceptionHandler(CheckCollectModifyActivity activity) { mActivity = new WeakReference(activity); } @Override public void handleMessage(Message msg) { super.handleMessage(msg); CheckCollectModifyActivity activity = (CheckCollectModifyActivity) mActivity.get(); switch (msg.what) { case 0: ProcessDialogUtils.closeProgressDilog(); Bundle b = msg.getData(); int status = b.getInt("status"); String errorMsg = b.getString("errorMsg"); CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); CommonUtil.showBarCodeAlertDialog(status, errorMsg, activity, activity.barcode, activity.bugnotxt, activity.loctxt); if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } break; case 1: ProcessDialogUtils.closeProgressDilog(); Bundle b2 = msg.getData(); String message = b2.getString("message"); CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity); CustomToast.showToast(activity.getApplicationContext(), message, 2000); if (activity.collectType == 1) { activity.worknoEdt.setEnabled(true); activity.worknoEdt.setText(""); activity.worknoEdt.setFocusable(true); activity.worknoEdt.setFocusableInTouchMode(true); activity.worknoEdt.requestFocus(); activity.worknoEdt.findFocus(); activity.worknoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); activity.barcode.setEnabled(true); activity.barcode.setFocusable(true); activity.barcode.setFocusableInTouchMode(true); activity.barcode.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); CommonUtil.BarcodeMaxLength(activity.barcode, 50); activity.bugnotxt.setEnabled(true); activity.bugnotxt.setText(""); activity.bugnotxt.setFocusable(true); activity.bugnotxt.setFocusableInTouchMode(true); activity.bugnotxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); activity.loctxt.setEnabled(true); activity.loctxt.setText(""); activity.loctxt.setFocusable(true); activity.loctxt.setFocusableInTouchMode(true); activity.loctxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); } if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } break; case 2: ProcessDialogUtils.closeProgressDilog(); if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } Bundle b3 = msg.getData(); String message3 = b3.getString("message"); CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); // CommonUtil.showRepeatDialog(message3,CheckCollectModifyActivity.this); // Toast.makeText(getApplicationContext(), message3, // Toast.LENGTH_SHORT).show(); CustomToast.showToast(activity.getApplicationContext(), message3, 2000); activity.barcode.setEnabled(true); activity.barcode.setText(""); activity.barcode.setFocusable(true); activity.barcode.setFocusableInTouchMode(true); activity.barcode.requestFocus(); activity.barcode.findFocus(); activity.barcode.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); CommonUtil.BarcodeMaxLength(activity.barcode, 50); activity.bugnotxt.setEnabled(true); activity.bugnotxt.setText(""); activity.bugnotxt.setFocusable(true); activity.bugnotxt.setFocusableInTouchMode(true); activity.bugnotxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); activity.loctxt.setEnabled(true); activity.loctxt.setText(""); activity.loctxt.setFocusable(true); activity.loctxt.setFocusableInTouchMode(true); activity.loctxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); break; case 3: ProcessDialogUtils.closeProgressDilog(); Bundle b7 = msg.getData(); int status7 = b7.getInt("status"); String message7 = b7.getString("message"); activity.save.setVisibility(View.GONE); activity.recordBug.setEnabled(false); CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); CommonUtil.showBarCodeAlertDialog(status7, message7, activity, activity.barcode, activity.bugnotxt, activity.loctxt); if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } break; case 4: if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } ProcessDialogUtils.closeProgressDilog(); Bundle b4 = msg.getData(); String message4 = b4.getString("message"); CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); CustomToast.showToast(activity.getApplicationContext(), message4, 2000); activity.bugnotxt.setFocusable(true); activity.bugnotxt.requestFocus(); break; case 5: if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } ProcessDialogUtils.closeProgressDilog(); Bundle b5 = msg.getData(); String message5 = b5.getString("message"); CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); // CommonUtil.showRepeatDialog(message5,CheckCollectModifyActivity.this); // Toast.makeText(getApplicationContext(), message5, // Toast.LENGTH_SHORT).show(); CustomToast.showToast(activity.getApplicationContext(), message5, 2000); break; case 6: if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } ProcessDialogUtils.closeProgressDilog(); Bundle b1 = msg.getData(); String errmsg = b1.getString("errmsg"); String missingFlag = b1.getString("flag"); Intent intent = new Intent(); Bundle b6 = new Bundle(); b6.putString("msg", errmsg); b6.putString("missingFlag", missingFlag); intent.putExtras(b6); intent.setClass(activity, MissingScanActivity.class); activity.startActivityForResult(intent, 101); break; case 7: ProcessDialogUtils.closeProgressDilog(); if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } Bundle b8 = msg.getData(); String message8 = b8.getString("message"); CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); CommonUtil.showRepeatDialog(message8, activity); activity.barcode.setEnabled(true); activity.barcode.setText(""); activity.barcode.setFocusable(true); activity.barcode.setFocusableInTouchMode(true); activity.barcode.requestFocus(); activity.barcode.findFocus(); activity.barcode.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); CommonUtil.BarcodeMaxLength(activity.barcode, 50); activity.bugnotxt.setEnabled(true); activity.bugnotxt.setText(""); activity.bugnotxt.setFocusable(true); activity.bugnotxt.setFocusableInTouchMode(true); activity.bugnotxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); activity.loctxt.setEnabled(true); activity.loctxt.setText(""); activity.loctxt.setFocusable(true); activity.loctxt.setFocusableInTouchMode(true); activity.loctxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); break; } } }; private static class ResultHandler extends Handler { private final WeakReference mActivity; public ResultHandler(CheckCollectModifyActivity activity) { mActivity = new WeakReference(activity); } @Override public void handleMessage(Message msg) { final CheckCollectModifyActivity activity = (CheckCollectModifyActivity) mActivity.get(); switch (msg.what) { case 0: String rest = msg.getData().getString("result"); ProcessDialogUtils.closeProgressDilog(); try { JSONObject jsonObject = new JSONObject(rest); jsonObject = jsonObject.getJSONObject("d"); int status = jsonObject.getInt("Status"); String message = jsonObject.getString("Message"); String json = jsonObject.getString("Result"); if (status == 0) { jsonObject = new JSONObject(json); String outErrMsg = jsonObject.optString("ErrMsg"); if (outErrMsg.equals("null")) { activity.userID = jsonObject.getString("UserID"); activity.worknouserCode = jsonObject.getString("UserCode"); activity.workNoName = jsonObject.getString("UserName"); activity.worknovalid = true; activity.barcode.setEnabled(true); activity.barcode.setFocusable(true); activity.barcode.setFocusableInTouchMode(true); activity.barcode.requestFocus(); activity.barcode.findFocus(); activity.barcode.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); CommonUtil.BarcodeMaxLength(activity.barcode, 50); if (activity.collectType == 1) { activity.bugnotxt.setEnabled(true); activity.bugnotxt.setFocusable(true); activity.bugnotxt.setFocusableInTouchMode(true); activity.bugnotxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); activity.loctxt.setEnabled(true); activity.loctxt.setFocusable(true); activity.loctxt.setFocusableInTouchMode(true); activity.loctxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); activity.memoEdt.setEnabled(true); activity.memoEdt.setFocusable(true); activity.memoEdt.setFocusableInTouchMode(true); activity.memoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); } if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } // ///////////////////////////////////////////////------yws-------------- // InputMethodManager im =(InputMethodManager) // tvUserCode.getContext() // .getSystemService(Context.INPUT_METHOD_SERVICE); // im.hideSoftInputFromWindow(CheckCollectActivity.this.getCurrentFocus().getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS); } else { if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } activity.worknovalid = false; CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); CommonUtil.showWorkNoAlertDialog(status, outErrMsg, activity, activity.worknoEdt, activity.barcode, activity.bugnotxt, activity.loctxt, activity.collectType); return; } } else { if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } activity.worknovalid = false; CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); CommonUtil.showWorkNoAlertDialog(status, message, activity, activity.worknoEdt, activity.barcode, activity.bugnotxt, activity.loctxt, activity.collectType); } } catch (Exception e) { e.printStackTrace(); } break; case 1: ProcessDialogUtils.closeProgressDilog(); activity.save.setText("保存(" + activity.productBugList.size() + ")"); // 调完baicode赋值 9527 if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } Bundle b1 = msg.getData(); activity.listProductClassify = (List) b1.getSerializable("productclassifylist"); activity.productNumber.setText(activity.productionInfo.getBarCode()); activity.productCode.setText(activity.productionInfo.getGoodsCode()); activity.productName.setText(activity.productionInfo.getGoodsName()); String trademarkName = activity.productionInfo.getTrademarkName(); if (trademarkName.equals("null")) { activity.trademarkNameTxt.setText(""); } else { activity.trademarkNameTxt.setText(trademarkName); } // productionInfo.setOut_LeakFlag1Name(jsonObject31.optString("out_LeakFlag1Name"));//漏气 // productionInfo.setOut_LeakFlag4Name(jsonObject31.optString("out_LeakFlag4Name"));//养水 // productionInfo.setOut_LeakFlag5Name(jsonObject31.optString("out_LeakFlag5Name"));//试水 // productionInfo.setLeakFlag4TablePOSITION(jsonObjectleakFlag4Table.optString("POSITION"));//养水 不合格位置 // productionInfo.setLeakFlag5TablePOSITION(jsonObjectleakFlag5Table.optString("POSITION"));//试水 不合格位置 activity.refineEdt.setText(activity.refireName); activity.repairEdt.setText(activity.specialRepairFlagName); activity.tvLeak.setText(activity.productionInfo.getLeak()); // 回显 漏气 养水 试水 if ("不合格".equals(activity.productionInfo.getOut_LeakFlag1Name())) { // 漏气 activity.check_leak.setSelection(1, true); } if ("不合格".equals(activity.productionInfo.getOut_LeakFlag4Name())) {// 养水 activity.check_nourishing_water.setSelection(1, true); } if ("不合格".equals(activity.productionInfo.getOut_LeakFlag5Name())) {// 试水 activity.check_water_test.setSelection(1, true); } if ("不合格".equals(activity.productionInfo.getOut_LeakFlag7Name())) {// 修磨 activity.check_grinding_test.setSelection(1, true); } if (!"".equals(activity.mCheckRepairCrackPositionDate)) { // 如果有补裂位置 那就赋值 activity.check_repair_crack_position.setText(activity.mCheckRepairCrackPositionDate); } // 回显 养水不合格位置 试水不合格位置 todo // if ((activity.title.getText().toString().indexOf("养水") != -1) // || (activity.title.getText().toString().indexOf("试水") != -1)) { for (int i = 0; i < activity.listCheckNourishingWaterPosition.size(); i++) { if (activity.listCheckNourishingWaterPosition.get(i).getDefectFlagName() .equals(activity.productionInfo.getLeakFlag4TablePOSITION())) { activity.adapterCheckNourishingWaterPosition = new ProductClassifyAdapter( activity.listCheckNourishingWaterPosition, activity.getApplicationContext()); activity.check_nourishing_water_position .setAdapter(activity.adapterCheckNourishingWaterPosition); activity.check_nourishing_water_position.setPrompt("请选择"); activity.check_nourishing_water_position.setSelection(i, true); } } if (activity.title.getText().toString().indexOf("试水") != -1) { // for (int i = 0; i < activity.listCheckWaterTestPosition.size(); i++) { // if (activity.listCheckWaterTestPosition.get(i).getDefectFlagName() // .equals(activity.productionInfo.getLeakFlag5TablePOSITION())) { // activity.adapterCheckWaterTestPosition = new ProductClassifyAdapter(activity.listCheckWaterTestPosition, // activity.getApplicationContext()); // // activity.check_water_test_position.setAdapter(activity.adapterCheckWaterTestPosition); // activity.check_nourishing_water_position.setPrompt("请选择"); // activity.check_water_test_position.setSelection(i, true); // } // } // 根本就不用带出试水的回显数据 // } } // 回显下标划线 if (activity.proId == 125) { for (int i = 0; i < activity.listCheckOfflineIdentificatio.size(); i++) { if ((activity.listCheckOfflineIdentificatio.get(i).getDefectFlagId() + "") .equals(activity.productionInfo.getOfflineFlag())) { activity.adapterCheckOfflineIdentificatio = new ProductClassifyAdapter( activity.listCheckOfflineIdentificatio, activity.getApplicationContext()); activity.check_offline_identificatio.setAdapter(activity.adapterCheckOfflineIdentificatio); activity.check_offline_identificatio.setPrompt("请选择"); activity.check_offline_identificatio.setSelection(i, true); } } } activity.tvInternalLeak.setText(activity.productionInfo.getInternalLeak()); activity.tvPassBall.setText(activity.productionInfo.getPassBall()); activity.barcode.setEnabled(true); activity.barcode.setText(""); activity.barcode.setFocusable(true); activity.barcode.setFocusableInTouchMode(true); activity.barcode.requestFocus(); activity.barcode.findFocus(); activity.barcode.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); CommonUtil.BarcodeMaxLength(activity.barcode, 50); activity.bugnotxt.setEnabled(true); activity.bugnotxt.setText(""); activity.bugnotxt.setFocusable(true); activity.bugnotxt.setFocusableInTouchMode(true); activity.bugnotxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); activity.loctxt.setEnabled(true); activity.loctxt.setText(""); activity.loctxt.setFocusable(true); activity.loctxt.setFocusableInTouchMode(true); activity.loctxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); activity.adapterProductClassify = new ProductClassifyAdapter(activity.listProductClassify, activity); activity.classifySpin.setAdapter(activity.adapterProductClassify); activity.classifySpin.setPrompt("请选择产品分级"); if (activity.productionInfo != null) { // int position = CommonUtil.getProductClassifyIndex(activity.productionInfo.getGoodsLevelTypeId(), // activity.listProductClassify); // // activity.classifySpin.setSelection(position); // 回显 产品分级 for (int i = 0; i < activity.listProductClassify.size(); i++) { String a = activity.listProductClassify.get(i).getDefectFlagId() + ""; String b = activity.productionInfo.getOut_Grade() + ""; if (activity.listProductClassify.get(i).getDefectFlagId() == activity.productionInfo .getOut_Grade()) { activity.classifySpin.setSelection(i, true); } } if (!(activity.proId == 123 || activity.proId == 157)) { // 养水 3#修模 activity.classifySpin.setEnabled(true); } } // endTime=System.currentTimeMillis(); // long time=endTime-startTime; // Toast.makeText(getApplicationContext(),time+"",Toast.LENGTH_LONG).show(); // System.out.println(time+"time"); if (activity.operationFlag.equals("modify")) { activity.productBugList = (List) b1.getSerializable("productbuglist"); activity.mAdapter = new SwipeAdapter(activity, activity.mListView.getRightViewWidth(), activity.ServerAddress_ip, activity.ServerAddress_duankou, activity.accountCode, activity.checkCollectModify_userCode, activity.password, activity.sessionkey, activity.productBugList); activity.mListView.setAdapter(activity.mAdapter); activity.save.setText("保存(" + activity.productBugList.size() + ")"); activity.memoEdt.setText(activity.productionInfo.getRemarks()); activity.mAdapter.setOnRightItemClickListener(new SwipeAdapter.onRightItemClickListener() { @Override public void onRightItemClick(View v, int position) { if (!activity.overdueFlag) { ProductDefectInfo defectInfo = activity.productBugList.get(position); if (defectInfo.getDeleteFlag().equals("server")) { activity.deleteFlag = true; } activity.mListView.deleteItem(activity.mListView.getChildAt(position)); activity.productBugList.remove(position); activity.save.setText("保存(" + activity.productBugList.size() + ")"); activity.mAdapter.notifyDataSetChanged(); } } }); } break; case 2:// 产品分级 try { Bundle b = msg.getData(); String rest1 = b.getString("result"); JSONObject jsonObject1 = new JSONObject(rest1); JSONObject jsonobject2 = jsonObject1.getJSONObject("d"); int status1 = jsonobject2.getInt("Status"); String message1 = jsonobject2.getString("Message"); if (status1 == 0) { String json1 = jsonobject2.getString("Result"); JSONArray jsonArray = new JSONArray(json1); activity.listProductClassify = new ArrayList(); for (int i = 0; i < jsonArray.length(); i++) { activity.classifyInfo = new ProductClassifyInfo(); JSONObject jsonObject2 = (JSONObject) jsonArray.get(i); activity.classifyInfo.setGoodsLevelTypeID((int) jsonObject2.getDouble("GOODSLEVELTYPEID")); activity.classifyInfo.setDefectFlagName(jsonObject2.getString("DEFECTFLAGNAME")); activity.classifyInfo.setDefectFlagId((int) jsonObject2.getInt("DEFECTFLAGID")); activity.listProductClassify.add(i, activity.classifyInfo); } activity.adapterProductClassify = new ProductClassifyAdapter(activity.listProductClassify, activity); // 第四步:将适配器添加到下拉列表上 activity.classifySpin.setAdapter(activity.adapterProductClassify); activity.classifySpin.setPrompt("请选择产品分级"); if (activity.productionInfo != null) { int position = CommonUtil.getProductClassifyIndex( activity.productionInfo.getGoodsLevelTypeId(), activity.listProductClassify); activity.classifySpin.setSelection(position); } if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } } else { if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); CommonUtil.showAlertDialog(status1, message1, activity); } } catch (Exception e) { e.printStackTrace(); } break; case 3:// 跳转工序 try { Bundle b = msg.getData(); String rest2 = b.getString("result"); JSONObject jsonObject1 = new JSONObject(rest2); JSONObject jsonObject2 = jsonObject1.getJSONObject("d"); int status2 = jsonObject2.getInt("Status"); String message2 = jsonObject2.getString("Message"); if (status2 == 0) { String json1 = jsonObject2.getString("Result"); JSONArray jsonArray = new JSONArray(json1); int goodsLevelTypeID = activity.classifyInfo.getGoodsLevelTypeID();// 所选产品分级类型 activity.listReWorkProcedure = new ArrayList(); for (int i = 0; i < jsonArray.length(); i++) { ReworkProcedureInfo reworkProcedureInfo1 = new ReworkProcedureInfo(); JSONObject object = (JSONObject) jsonArray.get(i); reworkProcedureInfo1 .setReworkProcedureID(String.valueOf(object.getDouble("REWORKPROCEDUREID"))); reworkProcedureInfo1.setReworkProcedureName(object.getString("REWORKPROCEDURENAME")); if (goodsLevelTypeID == 6 && object.getString("REWORKPROCEDURENAME").contains("重烧")) { // 重烧 activity.listReWorkProcedure.add(reworkProcedureInfo1); } if (goodsLevelTypeID == 16 && object.getString("REWORKPROCEDURENAME").contains("冷补")) { // 冷补 activity.listReWorkProcedure.add(reworkProcedureInfo1); } } activity.adapterReWorkProcedure = new ReworkProcedureSpinnerAdapter(activity, activity.listReWorkProcedure); activity.gotoSpin.setPrompt("请选择跳转工序"); activity.gotoSpin.setAdapter(activity.adapterReWorkProcedure); int position = 0; // if (activity.operationFlag.equals("modify")) { if (goodsLevelTypeID == 6) { // 重烧进 大件默认重烧接收 小件 默认重烧交接 根据GOODSMODELforCheck 包不包含CT 判断 if (activity.listReWorkProcedure != null && activity.listReWorkProcedure.size() > 0) { String GOODSMODELforCheck = activity.GOODSMODELforCheck.substring(0, 2); for (int i = 0; i < activity.listReWorkProcedure.size(); i++) { // if ("CT".equals(GOODSMODELforCheck)) { if ("1".equals(refireflag)) { if (activity.listReWorkProcedure.get(i).getReworkProcedureName() .contains("重烧接收")) { position = i; break; } } else { if (activity.listReWorkProcedure.get(i).getReworkProcedureName() .contains("重烧交接")) { position = i; break; } } } } } else if (goodsLevelTypeID == 16) { // 冷补 // if (activity.productionInfo.getReworkProcedureId() > 0) { // if (activity.listReWorkProcedure != null && activity.listReWorkProcedure.size() > 0) { // for (int i = 0; i < activity.listReWorkProcedure.size(); i++) { // if ((int) Double.parseDouble(activity.listReWorkProcedure.get(i) // .getReworkProcedureID()) == activity.productionInfo // .getReworkProcedureId()) { // position = i; // break; // } // } // } // } else { if (activity.listReWorkProcedure != null && activity.listReWorkProcedure.size() > 0) { if (!"136".equals(Mout_ReworkProcedureId)) { for (int i = 0; i < activity.listReWorkProcedure.size(); i++) { if ((int) Double.parseDouble( activity.listReWorkProcedure.get(i).getReworkProcedureID()) == 153) { position = i; break; } } } } // } } else { if (activity.productionInfo.getReworkProcedureId() > 0) { if (activity.listReWorkProcedure != null && activity.listReWorkProcedure.size() > 0) { for (int i = 0; i < activity.listReWorkProcedure.size(); i++) { if ((int) Double.parseDouble(activity.listReWorkProcedure.get(i) .getReworkProcedureID()) == activity.productionInfo .getReworkProcedureId()) { position = i; break; } } } } } // } // 2023年10月16日 // if ((activity.proId == 125) || (activity.proId == 131)) { // 三检 显示 // if (goodsLevelTypeID == 16) { // 产品分级选择冷补的时候 给冷补类型赋值 其他清空 // activity.adapterCheckColdRepairCategory = new ProductClassifyAdapter( // activity.listCheckColdRepairCategory, activity.getApplicationContext()); // activity.check_cold_repair_category.setAdapter(activity.adapterCheckColdRepairCategory); // } // // } // 只有一个选项的时候,默认选中 activity.gotoSpin.setSelection(position); if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } if (goodsLevelTypeID != 6) { // 不是重烧 就可以放开 activity.gotoSpin.setEnabled(true); } } else { if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); CommonUtil.showAlertDialog(status2, message2, activity); } } catch (Exception e) { e.printStackTrace(); } break; case 4: String rest2 = msg.getData().getString("result"); ProcessDialogUtils.closeProgressDilog(); repeatFlag = System.currentTimeMillis() + "-" + checkCollectModify_userCode; try { JSONObject jsonObject4 = new JSONObject(rest2); JSONObject jsonObject5 = jsonObject4.getJSONObject("d"); int status2 = jsonObject5.getInt("Status"); String message2 = jsonObject5.getString("Message"); activity.dryRepairFlag = false; if (activity.collectType == 1) { activity.worknovalid = false; } if (status2 == 0) { //2023年10月16日 // if ((activity.proId == 125) || (activity.proId == 131)) { // 三检 显示 // // 保存完事 清除冷补类别 // activity.adapterCheckColdRepairCategory = new ProductClassifyAdapter(activity.list_null, // activity.getApplicationContext()); // activity.check_cold_repair_category.setAdapter(activity.adapterCheckColdRepairCategory); // activity.check_cold_repair_category.setEnabled(false); // // } // 保存成功把 漏气 养水 养水不合格位置 试水 试水不合格位置 还原 activity.check_leak.setSelection(0, true); activity.check_nourishing_water.setSelection(0, true); activity.check_water_test.setSelection(0, true); activity.adapterCheckNourishingWaterPosition = new ProductClassifyAdapter(activity.list_null, activity.getApplicationContext()); activity.check_nourishing_water_position .setAdapter(activity.adapterCheckNourishingWaterPosition); activity.check_nourishing_water_position.setPrompt("请选择"); activity.adapterCheckWaterTestPosition = new ProductClassifyAdapter(activity.list_null, activity.getApplicationContext()); activity.check_water_test_position.setAdapter(activity.adapterCheckWaterTestPosition); activity.check_nourishing_water_position.setPrompt("请选择"); activity.adapterCheckOfflineIdentificatio = new ProductClassifyAdapter( activity.listCheckOfflineIdentificatio, activity.getApplicationContext()); activity.check_offline_identificatio.setAdapter(activity.adapterCheckOfflineIdentificatio); String Result = jsonObject5.getString("Result"); if (Result.equals("")) { // barcode.setText(""); activity.save.setEnabled(true); activity.deleteFlag = false; activity.originalGoodsLevelTypeId = 0; // barcode.setFocusable(true); // barcode.requestFocus(); activity.productNumber.setText(""); activity.productCode.setText(""); activity.productName.setText(""); activity.defectflag = 1; activity.refineEdt.setText(""); activity.repairEdt.setText(""); activity.tvLeak.setText(""); activity.tvInternalLeak.setText(""); activity.tvPassBall.setText(""); activity.bugnotxt.setText(""); activity.bugnametxt.setText(""); activity.loctxt.setText(""); activity.tvLocName.setText(""); activity.check_repair_crack_position.setText(""); activity.mCheckRepairCrackPositionDate = "";// 清除补裂位置 activity.memoEdt.setText(""); activity.trademarkNameTxt.setText(""); activity.mCheckRepairCrackPositionDate = ""; if (activity.collectType == 1) { // 采集类型:1-集中 2-单点 activity.worknovalid = false; activity.worknoEdt.setEnabled(true); activity.worknoEdt.setText(""); activity.worknoEdt.setFocusable(true); activity.worknoEdt.setFocusableInTouchMode(true); activity.worknoEdt.requestFocus(); activity.worknoEdt.findFocus(); activity.worknoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); } else { activity.barcode.setEnabled(true); activity.barcode.setText(""); activity.barcode.setFocusable(true); activity.barcode.setFocusableInTouchMode(true); activity.barcode.requestFocus(); activity.barcode.findFocus(); activity.barcode.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); CommonUtil.BarcodeMaxLength(activity.barcode, 50); } activity.footerdivider.setVisibility(View.GONE); // saveEnd=System.currentTimeMillis(); // long saveTime= saveEnd-saveStart; // Toast.makeText(getApplicationContext(),saveTime+"save",Toast.LENGTH_LONG).show(); // System.out.println(saveTime+"save"); CommonUtil.playSound(activity.getApplicationContext()); // Toast.makeText(getApplicationContext(), "上传成功", // Toast.LENGTH_SHORT).show(); CustomToast.showToast(activity.getApplicationContext(), "上传成功", 2000); if (activity.classifySpin.getSelectedItem() != null) { activity.listProductClassify.removeAll(activity.listProductClassify); if (activity.adapterProductClassify != null) { activity.adapterProductClassify.notifyDataSetChanged(); } activity.classifySpin.setEnabled(false); } if (activity.gotoSpin.getSelectedItem() != null) { activity.listReWorkProcedure.clear(); if (activity.adapterReWorkProcedure != null) { activity.adapterReWorkProcedure.notifyDataSetChanged(); } activity.gotoSpin.setEnabled(false); } // // if (mAdapter != null // && mAdapter.bitmapCache.size() > 0) { // ViewUtil.FreeBitmap(mAdapter.bitmapCache); // } if (activity.productBugList != null && activity.productBugList.size() > 0) { for (ProductDefectInfo p1 : activity.productBugList) { List imagepathlist = p1.getDefectImgPath(); for (ImagePath path : imagepathlist) { String localpath = path.getLocalPath(); File f = new File(localpath); if (f.exists()) { f.delete(); } } } activity.productBugList.removeAll(activity.productBugList); activity.mAdapter.notifyDataSetChanged(); activity.save.setText("保存(" + activity.productBugList.size() + ")"); } if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } } else { // Toast.makeText(CheckCollectActivity.this, // Result, Toast.LENGTH_LONG).show(); if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } activity.save.setEnabled(true); CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); CommonUtil.showSaveAlertDialog(status2, Result, activity, activity.worknoEdt, activity.barcode, activity.collectType); return; } } else if (status2 == 2) { if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } return; } else { if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } activity.save.setEnabled(true); CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); CommonUtil.showSaveAlertDialog(status2, message2, activity, activity.worknoEdt, activity.barcode, activity.collectType); return; } } catch (JSONException e) { if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } e.printStackTrace(); } break; case 6: Bundle b = msg.getData(); try { String json = b.getString("bugnoResult"); ProcessDialogUtils.closeProgressDilog(); JSONObject j = new JSONObject(json); JSONObject jo = (JSONObject) j.opt("d"); int status = jo.optInt("Status"); String message = jo.optString("Message"); // InputMethodManager im1 = (InputMethodManager) bugnotxt // .getContext().getSystemService( // Context.INPUT_METHOD_SERVICE); // im1.hideSoftInputFromWindow(CheckCollectModifyActivity.this // .getCurrentFocus().getWindowToken(), // InputMethodManager.HIDE_NOT_ALWAYS); if (status == 0) { String result = jo.optString("Result"); JSONObject jre = new JSONObject(result); String errmsg = jre.optString("ErrMsg"); if (errmsg.equals("")) { activity.defectnovalid = true; // Toast.makeText(ProductBugActivity.this, "缺陷号正确", // Toast.LENGTH_LONG).show(); activity.defectNo = new DefectNo(); activity.defectId = jre.optInt("DefectID"); activity.defectNo.setDefectId(activity.defectId); activity.defectName = jre.optString("DefectName"); activity.defectNo.setDefectName(activity.defectName); activity.defectNo.setDefectCode(activity.defectno); activity.bugnametxt.setText(activity.defectName); activity.loctxt.setFocusable(true); activity.loctxt.requestFocus(); if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } } else { activity.bugnotxt.setText(""); activity.bugnametxt.setText(""); activity.bugnotxt.setFocusable(true); activity.bugnotxt.requestFocus(); CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); CommonUtil.showAlertDialog(status, errmsg, activity); return; } } else { CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); CommonUtil.showAlertDialog(status, message, activity); return; } } catch (Exception e) { } break; case 7: Bundle b2 = msg.getData(); String json = b2.getString("buglocResult"); try { ProcessDialogUtils.closeProgressDilog(); JSONObject j = new JSONObject(json); JSONObject jo = (JSONObject) j.opt("d"); int status = jo.optInt("Status"); String message = jo.optString("Message"); activity.hintKb(activity.loctxt); if (status == 0) { String result = jo.optString("Result"); JSONObject jre = new JSONObject(result); String errmsg = jre.optString("ErrMsg"); if (errmsg.equals("")) { activity.defectlocationvalid = true; int defectPositionId = jre.optInt("DefectPositionID"); String defectPositionName = jre.optString("DefectPositionName"); activity.dl = new DefectLocation(); activity.dl.setDefectPositionId(defectPositionId); activity.dl.setDefectPositionCode(activity.defectLocation); activity.dl.setDefectPositionName(defectPositionName); if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } activity.tvLocName.setText(defectPositionName); } else { activity.defectlocationvalid = false; activity.loctxt.setText(""); activity.loctxt.setFocusable(true); activity.loctxt.requestFocus(); activity.tvLocName.setText(""); CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); CommonUtil.showAlertDialog(status, errmsg, activity); if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } return; } } else { if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext()); CommonUtil.showAlertDialog(status, message, activity); } } catch (JSONException e) { if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } e.printStackTrace(); } break; case 8: String rest8 = msg.getData().getString("result"); ProcessDialogUtils.closeProgressDilog(); try { activity.listCheckLeak = new ArrayList();// 漏气数据源 activity.listCheckNourishingWater = new ArrayList();// 养水数据源 activity.listCheckNourishingWaterPosition = new ArrayList();// 养水不合格位置数据源 activity.listCheckWaterTest = new ArrayList();// 试水数据源 JSONArray jarray = new JSONArray(rest8); // 养水的时候 才给养水不合格位置 赋值 if (jarray != null && jarray.length() > 0) { for (int i = 0; i < jarray.length(); i++) { activity.classifyInfo = new ProductClassifyInfo(); JSONObject jsonObject2 = (JSONObject) jarray.get(i); activity.classifyInfo.setDefectFlagType(jsonObject2.optString("DICTIONARYTYPE")); activity.classifyInfo.setDefectFlagName(jsonObject2.optString("DICTIONARYVALUE")); activity.classifyInfo.setDefectFlagId((int) jsonObject2.getInt("DICTIONARYID")); activity.listCheckNourishingWaterPosition.add(i, activity.classifyInfo); } } // 给漏气 养水 试水 赋上 合格和不合格 数据源 activity.classifyInfo = new ProductClassifyInfo(); activity.classifyInfo.setDefectFlagType(""); activity.classifyInfo.setDefectFlagName("合格"); activity.classifyInfo.setDefectFlagId(1); activity.listCheckLeak.add(0, activity.classifyInfo); activity.listCheckNourishingWater.add(0, activity.classifyInfo); activity.listCheckWaterTest.add(0, activity.classifyInfo); activity.classifyInfo = new ProductClassifyInfo(); activity.classifyInfo.setDefectFlagType(""); activity.classifyInfo.setDefectFlagName("不合格"); activity.classifyInfo.setDefectFlagId(0); activity.listCheckLeak.add(1, activity.classifyInfo); activity.listCheckNourishingWater.add(1, activity.classifyInfo); activity.listCheckWaterTest.add(1, activity.classifyInfo); activity.adapterCheckLeak = new ProductClassifyAdapter(activity.listCheckLeak, activity.getApplicationContext()); activity.adapterCheckNourishingWater = new ProductClassifyAdapter(activity.listCheckNourishingWater, activity.getApplicationContext()); activity.adapterCheckWaterTest = new ProductClassifyAdapter(activity.listCheckWaterTest, activity.getApplicationContext()); // 第四步:将适配器添加到下拉列表上 activity.check_leak.setAdapter(activity.adapterCheckLeak); activity.check_nourishing_water.setAdapter(activity.adapterCheckNourishingWater); activity.check_water_test.setAdapter(activity.adapterCheckWaterTest); activity.check_leak.setPrompt("请选择是否合格"); activity.check_nourishing_water.setPrompt("请选择是否合格"); activity.check_water_test.setPrompt("请选择是否合格"); } catch (JSONException e) { if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } e.printStackTrace(); } break; case 9: String rest9 = msg.getData().getString("result"); ProcessDialogUtils.closeProgressDilog(); try { activity.listCheckWaterTestPosition = new ArrayList();// 试水不合格位置数据源 JSONArray jarray = new JSONArray(rest9); // 试水的时候 才给试水不合格位置 赋值 if (jarray != null && jarray.length() > 0) { for (int i = 0; i < jarray.length(); i++) { activity.classifyInfo = new ProductClassifyInfo(); JSONObject jsonObject2 = (JSONObject) jarray.get(i); activity.classifyInfo.setDefectFlagType(jsonObject2.optString("DICTIONARYTYPE")); activity.classifyInfo.setDefectFlagName(jsonObject2.optString("DICTIONARYVALUE")); activity.classifyInfo.setDefectFlagId((int) jsonObject2.getInt("DICTIONARYID")); activity.listCheckWaterTestPosition.add(i, activity.classifyInfo); } } } catch (JSONException e) { if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } e.printStackTrace(); } break; case 10: Bundle bproductbuglist = msg.getData(); activity.productBugList = (List) bproductbuglist.getSerializable("productbuglist"); activity.mAdapter = new SwipeAdapter(activity, activity.mListView.getRightViewWidth(), activity.ServerAddress_ip, activity.ServerAddress_duankou, activity.accountCode, activity.checkCollectModify_userCode, activity.password, activity.sessionkey, activity.productBugList); activity.mListView.setAdapter(activity.mAdapter); activity.mAdapter.setOnRightItemClickListener(new SwipeAdapter.onRightItemClickListener() { @Override public void onRightItemClick(View v, int position) { if (!activity.overdueFlag) { ProductDefectInfo defectInfo = activity.productBugList.get(position); if (defectInfo.getDeleteFlag().equals("server")) { activity.deleteFlag = true; } activity.mListView.deleteItem(activity.mListView.getChildAt(position)); activity.productBugList.remove(position); activity.save.setText("保存(" + activity.productBugList.size() + ")"); activity.mAdapter.notifyDataSetChanged(); } } }); break; case 11: // 补裂位置 String rest11 = msg.getData().getString("result"); ProcessDialogUtils.closeProgressDilog(); try { activity.listCheckRepairCrackPosition = new ArrayList();// 试水不合格位置数据源 JSONArray jarray = new JSONArray(rest11); // 试水的时候 才给试水不合格位置 赋值 if (jarray != null && jarray.length() > 0) { activity.mList = new ArrayList(); for (int i = 0; i < jarray.length(); i++) { JSONObject jsonObject2 = (JSONObject) jarray.get(i); activity.mList.add(jsonObject2.optString("DICTIONARYVALUE")); } activity.mPopup = new PopupWindowCheckChoose(activity, activity.mList); // * 设置ListView的选择模式 // * 多选:AbsListView.CHOICE_MODE_MULTIPLE // * 单选:AbsListView.CHOICE_MODE_SINGLE activity.mPopup.setTagTxt("补裂位置")// 设置顶部title的内容 .setButtomTxt("确认")// 设置底部按钮内容 .setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);// 单选 activity.mPopup.setOnEventLisenter(new onEventLisenter() { @Override public void onItemClick(ArrayList positionList) { // mTvContent.setText(mList.get(positionList.get(0))); StringBuffer resultBuffer = new StringBuffer(); for (int i = 0; i < positionList.size(); i++) { String result = positionList.get(i); if (i == 0) { resultBuffer.append(result); } else { resultBuffer.append("," + result); } } String testResult = resultBuffer.toString(); // Toast.makeText(activity.getApplicationContext(),testResult, Toast.LENGTH_SHORT).show(); activity.mCheckRepairCrackPositionDate = testResult; activity.check_repair_crack_position.setText(activity.mCheckRepairCrackPositionDate); activity.mPopup.dismiss(); } }); } } catch (JSONException e) { if (activity.mHandler != null) { activity.mHandler.removeCallbacksAndMessages(null); activity.mHandler.getLooper().quit(); } e.printStackTrace(); } break; } } }; private void hintKb(View v) { InputMethodManager im = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); im.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } private class BarcodeRunnable implements Runnable { String barcode; Object obj; public BarcodeRunnable(String barcode, Object obj) { this.barcode = barcode; this.obj = obj; } @Override public void run() { synchronized (obj) { try { {// 2023/2/23 为了获取大件小件标识 JSONObject jsonObject28 = new JSONObject(); jsonObject28.put("accountCode", accountCode); jsonObject28.put("userCode", checkCollectModify_userCode); jsonObject28.put("userPassword", password); jsonObject28.put("sessionKey", sessionkey); jsonObject28.put("procedureID", proId);// 工序ID,菜单页面传过来的 jsonObject28.put("barcode", barcode);// 产品条码 WebClient client = new WebClient(); String result28 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.BAR_CODE_VALID, jsonObject28.toString(), "application/json"); JSONObject jsonObject29 = new JSONObject(result28); JSONObject jsonObject30 = jsonObject29.getJSONObject("d"); int status30 = jsonObject30.getInt("Status"); String message30 = jsonObject30.getString("Message"); String result30 = jsonObject30.getString("Result"); JSONArray jsonArray321 = new JSONArray(result30); JSONObject jsonObject331 = (JSONObject) jsonArray321.get(0); String outErrMsg331 = jsonObject331.getString("out_errMsg"); String missFlag = jsonObject331.optString("out_missFlag"); Mout_ReworkProcedureId = jsonObject331.optString("out_ReworkProcedureId"); if (status30 == 0) { if (!TextUtils.isEmpty(outErrMsg331)) {// 2023/3/10 if (missFlag.equals("0")) { Message m = new Message(); Bundle b = new Bundle(); b.putInt("status", status30); b.putString("errorMsg", outErrMsg331); m.what = 0; m.setData(b); exceptionHandler.sendMessage(m); return; } else { Message m1 = new Message(); Bundle b1 = new Bundle(); b1.putString("errmsg", outErrMsg331); b1.putString("flag", missFlag); m1.what = 4; m1.setData(b1); exceptionHandler.sendMessage(m1); return; } } else { JSONArray jsonArray30 = new JSONArray(result30); JSONObject jsonObject31 = (JSONObject) jsonArray30.get(0); RECYCLINGFLAG = jsonObject31.optString("recyclingFlag"); GOODSMODELforCheck = jsonObject31.optString("GOODSMODELforCheck"); refireflag=jsonObject31.optString("refireflag"); if ((GOODSMODELforCheck == null) || (GOODSMODELforCheck == "") || (GOODSMODELforCheck == "null")) { HashMap params = new LinkedHashMap(); params.put("barcode", barcode); String resultGOODS = mClient.requestGetBySyn("http://" + ServerAddress_ip + ":9100" + "/main/login/api/GetCheckBarcode.ashx", params); if (!("".equals(resultGOODS) || resultGOODS == null)) { // 2023年4月17日 防止因为没返回值 // 包json异常 JSONObject jGOODS = new JSONObject(resultGOODS); String msgGOODSresult = jGOODS.optString("rows"); JSONArray jarrayGOODS = new JSONArray(msgGOODSresult); JSONObject jobjGOODS = jarrayGOODS.optJSONObject(0); GOODSMODELforCheck = jobjGOODS.optString("GOODSTYPECODE"); String GOODSTYPECODE = jobjGOODS.optString("GOODSTYPECODE").substring(0, 6); if ("001001".equals(GOODSTYPECODE)) {// todo 又被秦琪坑了 2023/3/8 GOODSMODELforCheck = "CT"; } else if ("001002".equals(GOODSTYPECODE)) { GOODSMODELforCheck = "11"; } } } // } } } client = null; client = new WebClient(); JSONObject js = new JSONObject(); js.put("accountCode", accountCode); js.put("userCode", checkCollectModify_userCode); js.put("userPassword", password); js.put("sessionKey", sessionkey); js.put("barcode", barcode); String result = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/GetCompleteProcedureIDPDA", js.toString(), "application/json"); JSONObject j = new JSONObject(result); JSONObject jo = (JSONObject) j.opt("d"); int status = jo.optInt("Status"); String msg = jo.optString("Message"); if (status == 0) { String msgresult = jo.optString("Result"); JSONArray jarray1 = new JSONArray(msgresult); if (jarray1 != null && jarray1.length() > 0) { JSONObject jobj1 = jarray1.optJSONObject(0); int procId = (int) jobj1.optDouble("COMPLETEPROCEDUREID"); int rest = (int) jobj1.optDouble("PROCEDUREID"); timestamp = jobj1.optString("CONVERTOPTIMESTAMP"); if (rest == -1) { Message m = new Message(); m.what = 2; Bundle b = new Bundle(); b.putString("message", "条码" + barcode + "不可编辑"); m.setData(b); exceptionHandler.sendMessage(m); return; } else if (rest > 0) { client = null; client = new WebClient(); JSONObject js1 = new JSONObject(); js1.put("accountCode", accountCode); js1.put("userCode", checkCollectModify_userCode); js1.put("userPassword", password); js1.put("sessionKey", sessionkey); js1.put("BarCode", barcode); js1.put("ProcedureID", proId); String productionDataResult = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/GetProductionData", js1.toString(), "application/json"); JSONObject json = new JSONObject(productionDataResult); JSONObject jb = (JSONObject) json.opt("d"); int status1 = jb.optInt("Status"); if (status1 == 0) { String result1 = jb.optString("Result"); JSONArray ja = new JSONArray(result1); JSONObject jsonobj = (JSONObject) ja.get(0); productionDataId = (int) jsonobj.optDouble("PRODUCTIONDATAID"); } String a111 = proId + ""; String b111 = procId + ""; if (proId == procId) { if (proId == rest) { JSONObject jsonObject69 = new JSONObject(); jsonObject69.put("accountCode", accountCode); jsonObject69.put("userCode", checkCollectModify_userCode); jsonObject69.put("userPassword", password); jsonObject69.put("sessionKey", sessionkey); jsonObject69.put("barcode", barcode);// 产品条码 client = new WebClient(); String result69 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.CHECK_SCRAP_PRODUCT, jsonObject69.toString(), "application/json"); JSONObject jsonObject70 = new JSONObject(result69); JSONObject jsonObject71 = jsonObject70.getJSONObject("d"); int status70 = jsonObject71.getInt("Status"); String message70 = jsonObject71.getString("Message"); if (status70 == 0) { client = null; client = new WebClient(); JSONObject jsonhead = new JSONObject(); jsonhead.put("accountCode", accountCode); jsonhead.put("userCode", checkCollectModify_userCode); jsonhead.put("userPassword", password); jsonhead.put("sessionKey", sessionkey); jsonhead.put("productionDataID", productionDataId); String Result = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/GetProductionDataByID", jsonhead.toString(), "application/json"); JSONObject jobj = new JSONObject(Result); JSONObject jso = (JSONObject) jobj.opt("d"); int status2 = jso.optInt("Status"); String Message1 = jso.optString("Message"); if (status2 == 0) { if (productBugList != null && productBugList.size() > 0) { productBugList.removeAll(productBugList); } String res = jso.optString("Result"); JSONObject je = new JSONObject(res); JSONArray jarray = je.optJSONArray("PDAProductionData"); JSONObject jo1 = (JSONObject) jarray.get(0); int goodsId = jo1.optInt("GoodsID"); String goodsCode = (String) jo1.optString("GoodsCode"); String goodsName = (String) jo1.optString("GoodsName"); int defectFlagId = jo1.optInt("DefectFlagID"); int reworkProcedureId = jo1.optInt("ReworkProcedureID"); int userId = (int) jo1.optInt("UserID"); String userCode = jo1.optString("UserCode"); String userName1 = jo1.optString("UserName"); String trademarkName = jo1.optString("LogoName"); String leakName = jo1.optString("LeakFlag1Name"); String internalLeakName = jo1.optString("LeakFlag2Name"); String passBall = jo1.optString("LeakFlag3Name"); specialRepairFlag = String.valueOf(jo1.optInt("SpecialRepairflag")); specialRepairFlagName = jo1.optString("SpecialRepairFlagName"); refire = jo1.optInt("IsReFire"); refireName = jo1.optString("IsReFireName"); int goodsLevelTypeId = jo1.optInt("GoodsLevelTypeID"); originalGoodsLevelTypeId = jo1.optInt("GoodsLevelTypeID"); String createTime = jo1.optString("CreateTime"); createTime = CommonUtil.commonDateConverter(createTime); checkTime = jo1.optString("CheckTime"); remarks = jo1.optString("Remarks"); operationFlag = "modify"; checkFlag = "2"; if (goodsLevelTypeId == 7) { JSONObject jsonObject20 = new JSONObject(); jsonObject20.put("accountCode", accountCode); jsonObject20.put("userCode", checkCollectModify_userCode); jsonObject20.put("userPassword", password); jsonObject20.put("sessionKey", sessionkey); jsonObject20.put("barcode", barcode);// 产品条码 client = new WebClient(); String result20 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/GetSubstandardInfo", jsonObject20.toString(), "application/json"); JSONObject jo20 = new JSONObject(result20); JSONObject jo21 = (JSONObject) jo20.opt("d"); int status21 = (Integer) jo21.optInt("Status"); String message21 = jo21.optString("Message"); if (status21 == 0) { String result21 = jo21.optString("Result"); if (result21.equals("0")) { Message m = new Message(); m.what = 2; Bundle b = new Bundle(); b.putString("message", "次品不能修改"); m.setData(b); exceptionHandler.sendMessage(m); return; } } else { Message m = new Message(); m.what = 0; Bundle b = new Bundle(); b.putInt("status", status21); b.putString("errorMsg", message21); m.setData(b); exceptionHandler.sendMessage(m); return; } } productionInfo = new ProductionInfo(); productionInfo.setBarCode(barcode); productionInfo.setGoodsId(goodsId); productionInfo.setGoodsCode(goodsCode); productionInfo.setGoodsName(goodsName); productionInfo.setLeak(leakName); productionInfo.setInternalLeak(internalLeakName); productionInfo.setPassBall(passBall); productionInfo.setDefectFlagId(defectFlagId); productionInfo.setReworkProcedureId(reworkProcedureId); productionInfo.setCheckTime(checkTime); productionInfo.setRemarks(remarks); productionInfo.setUserId(userId); productionInfo.setUserCode(userCode); productionInfo.setUserName(userName1); productionInfo.setGoodsLevelTypeId(goodsLevelTypeId); productionInfo.setTrademarkName(trademarkName); JSONArray defectArray = jo1.optJSONArray("PDADefects"); if (defectArray != null && defectArray.length() > 0) { for (int i = 0; i < defectArray.length(); i++) { ProductDefectInfo pdf = new ProductDefectInfo(); JSONObject job = (JSONObject) defectArray.get(i); int defectId = job.optInt("DefectID"); String defectCode = job.optString("DefectCode"); String defectName = job.optString("DefectName"); DefectNo dn = new DefectNo(); dn.setDefectId(defectId); dn.setDefectCode(defectCode); dn.setDefectName(defectName); pdf.setDefectNo(dn); pdf.setDeleteFlag("server"); int defectPositionId = (int) job.optInt("DefectPositionID"); String defectPositionCode = job.optString("DefectPositionCode"); String defectPositionName = job.optString("DefectPositionName"); DefectLocation dl = new DefectLocation(); dl.setDefectPositionId(defectPositionId); dl.setDefectPositionCode(defectPositionCode); dl.setDefectPositionName(defectPositionName); pdf.setDefectLocation(dl); int defectProcedureId = job.optInt("DefectProcedureID"); String defectProcedureCode = job .optString("DefectProcedureCode"); String defectProcedureName = job .optString("DefectProcedureName"); ResponsibilityProcedure rp = new ResponsibilityProcedure(); rp.setDutyProcedureId(defectProcedureId); rp.setDutyProcedureCode(defectProcedureCode); rp.setDutyProcedureName(defectProcedureName); pdf.setResponsibilityProcedure(rp); DefectDeduction defectDeduction = new DefectDeduction(); double defectDeductionNum = job.optDouble("DefectDeductionNum"); defectDeduction.setDefectDeductionNum( String.valueOf(defectDeductionNum)); pdf.setDefectDeduction(defectDeduction); String specialDefect = job.optString("SpecialDefect"); if (specialDefect.equals("0")) { pdf.setSpecialDefectFlag(false); } else { pdf.setSpecialDefectFlag(true); } int defectUserId = (int) job.optInt("DefectUserID"); String defectUserCode = job.optString("DefectUserCode"); String defectUserName = job.optString("DefectUserName"); int ProductionDataId = (int) job .optInt("DefectProductionDataID"); if (defectProcedureId > 0) { WorkNo wn = new WorkNo(); wn.setUserId(defectUserId); wn.setUserCode(defectUserCode); wn.setUserName(defectUserName); wn.setProductionDataId(ProductionDataId); pdf.setWorkno(wn); } else { WorkNo wn = new WorkNo(); wn.setUserId(defectUserId); wn.setUserCode(defectUserCode); wn.setUserName(defectUserName); pdf.setWorkno(wn); } int jobs = job.optInt("Jobs"); String jobsText = job.optString("JobsText"); WorkType wt = new WorkType(); wt.setJobsID(jobs); wt.setJobsName(jobsText); pdf.setWorkType(wt); int defectFineId = job.optInt("DefectFineID"); String defectFinesValue = job.optString("DefectFineValue"); DefectFines df = new DefectFines(); df.setDefectFinesId(defectFineId); df.setDefectFinesName(defectFinesValue); pdf.setDefectFines(df); JSONArray defectResponsibles = job .optJSONArray("PDADefectResponsibles"); List dutyPersonList = new ArrayList(); if (defectResponsibles != null && defectResponsibles.length() > 0) { for (int k = 0; k < defectResponsibles.length(); k++) { JSONObject jo2 = (JSONObject) defectResponsibles.get(k); int staffId = jo2.optInt("StaffID"); String staffCode = jo2.optString("StaffCode"); String staffName = jo2.optString("StaffName"); int staffStatus = jo2.optInt("StaffStatus"); int uJobsId = jo2.optInt("UJobsID"); int sJobsId = jo2.optInt("SJobsID"); DutyPerson dp = new DutyPerson(); dp.setStaffId(staffId); dp.setStaffCode(staffCode); dp.setStaffName(staffName); dp.setStaffStatus(staffStatus); dp.setJobsId(uJobsId); dp.setsJobsId(sJobsId); dp.setUserId(defectUserId); dp.setUserCode(defectUserCode); dutyPersonList.add(dp); } } pdf.setDutyPersonList(dutyPersonList); List imagePathList = new ArrayList(); JSONArray imageJsonArray = job .optJSONArray("PDADefectImageResults"); if (imageJsonArray != null && imageJsonArray.length() > 0) { for (int n = 0; n < imageJsonArray.length(); n++) { JSONObject imageJo = (JSONObject) imageJsonArray.get(n); String path = imageJo.optString("Imagepath"); ImagePath ip = new ImagePath(); ip.setServerPath(path); ip.setFlag("remote"); String pPath1 = CommonUtil.getRootFilePath(); String fileDir1 = pPath1 + Constants.DATA_CACHE_PATH; File file1 = new File(fileDir1); if (!file1.exists()) { file1.mkdir(); } String s = Md5Utils.encode(path); String imgName = s + ".jpg"; File f1 = new File(file1.getAbsolutePath(), imgName); if (!f1.exists()) { try { f1.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } ip.setLocalPath(f1.getAbsolutePath()); imagePathList.add(ip); } } String checkTime = job.optString("CheckTime"); pdf.setCreateTime(checkTime); pdf.setDefectImgPath(imagePathList); productBugList.add(pdf); } } // wangyingjie 22/12/30 因为 可能是改判的原因 加的 Start // 如果 有bug 请删除 仅是赋值 漏气 试水 养水 试水不合格位置 养水不合格位置 { JSONObject jsonObject28 = new JSONObject(); jsonObject28.put("accountCode", accountCode); jsonObject28.put("userCode", checkCollectModify_userCode); jsonObject28.put("userPassword", password); jsonObject28.put("sessionKey", sessionkey); jsonObject28.put("procedureID", proId);// 工序ID,菜单页面传过来的 jsonObject28.put("barcode", barcode);// 产品条码 jsonObject28.put("isNewCheck", true);// client = new WebClient(); String result28 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.BAR_CODE_VALID, jsonObject28.toString(), "application/json"); JSONObject jsonObject29 = new JSONObject(result28); JSONObject jsonObject30 = jsonObject29.getJSONObject("d"); int status30 = jsonObject30.getInt("Status"); String message30 = jsonObject30.getString("Message"); if (status30 == 0) { String result30 = jsonObject30.getString("Result"); JSONObject resultObjBarCodeTable = new JSONObject(result30); JSONArray resultArrayBarCodeTable = (JSONArray) resultObjBarCodeTable .opt("BarCodeTable");// 之前的 JSONArray resultArrayleakFlag4Table = (JSONArray) resultObjBarCodeTable .opt("leakFlag4Table");// 养水 数据 JSONArray resultArrayleakFlag5Table = (JSONArray) resultObjBarCodeTable .opt("leakFlag5Table");// 试水 数据 JSONArray resultArrayleakFlag6Table = (JSONArray) resultObjBarCodeTable .opt("leakFlag6Table");// 补裂 位置数据 传送门 JSONArray resultArrayDefectTable = (JSONArray) resultObjBarCodeTable .opt("DefectTable");// 缺陷信息 JSONObject jsonObject31 = (JSONObject) resultArrayBarCodeTable .get(0); String outErrMsg30 = jsonObject31.getString("out_errMsg"); String missFlag = jsonObject31.optString("out_missFlag"); if (!TextUtils.isEmpty(outErrMsg30)) { if (missFlag.equals("0")) { Message m = new Message(); Bundle b = new Bundle(); b.putInt("status", status30); b.putString("errorMsg", outErrMsg30); m.what = 0; m.setData(b); exceptionHandler.sendMessage(m); return; } else { Message m1 = new Message(); Bundle b1 = new Bundle(); b1.putString("errmsg", outErrMsg30); b1.putString("flag", missFlag); m1.what = 4; m1.setData(b1); exceptionHandler.sendMessage(m1); return; } } else { // produceCodeIsValid = true; // if (worknovalid) { // productionInfo = new ProductionInfo(); // productionInfo.setUserId(Integer.parseInt(userID)); // productionInfo.setUserCode(worknouserCode); // productionInfo.setUserName(workNoName); // // } // out_goodsID = jsonObject31.getString("out_goodsID"); // out_goodsCode = jsonObject31.getString("out_goodsCode"); // out_goodsName = jsonObject31.getString("out_goodsName"); // out_groutingUserCode = jsonObject31.getString("out_groutingUserCode"); // productionInfo.setBarCode(barcode); // TODO 由于缺陷信息重复 所以 注释这一块 // 2023/1/3 start 增加 缺陷信息赋值 z // if (resultArrayDefectTable != null // && resultArrayDefectTable.length() > 0) { // for (int i = 0; i < resultArrayDefectTable // .length(); i++) { // ProductDefectInfo pdf = new ProductDefectInfo(); // JSONObject job = (JSONObject) resultArrayDefectTable // .get(i); // int defectId = job.optInt("DEFECTID"); // String defectCode = job.optString("DEFECTCODE"); // String defectName = job.optString("DEFECTNAME"); // DefectNo dn = new DefectNo(); // dn.setDefectId(defectId); // dn.setDefectCode(defectCode); // dn.setDefectName(defectName); // pdf.setDefectNo(dn); // pdf.setDeleteFlag("server"); // int defectPositionId = (int) job // .optInt("DEFECTPOSITIONID"); // String defectPositionCode = job // .optString("DEFECTPOSITIONCODE"); // String defectPositionName = job // .optString("DEFECTPOSITIONNAME"); // DefectLocation dl = new DefectLocation(); // dl.setDefectPositionId(defectPositionId); // dl.setDefectPositionCode(defectPositionCode); // dl.setDefectPositionName(defectPositionName); // pdf.setDefectLocation(dl); // int defectProcedureId = job // .optInt("DEFECTPROCEDUREID"); // String defectProcedureCode = job // .optString("DEFECTPROCEDURECODE"); // String defectProcedureName = job // .optString("DEFECTPROCEDURENAME"); // ResponsibilityProcedure rp = new ResponsibilityProcedure(); // rp.setDutyProcedureId(defectProcedureId); // rp.setDutyProcedureCode(defectProcedureCode); // rp.setDutyProcedureName(defectProcedureName); // pdf.setResponsibilityProcedure(rp); // // DefectDeduction defectDeduction = new DefectDeduction(); // double defectDeductionNum = job // .optDouble("DEFECTDEDUCTIONNUM"); // defectDeduction.setDefectDeductionNum( // String.valueOf(defectDeductionNum)); // pdf.setDefectDeduction(defectDeduction); // String specialDefect = job // .optString("SPECIALDEFECT"); // if (specialDefect.equals("0")) { // pdf.setSpecialDefectFlag(false); // } else { // pdf.setSpecialDefectFlag(true); // } // int defectUserId = (int) job.optInt("DEFECTUSERID"); // String defectUserCode = job // .optString("DEFECTUSERCODE"); // String defectUserName = job // .optString("DEFECTUSERNAME"); // int ProductionDataId = (int) job // .optInt("DEFECTPRODUCTIONDATAID"); // if (defectProcedureId > 0) { // WorkNo wn = new WorkNo(); // wn.setUserId(defectUserId); // wn.setUserCode(defectUserCode); // wn.setUserName(defectUserName); // wn.setProductionDataId(ProductionDataId); // pdf.setWorkno(wn); // } // // else { // WorkNo wn = new WorkNo(); // wn.setUserId(defectUserId); // wn.setUserCode(defectUserCode); // wn.setUserName(defectUserName); // pdf.setWorkno(wn); // } // // int jobs = job.optInt("JOBS"); // String jobsText = job.optString("JOBSTEXT"); // WorkType wt = new WorkType(); // wt.setJobsID(jobs); // wt.setJobsName(jobsText); // pdf.setWorkType(wt); // // int defectFineId = job.optInt("DEFECTFINEID"); // String defectFinesValue = job // .optString("DEFECTFINEVALUE"); // DefectFines df = new DefectFines(); // df.setDefectFinesId(defectFineId); // df.setDefectFinesName(defectFinesValue); // pdf.setDefectFines(df); // JSONArray defectResponsibles = job // .optJSONArray("PDADefectResponsibles"); // List dutyPersonList = new ArrayList(); // if (defectResponsibles != null // && defectResponsibles.length() > 0) { // // for (int k = 0; k < defectResponsibles // .length(); k++) { // JSONObject jo2 = (JSONObject) defectResponsibles // .get(k); // int staffId = jo2.optInt("StaffID"); // String staffCode = jo2 // .optString("StaffCode"); // String staffName = jo2 // .optString("StaffName"); // int staffStatus = jo2.optInt("StaffStatus"); // int uJobsId = jo2.optInt("UJobsID"); // int sJobsId = jo2.optInt("SJobsID"); // DutyPerson dp = new DutyPerson(); // dp.setStaffId(staffId); // dp.setStaffCode(staffCode); // dp.setStaffName(staffName); // dp.setStaffStatus(staffStatus); // dp.setJobsId(uJobsId); // dp.setsJobsId(sJobsId); // dp.setUserId(defectUserId); // dp.setUserCode(defectUserCode); // dutyPersonList.add(dp); // } // // } // pdf.setDutyPersonList(dutyPersonList); // // List imagePathList = new ArrayList(); // JSONArray imageJsonArray = job // .optJSONArray("PDADefectImageResults"); // if (imageJsonArray != null // && imageJsonArray.length() > 0) { // for (int n = 0; n < imageJsonArray // .length(); n++) { // JSONObject imageJo = (JSONObject) imageJsonArray // .get(n); // String path = imageJo // .optString("Imagepath"); // ImagePath ip = new ImagePath(); // ip.setServerPath(path); // ip.setFlag("remote"); // String pPath1 = CommonUtil // .getRootFilePath(); // String fileDir1 = pPath1 // + Constants.DATA_CACHE_PATH; // File file1 = new File(fileDir1); // if (!file1.exists()) { // file1.mkdir(); // } // String s = Md5Utils.encode(path); // String imgName = s + ".jpg"; // File f1 = new File(file1.getAbsolutePath(), // imgName); // if (!f1.exists()) { // try { // f1.createNewFile(); // } catch (IOException e) { // e.printStackTrace(); // } // } // ip.setLocalPath(f1.getAbsolutePath()); // imagePathList.add(ip); // } // } // // String checkTime = job.optString("CHECKTIME"); // pdf.setCreateTime(checkTime); // pdf.setDefectImgPath(imagePathList); // productBugList.add(pdf); // // } // Message messageproductBugList = new Message(); // Bundle bproductBugList = new Bundle(); // bproductBugList.putSerializable("productbuglist", // (Serializable) productBugList); // messageproductBugList.what = 10; // messageproductBugList.setData(bproductBugList); // handler.sendMessage(messageproductBugList); // } // end z productionInfo .setOut_Grade(jsonObject31.optInt("DefectFlagID")); productionInfo.setOfflineFlag( jsonObject31.optString("offlineFlag")); // 下标划线 productionInfo.setOut_LeakFlag1Name( jsonObject31.optString("out_LeakFlag1Name"));// 漏气 productionInfo.setOut_LeakFlag4Name( jsonObject31.optString("out_LeakFlag4Name"));// 养水 productionInfo.setOut_LeakFlag5Name( jsonObject31.optString("out_LeakFlag5Name"));// 试水 productionInfo.setOut_LeakFlag7Name( jsonObject31.optString("out_LeakFlag7Name"));// 修磨 if (resultArrayleakFlag4Table != null && resultArrayleakFlag4Table.length() > 0) { JSONObject jsonObjectleakFlag4Table = (JSONObject) resultArrayleakFlag4Table .get(0); productionInfo.setLeakFlag4TablePOSITION( jsonObjectleakFlag4Table.optString("POSITION"));// 养水 // 不合格位置 } if (resultArrayleakFlag5Table != null && resultArrayleakFlag5Table.length() > 0) { JSONObject jsonObjectleakFlag5Table = (JSONObject) resultArrayleakFlag5Table .get(0); productionInfo.setLeakFlag5TablePOSITION( jsonObjectleakFlag5Table.optString("POSITION"));// 试水 // 不合格位置 } if (resultArrayleakFlag6Table != null && resultArrayleakFlag6Table.length() > 0) { JSONObject jsonObjectleakFlag6Table = (JSONObject) resultArrayleakFlag6Table .get(0); productionInfo.setLeakFlag6TablePOSITION( jsonObjectleakFlag6Table.optString("POSITION")); // 补裂位置 mCheckRepairCrackPositionDate = jsonObjectleakFlag6Table .optString("POSITION"); } // productionInfo.setGoodsId(Integer.parseInt(out_goodsID)); // productionInfo.setGoodsCode(out_goodsCode); // productionInfo.setGoodsName(out_goodsName); // specialRepairFlag = jsonObject31.optString("out_specialRepairFlag"); // specialRepairFlagName = jsonObject31 // .optString("out_specialRepairFlagName"); // refire = Integer.parseInt(jsonObject31.optString("out_isReFire")); // refireName = jsonObject31.optString("out_isReFireName"); // // productionInfo.setTrademarkName(jsonObject31.optString("out_logoName")); // // // productionInfo.setLeak(jsonObject31.optString("out_LeakFlag1Name")); // // productionInfo.setInternalLeak(jsonObject31.optString("out_LeakFlag2Name")); // // productionInfo.setPassBall(jsonObject31.optString("out_LeakFlag3Name")); } } else { Message m = new Message(); m.what = 0; Bundle b = new Bundle(); b.putInt("status", status30); b.putString("errorMsg", message30); m.setData(b); exceptionHandler.sendMessage(m); return; } // } // ----------end client = null; client = new WebClient(); JSONObject js6 = new JSONObject(); js6.put("accountCode", accountCode); js6.put("userCode", checkCollectModify_userCode); js6.put("userPassword", password); js6.put("sessionKey", sessionkey); js6.put("settingcode", "S_PM_009"); String result6 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/GetSystemSettingDataByCode", js6.toString(), "application/json"); JSONObject js10 = new JSONObject(result6); JSONObject js11 = js10.optJSONObject("d"); int status11 = js11.optInt("Status"); String message11 = js11.optString("Message"); if (status11 == 0) { String result11 = js11.optString("Result"); JSONArray jarray11 = new JSONArray(result11); if (jarray11 != null && jarray.length() > 0) { JSONObject js12 = jarray11.optJSONObject(0); String settingValueStr = js12.optString("SETTINGVALUE"); if (!TextUtils.isEmpty(settingValueStr)) { int settingValue = Integer.parseInt(settingValueStr); if (settingValue > 0) { client = null; client = new WebClient(); JSONObject js13 = new JSONObject(); js13.put("accountCode", accountCode); js13.put("userCode", checkCollectModify_userCode); js13.put("userPassword", password); js13.put("sessionKey", sessionkey); js13.put("orgTime", createTime); js13.put("days", settingValue); js13.put("settingCode", "S_PM_009"); String result13 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/BarcodeAllowCancel", js13.toString(), "application/json"); JSONObject jobj13 = new JSONObject(result13); JSONObject jobj14 = jobj13.optJSONObject("d"); int status14 = jobj14.optInt("Status"); String message14 = jobj14.optString("Message"); if (status14 != 0) { overdueFlag = true; Bundle b = new Bundle(); b.putString("message", message14); b.putInt("status", status14); Message m = new Message(); m.what = 3; m.setData(b); exceptionHandler.sendMessage(m); } } } } } else { Bundle b = new Bundle(); b.putString("message", message11); b.putInt("status", status11); Message m = new Message(); m.what = 3; m.setData(b); exceptionHandler.sendMessage(m); } String result90; WebClient client = new WebClient(); JSONObject jsonObject90 = new JSONObject(); jsonObject90.put("accountCode", accountCode); jsonObject90.put("userCode", checkCollectModify_userCode); jsonObject90.put("userPassword", password); jsonObject90.put("sessionKey", sessionkey); result90 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.GET_GOODS_GRADE, jsonObject90.toString(), "application/json"); JSONObject jsonObject91 = new JSONObject(result90); JSONObject jsonobject92 = jsonObject91.getJSONObject("d"); int status92 = jsonobject92.getInt("Status"); String message92 = jsonobject92.getString("Message"); if (status92 == 0) { String json93 = jsonobject92.getString("Result"); JSONArray jsonArray94 = new JSONArray(json93); listProductClassify = new ArrayList(); for (int i = 0; i < jsonArray94.length(); i++) { classifyInfo = new ProductClassifyInfo(); JSONObject jsonObject95 = (JSONObject) jsonArray94.get(i); classifyInfo.setGoodsLevelTypeID( (int) jsonObject95.getDouble("GOODSLEVELTYPEID")); classifyInfo.setDefectFlagName( jsonObject95.getString("DEFECTFLAGNAME")); classifyInfo.setDefectFlagId( (int) jsonObject95.getInt("DEFECTFLAGID")); listProductClassify.add(i, classifyInfo); } } else { Message m = new Message(); m.what = 0; Bundle b = new Bundle(); b.putInt("status", status92); b.putString("errorMsg", message92); m.setData(b); exceptionHandler.sendMessage(m); return; } Message m = new Message(); m.what = 1; Bundle b = new Bundle(); b.putSerializable("productbuglist", (Serializable) productBugList); b.putSerializable("productclassifylist", (Serializable) listProductClassify); m.setData(b); handler.sendMessage(m); return; } else { Message m = new Message(); m.what = 0; Bundle b = new Bundle(); b.putInt("status", status2); b.putString("errorMsg", Message1); m.setData(b); exceptionHandler.sendMessage(m); return; } } else { Message m = new Message(); m.what = 0; Bundle b = new Bundle(); b.putInt("status", status70); b.putString("errorMsg", message70); m.setData(b); exceptionHandler.sendMessage(m); return; } } else { operationFlag = "add"; dryRepairFlag = true; checkFlag = "1"; JSONObject jsonObject36 = new JSONObject(); jsonObject36.put("accountCode", accountCode); jsonObject36.put("userCode", checkCollectModify_userCode); jsonObject36.put("userPassword", password); jsonObject36.put("sessionKey", sessionkey); jsonObject36.put("procedureID", proId);// 工序ID,菜单页面传过来的 jsonObject36.put("barcode", barcode);// 产品条码 client = new WebClient(); String result36 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.DRY_REPAIR_BARCODE_CHECK, jsonObject36.toString(), "application/json"); JSONObject jsonObject37 = new JSONObject(result36); JSONObject jsonObject38 = jsonObject37.getJSONObject("d"); int status38 = jsonObject38.getInt("Status"); String message38 = jsonObject38.getString("Message"); if (status38 == 0) { String result39 = jsonObject38.getString("Result"); JSONArray jsonArray39 = new JSONArray(result39); JSONObject jsonObject40 = (JSONObject) jsonArray39.get(0); if (worknovalid) { productionInfo = new ProductionInfo(); productionInfo.setUserId(Integer.parseInt(userID)); productionInfo.setUserCode(worknouserCode); productionInfo.setUserName(workNoName); } out_goodsID = String.valueOf(jsonObject40.optInt("GOODSID")); out_goodsCode = jsonObject40.getString("GOODSCODE"); out_goodsName = jsonObject40.getString("GOODSNAME"); specialRepairFlag = jsonObject40.optString("SPECIALREPAIRFLAG"); refire = Integer.parseInt(jsonObject40.optString("ISREFIRE")); String trademarkName = jsonObject40.optString("LOGONAME"); productionInfo.setTrademarkName(trademarkName); // out_groutingUserCode = // jsonObject40 // .getString("out_groutingUserCode"); productionInfo.setBarCode(barcode); productionInfo.setGoodsId(Integer.parseInt(out_goodsID)); productionInfo.setGoodsCode(out_goodsCode); productionInfo.setGoodsName(out_goodsName); // productionInfo.setGroutingUserCode(out_groutingUserCode); // JSONObject jsonObject41 = new // JSONObject(); // jsonObject41.put("accountCode", // accountCode); // jsonObject41.put("userCode", // userName); // jsonObject41.put("userPassword", // Md5Utils.encode(password)); // jsonObject41.put("sessionKey", // sessionkey); // jsonObject41.put("barcode", // code);// 产品条码 // client = new WebClient(); // String result41 = // client.doPost("http://" // + ServerAddress_ip + ":" + // ServerAddress_duankou // + // Constants.GET_IN_PRODUCTION_DATA_LIST, // jsonObject41.toString(), // "application/json"); // JSONObject j42=new // JSONObject(result41); // JSONObject // j43=j42.optJSONObject("d"); // int // status43=j43.optInt("Status"); // String // message43=j43.optString("Message"); // if(status43==0){ // String // result43=j43.optString("Result"); // JSONArray jarray43=new // JSONArray(result43); // JSONObject j44= // jarray43.optJSONObject(0); // refire=Integer.parseInt(j44.optString("ISREFIRE")); // specialRepairFlag=j44.optString("SPECIALREPAIRFLAG"); // } // else{ // Message m=new Message(); // m.what=0; // Bundle b=new Bundle(); // b.putInt("status",status43); // b.putString("errorMsg",message43); // m.setData(b); // exceptionHandler.sendMessage(m); // return; // } // editstatus = true; JSONObject jsonObject45 = new JSONObject(); jsonObject45.put("accountCode", accountCode); jsonObject45.put("userCode", checkCollectModify_userCode); jsonObject45.put("userPassword", password); jsonObject45.put("sessionKey", sessionkey); jsonObject45.put("barCode", barcode);// 产品条码 client = new WebClient(); String result45 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.CHECK_COLLECT_HAND_OVER_URL, jsonObject45.toString(), "application/json"); JSONObject jsonObject46 = new JSONObject(result45); JSONObject jsonObject47 = jsonObject46.getJSONObject("d"); int status47 = jsonObject47.getInt("Status"); if (status47 == 0) { String result47 = jsonObject47.getString("Result"); JSONObject resultObj48 = new JSONObject(result47); JSONArray resultArray48 = (JSONArray) resultObj48 .opt("PreProductCheck"); if (resultArray48 != null && resultArray48.length() > 0) { JSONObject jobj49 = (JSONObject) resultArray48.opt(0); int goodsLevelTypeId = jobj49.optInt("GOODSLEVELTYPEID"); int reworkProcedureId = jobj49.optInt("REWORKPROCEDUREID"); productionInfo.setGoodsLevelTypeId(goodsLevelTypeId); productionInfo.setReworkProcedureId(reworkProcedureId); } } // String result50; WebClient client = new WebClient(); JSONObject jsonObject50 = new JSONObject(); jsonObject50.put("accountCode", accountCode); jsonObject50.put("userCode", checkCollectModify_userCode); jsonObject50.put("userPassword", password); jsonObject50.put("sessionKey", sessionkey); result50 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.GET_GOODS_GRADE, jsonObject50.toString(), "application/json"); JSONObject jsonObject51 = new JSONObject(result50); JSONObject jsonobject52 = jsonObject51.getJSONObject("d"); int status52 = jsonobject52.getInt("Status"); String message52 = jsonobject52.getString("Message"); if (status52 == 0) { String json53 = jsonobject52.getString("Result"); JSONArray jsonArray54 = new JSONArray(json53); listProductClassify = new ArrayList(); for (int i = 0; i < jsonArray54.length(); i++) { classifyInfo = new ProductClassifyInfo(); JSONObject jsonObject55 = (JSONObject) jsonArray54.get(i); classifyInfo.setGoodsLevelTypeID( (int) jsonObject55.getDouble("GOODSLEVELTYPEID")); classifyInfo.setDefectFlagName( jsonObject55.getString("DEFECTFLAGNAME")); classifyInfo .setDefectFlagId((int) jsonObject55.getInt("DEFECTFLAGID")); listProductClassify.add(i, classifyInfo); } } else { Message m = new Message(); m.what = 0; Bundle b = new Bundle(); b.putInt("status", status52); b.putString("errorMsg", message52); m.setData(b); exceptionHandler.sendMessage(m); return; } Message m = new Message(); m.what = 1; Bundle b = new Bundle(); b.putSerializable("productclassifylist", (Serializable) listProductClassify); m.setData(b); handler.sendMessage(m); return; } else { Message m = new Message(); m.what = 0; Bundle b = new Bundle(); b.putInt("status", status38); b.putString("errorMsg", message38); m.setData(b); exceptionHandler.sendMessage(m); return; } } } else { client = null; client = new WebClient(); JSONObject jsonhead = new JSONObject(); jsonhead.put("accountCode", accountCode); jsonhead.put("userCode", checkCollectModify_userCode); jsonhead.put("userPassword", password); jsonhead.put("sessionKey", sessionkey); jsonhead.put("BarCode", barcode); String result11 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/GetProductionDataCheckID", jsonhead.toString(), "application/json"); JSONObject jobj = new JSONObject(result11); JSONObject jso = (JSONObject) jobj.opt("d"); int status11 = jso.optInt("Status"); String result1 = jso.optString("Result"); if (status11 == 0) { if (!TextUtils.isEmpty(result1)) { // proId = 139 是补裂 JSONArray ja = new JSONArray(result1); JSONObject jsonobj = (JSONObject) ja.get(0); int procedureId = jsonobj.optInt("PROCEDUREID"); if (procedureId == proId) { client = null; client = new WebClient(); JSONObject jsonhead12 = new JSONObject(); jsonhead12.put("accountCode", accountCode); jsonhead12.put("userCode", checkCollectModify_userCode); jsonhead12.put("userPassword", password); jsonhead12.put("sessionKey", sessionkey); jsonhead12.put("productionDataID", productionDataId); String Result = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/GetProductionDataByID", jsonhead12.toString(), "application/json"); JSONObject jobj12 = new JSONObject(Result); JSONObject jso12 = (JSONObject) jobj12.opt("d"); int status12 = jso12.optInt("Status"); String message12 = jso12.optString("Message"); if (status12 == 0) { if (productBugList != null && productBugList.size() > 0) { productBugList.removeAll(productBugList); } operationFlag = "modify"; checkFlag = "3"; String res = jso12.optString("Result"); JSONObject je = new JSONObject(res); JSONArray jarray = je.optJSONArray("PDAProductionData"); JSONObject jo1 = (JSONObject) jarray.get(0); int goodsId = jo1.optInt("GoodsID"); String goodsCode = (String) jo1.optString("GoodsCode"); String goodsName = (String) jo1.optString("GoodsName"); int defectFlagId = jo1.optInt("DefectFlagID"); int reworkProcedureId = jo1.optInt("ReworkProcedureID"); int userId = (int) jo1.optInt("UserID"); String userCode = jo1.optString("UserCode"); String userName1 = jo1.optString("UserName"); specialRepairFlag = String.valueOf(jo1.optInt("SpecialRepairflag")); specialRepairFlagName = jo1.optString("SpecialRepairFlagName"); refire = jo1.optInt("IsReFire"); refireName = jo1.optString("IsReFireName"); int goodsLevelTypeId = jo1.optInt("GoodsLevelTypeID"); String trademarkName = jo1.optString("LogoName"); String createTime = jo1.optString("CreateTime"); createTime = CommonUtil.commonDateConverter(createTime); checkTime = jo1.optString("CheckTime"); remarks = jo1.optString("Remarks"); String leakName = jo1.optString("LeakFlag1Name"); String internalLeakName = jo1.optString("LeakFlag2Name"); String passBallName = jo1.optString("LeakFlag3Name"); productionInfo = new ProductionInfo(); productionInfo.setBarCode(barcode); productionInfo.setGoodsId(goodsId); productionInfo.setGoodsCode(goodsCode); productionInfo.setGoodsName(goodsName); productionInfo.setLeak(leakName); productionInfo.setInternalLeak(internalLeakName); productionInfo.setPassBall(passBallName); productionInfo.setDefectFlagId(defectFlagId); productionInfo.setOut_Grade(defectFlagId); productionInfo.setReworkProcedureId(reworkProcedureId); productionInfo.setCheckTime(checkTime); productionInfo.setRemarks(remarks); productionInfo.setUserId(userId); productionInfo.setUserCode(userCode); productionInfo.setUserName(userName1); productionInfo.setGoodsLevelTypeId(goodsLevelTypeId); productionInfo.setTrademarkName(trademarkName); JSONArray defectArray = jo1.optJSONArray("PDADefects"); if (defectArray != null && defectArray.length() > 0) { for (int i = 0; i < defectArray.length(); i++) { ProductDefectInfo pdf = new ProductDefectInfo(); JSONObject job = (JSONObject) defectArray.get(i); int defectId = job.optInt("DefectID"); String defectCode = job.optString("DefectCode"); String defectName = job.optString("DefectName"); DefectNo dn = new DefectNo(); dn.setDefectId(defectId); dn.setDefectCode(defectCode); dn.setDefectName(defectName); pdf.setDefectNo(dn); pdf.setDeleteFlag("server"); int defectPositionId = (int) job.optInt("DefectPositionID"); String defectPositionCode = job .optString("DefectPositionCode"); String defectPositionName = job .optString("DefectPositionName"); DefectLocation dl = new DefectLocation(); dl.setDefectPositionId(defectPositionId); dl.setDefectPositionCode(defectPositionCode); dl.setDefectPositionName(defectPositionName); pdf.setDefectLocation(dl); int defectProcedureId = job.optInt("DefectProcedureID"); String defectProcedureCode = job .optString("DefectProcedureCode"); String defectProcedureName = job .optString("DefectProcedureName"); ResponsibilityProcedure rp = new ResponsibilityProcedure(); rp.setDutyProcedureId(defectProcedureId); rp.setDutyProcedureCode(defectProcedureCode); rp.setDutyProcedureName(defectProcedureName); pdf.setResponsibilityProcedure(rp); DefectDeduction defectDeduction = new DefectDeduction(); double defectDeductionNum = job .optDouble("DefectDeductionNum"); defectDeduction.setDefectDeductionNum( String.valueOf(defectDeductionNum)); pdf.setDefectDeduction(defectDeduction); String specialDefect = job.optString("SpecialDefect"); if (specialDefect.equals("0")) { pdf.setSpecialDefectFlag(false); } else { pdf.setSpecialDefectFlag(true); } int defectUserId = (int) job.optInt("DefectUserID"); String defectUserCode = job.optString("DefectUserCode"); String defectUserName = job.optString("DefectUserName"); int ProductionDataId = (int) job .optInt("DefectProductionDataID"); if (defectProcedureId > 0) { WorkNo wn = new WorkNo(); wn.setUserId(defectUserId); wn.setUserCode(defectUserCode); wn.setUserName(defectUserName); wn.setProductionDataId(ProductionDataId); pdf.setWorkno(wn); } else { WorkNo wn = new WorkNo(); wn.setUserId(defectUserId); wn.setUserCode(defectUserCode); wn.setUserName(defectUserName); pdf.setWorkno(wn); } int jobs = job.optInt("Jobs"); String jobsText = job.optString("JobsText"); WorkType wt = new WorkType(); wt.setJobsID(jobs); wt.setJobsName(jobsText); pdf.setWorkType(wt); int defectFineId = job.optInt("DefectFineID"); String defectFinesValue = job.optString("DefectFineValue"); DefectFines df = new DefectFines(); df.setDefectFinesId(defectFineId); df.setDefectFinesName(defectFinesValue); pdf.setDefectFines(df); JSONArray defectResponsibles = job .optJSONArray("PDADefectResponsibles"); List dutyPersonList = new ArrayList(); if (defectResponsibles != null && defectResponsibles.length() > 0) { for (int k = 0; k < defectResponsibles.length(); k++) { JSONObject jo2 = (JSONObject) defectResponsibles .get(k); int staffId = jo2.optInt("StaffID"); String staffCode = jo2.optString("StaffCode"); String staffName = jo2.optString("StaffName"); int staffStatus = jo2.optInt("StaffStatus"); int uJobsId = jo2.optInt("UJobsID"); int sJobsId = jo2.optInt("SJobsID"); DutyPerson dp = new DutyPerson(); dp.setStaffId(staffId); dp.setStaffCode(staffCode); dp.setStaffName(staffName); dp.setStaffStatus(staffStatus); dp.setJobsId(uJobsId); dp.setsJobsId(sJobsId); dp.setUserId(defectUserId); dp.setUserCode(defectUserCode); dutyPersonList.add(dp); } } pdf.setDutyPersonList(dutyPersonList); List imagePathList = new ArrayList(); JSONArray imageJsonArray = job .optJSONArray("PDADefectImageResults"); if (imageJsonArray != null && imageJsonArray.length() > 0) { for (int n = 0; n < imageJsonArray.length(); n++) { JSONObject imageJo = (JSONObject) imageJsonArray .get(n); String path = imageJo.optString("Imagepath"); ImagePath ip = new ImagePath(); ip.setServerPath(path); ip.setFlag("remote"); String pPath1 = CommonUtil.getRootFilePath(); String fileDir1 = pPath1 + Constants.DATA_CACHE_PATH; File file1 = new File(fileDir1); if (!file1.exists()) { file1.mkdir(); } String s = Md5Utils.encode(path); String imgName = s + ".jpg"; File f1 = new File(file1.getAbsolutePath(), imgName); if (!f1.exists()) { try { f1.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } ip.setLocalPath(f1.getAbsolutePath()); imagePathList.add(ip); } } String checkTime = job.optString("CheckTime"); pdf.setCreateTime(checkTime); pdf.setDefectImgPath(imagePathList); productBugList.add(pdf); } } client = null; client = new WebClient(); JSONObject js6 = new JSONObject(); js6.put("accountCode", accountCode); js6.put("userCode", checkCollectModify_userCode); js6.put("userPassword", password); js6.put("sessionKey", sessionkey); js6.put("settingcode", "S_PM_009"); String result6 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/GetSystemSettingDataByCode", js6.toString(), "application/json"); JSONObject js10 = new JSONObject(result6); JSONObject js11 = js10.optJSONObject("d"); int status13 = js11.optInt("Status"); String message13 = js11.optString("Message"); if (status13 == 0) { String result13 = js11.optString("Result"); JSONArray jarray13 = new JSONArray(result13); if (jarray13 != null && jarray13.length() > 0) { JSONObject js12 = jarray13.optJSONObject(0); String settingValueStr = js12.optString("SETTINGVALUE"); if (!TextUtils.isEmpty(settingValueStr)) { int settingValue = Integer.parseInt(settingValueStr); if (settingValue > 0) { client = null; client = new WebClient(); JSONObject js13 = new JSONObject(); js13.put("accountCode", accountCode); js13.put("userCode", checkCollectModify_userCode); js13.put("userPassword", password); js13.put("sessionKey", sessionkey); js13.put("orgTime", createTime); js13.put("days", settingValue); js13.put("settingCode", "S_PM_009"); String result14 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.serverAction + "/BarcodeAllowCancel", js13.toString(), "application/json"); JSONObject jobj13 = new JSONObject(result14); JSONObject jobj14 = jobj13.optJSONObject("d"); int status14 = jobj14.optInt("Status"); String message14 = jobj14.optString("Message"); if (status14 != 0) { overdueFlag = true; Bundle b = new Bundle(); b.putString("message", message14); b.putInt("status", status14); Message m = new Message(); m.what = 5; m.setData(b); exceptionHandler.sendMessage(m); } } } } } else { Bundle b = new Bundle(); b.putString("message", message13); b.putInt("status", status13); Message m = new Message(); m.what = 5; m.setData(b); exceptionHandler.sendMessage(m); } } else { Message m = new Message(); m.what = 5; Bundle b = new Bundle(); b.putInt("status", status12); b.putString("message", message12); m.setData(b); exceptionHandler.sendMessage(m); return; } } else { // 2023/3/14 不知道为什么有这个提示 31测漏气,3#试水,第一次进来提示,改成查询条码 // Message m = new Message(); // m.what = 2; // Bundle b = new Bundle(); // b.putString("message", "该工序不可到达!请确认质量登记工序"); // m.setData(b); // exceptionHandler.sendMessage(m); // return; operationFlag = "add"; checkFlag = "1"; JSONObject jsonObject28 = new JSONObject(); jsonObject28.put("accountCode", accountCode); jsonObject28.put("userCode", checkCollectModify_userCode); jsonObject28.put("userPassword", password); jsonObject28.put("sessionKey", sessionkey); jsonObject28.put("procedureID", proId);// 工序ID,菜单页面传过来的 jsonObject28.put("barcode", barcode);// 产品条码 jsonObject28.put("isNewCheck", true);// 用于区分新查询缺陷的checkbarcode client = new WebClient(); String result28 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.BAR_CODE_VALID, jsonObject28.toString(), "application/json"); JSONObject jsonObject29 = new JSONObject(result28); JSONObject jsonObject30 = jsonObject29.getJSONObject("d"); int status30 = jsonObject30.getInt("Status"); String message30 = jsonObject30.getString("Message"); if (status30 == 0) { String result30 = jsonObject30.getString("Result"); JSONObject resultObjBarCodeTable = new JSONObject(result30); JSONArray resultArrayBarCodeTable = (JSONArray) resultObjBarCodeTable .opt("BarCodeTable");// 之前的 JSONArray resultArrayleakFlag4Table = (JSONArray) resultObjBarCodeTable .opt("leakFlag4Table");// 养水 数据 JSONArray resultArrayleakFlag5Table = (JSONArray) resultObjBarCodeTable .opt("leakFlag5Table");// 试水 数据 JSONArray resultArrayleakFlag6Table = (JSONArray) resultObjBarCodeTable .opt("leakFlag6Table");// 补裂位置 数据 JSONArray resultArrayDefectTable = (JSONArray) resultObjBarCodeTable .opt("DefectTable");// 缺陷信息 JSONObject jsonObject31 = (JSONObject) resultArrayBarCodeTable .get(0); String outErrMsg30 = jsonObject31.getString("out_errMsg"); String missFlag = jsonObject31.optString("out_missFlag"); if (!TextUtils.isEmpty(outErrMsg30)) { if (missFlag.equals("0")) { Message m = new Message(); Bundle b = new Bundle(); b.putInt("status", status30); b.putString("errorMsg", outErrMsg30); m.what = 0; m.setData(b); exceptionHandler.sendMessage(m); return; } else { Message m1 = new Message(); Bundle b1 = new Bundle(); b1.putString("errmsg", outErrMsg30); b1.putString("flag", missFlag); m1.what = 4; m1.setData(b1); exceptionHandler.sendMessage(m1); return; } } else { produceCodeIsValid = true; if (worknovalid) { productionInfo = new ProductionInfo(); productionInfo.setUserId(Integer.parseInt(userID)); productionInfo.setUserCode(worknouserCode); productionInfo.setUserName(workNoName); } // 2023/1/3 start 增加 缺陷信息赋值 z if (resultArrayDefectTable != null && resultArrayDefectTable.length() > 0) { for (int i = 0; i < resultArrayDefectTable.length(); i++) { ProductDefectInfo pdf = new ProductDefectInfo(); JSONObject job = (JSONObject) resultArrayDefectTable .get(i); int defectId = job.optInt("DEFECTID"); String defectCode = job.optString("DEFECTCODE"); String defectName = job.optString("DEFECTNAME"); DefectNo dn = new DefectNo(); dn.setDefectId(defectId); dn.setDefectCode(defectCode); dn.setDefectName(defectName); pdf.setDefectNo(dn); pdf.setDeleteFlag("server"); int defectPositionId = (int) job .optInt("DEFECTPOSITIONID"); String defectPositionCode = job .optString("DEFECTPOSITIONCODE"); String defectPositionName = job .optString("DEFECTPOSITIONNAME"); DefectLocation dl = new DefectLocation(); dl.setDefectPositionId(defectPositionId); dl.setDefectPositionCode(defectPositionCode); dl.setDefectPositionName(defectPositionName); pdf.setDefectLocation(dl); int defectProcedureId = job.optInt("DEFECTPROCEDUREID"); String defectProcedureCode = job .optString("DEFECTPROCEDURECODE"); String defectProcedureName = job .optString("DEFECTPROCEDURENAME"); ResponsibilityProcedure rp = new ResponsibilityProcedure(); rp.setDutyProcedureId(defectProcedureId); rp.setDutyProcedureCode(defectProcedureCode); rp.setDutyProcedureName(defectProcedureName); pdf.setResponsibilityProcedure(rp); DefectDeduction defectDeduction = new DefectDeduction(); double defectDeductionNum = job .optDouble("DEFECTDEDUCTIONNUM"); defectDeduction.setDefectDeductionNum( String.valueOf(defectDeductionNum)); pdf.setDefectDeduction(defectDeduction); String specialDefect = job.optString("SPECIALDEFECT"); if (specialDefect.equals("0")) { pdf.setSpecialDefectFlag(false); } else { pdf.setSpecialDefectFlag(true); } int defectUserId = (int) job.optInt("DEFECTUSERID"); String defectUserCode = job.optString("DEFECTUSERCODE"); String defectUserName = job.optString("DEFECTUSERNAME"); int ProductionDataId = (int) job .optInt("DEFECTPRODUCTIONDATAID"); if (defectProcedureId > 0) { WorkNo wn = new WorkNo(); wn.setUserId(defectUserId); wn.setUserCode(defectUserCode); wn.setUserName(defectUserName); wn.setProductionDataId(ProductionDataId); pdf.setWorkno(wn); } else { WorkNo wn = new WorkNo(); wn.setUserId(defectUserId); wn.setUserCode(defectUserCode); wn.setUserName(defectUserName); pdf.setWorkno(wn); } int jobs = job.optInt("JOBS"); String jobsText = job.optString("JOBSTEXT"); WorkType wt = new WorkType(); wt.setJobsID(jobs); wt.setJobsName(jobsText); pdf.setWorkType(wt); int defectFineId = job.optInt("DEFECTFINEID"); String defectFinesValue = job .optString("DEFECTFINEVALUE"); DefectFines df = new DefectFines(); df.setDefectFinesId(defectFineId); df.setDefectFinesName(defectFinesValue); pdf.setDefectFines(df); JSONArray defectResponsibles = job .optJSONArray("PDADefectResponsibles"); List dutyPersonList = new ArrayList(); if (defectResponsibles != null && defectResponsibles.length() > 0) { for (int k = 0; k < defectResponsibles .length(); k++) { JSONObject jo2 = (JSONObject) defectResponsibles .get(k); int staffId = jo2.optInt("StaffID"); String staffCode = jo2.optString("StaffCode"); String staffName = jo2.optString("StaffName"); int staffStatus = jo2.optInt("StaffStatus"); int uJobsId = jo2.optInt("UJobsID"); int sJobsId = jo2.optInt("SJobsID"); DutyPerson dp = new DutyPerson(); dp.setStaffId(staffId); dp.setStaffCode(staffCode); dp.setStaffName(staffName); dp.setStaffStatus(staffStatus); dp.setJobsId(uJobsId); dp.setsJobsId(sJobsId); dp.setUserId(defectUserId); dp.setUserCode(defectUserCode); dutyPersonList.add(dp); } } pdf.setDutyPersonList(dutyPersonList); List imagePathList = new ArrayList(); JSONArray imageJsonArray = job .optJSONArray("PDADefectImageResults"); if (imageJsonArray != null && imageJsonArray.length() > 0) { for (int n = 0; n < imageJsonArray.length(); n++) { JSONObject imageJo = (JSONObject) imageJsonArray .get(n); String path = imageJo.optString("Imagepath"); ImagePath ip = new ImagePath(); ip.setServerPath(path); ip.setFlag("remote"); String pPath1 = CommonUtil.getRootFilePath(); String fileDir1 = pPath1 + Constants.DATA_CACHE_PATH; File file1 = new File(fileDir1); if (!file1.exists()) { file1.mkdir(); } String s = Md5Utils.encode(path); String imgName = s + ".jpg"; File f1 = new File(file1.getAbsolutePath(), imgName); if (!f1.exists()) { try { f1.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } ip.setLocalPath(f1.getAbsolutePath()); imagePathList.add(ip); } } String checkTime = job.optString("CHECKTIME"); pdf.setCreateTime(checkTime); pdf.setDefectImgPath(imagePathList); productBugList.add(pdf); } Message messageproductBugList = new Message(); Bundle bproductBugList = new Bundle(); bproductBugList.putSerializable("productbuglist", (Serializable) productBugList); messageproductBugList.what = 10; messageproductBugList.setData(bproductBugList); handler.sendMessage(messageproductBugList); } // end z if (resultArrayleakFlag4Table != null && resultArrayleakFlag4Table.length() > 0) { JSONObject jsonObjectleakFlag4Table = (JSONObject) resultArrayleakFlag4Table .get(0); productionInfo.setLeakFlag4TablePOSITION( jsonObjectleakFlag4Table.optString("POSITION"));// 养水 // 不合格位置 } if (resultArrayleakFlag5Table != null && resultArrayleakFlag5Table.length() > 0) { JSONObject jsonObjectleakFlag5Table = (JSONObject) resultArrayleakFlag5Table .get(0); productionInfo.setLeakFlag5TablePOSITION( jsonObjectleakFlag5Table.optString("POSITION"));// 试水 // 不合格位置 } if (resultArrayleakFlag6Table != null && resultArrayleakFlag6Table.length() > 0) { JSONObject jsonObjectleakFlag6Table = (JSONObject) resultArrayleakFlag6Table .get(0); productionInfo.setLeakFlag6TablePOSITION( jsonObjectleakFlag6Table.optString("POSITION")); // 补裂位置 mCheckRepairCrackPositionDate = jsonObjectleakFlag6Table .optString("POSITION"); } out_goodsID = jsonObject31.getString("out_goodsID"); out_goodsCode = jsonObject31.getString("out_goodsCode"); out_goodsName = jsonObject31.getString("out_goodsName"); out_groutingUserCode = jsonObject31 .getString("out_groutingUserCode"); productionInfo.setBarCode(barcode); productionInfo .setOut_Grade(jsonObject31.optInt("DefectFlagID")); productionInfo .setOfflineFlag(jsonObject31.optString("offlineFlag")); // 下标划线 productionInfo.setOut_LeakFlag1Name( jsonObject31.optString("out_LeakFlag1Name"));// 漏气 productionInfo.setOut_LeakFlag4Name( jsonObject31.optString("out_LeakFlag4Name"));// 养水 productionInfo.setOut_LeakFlag5Name( jsonObject31.optString("out_LeakFlag5Name"));// 试水 productionInfo.setOut_LeakFlag7Name( jsonObject31.optString("out_LeakFlag7Name"));// 修磨 productionInfo.setGoodsId(Integer.parseInt(out_goodsID)); productionInfo.setGoodsCode(out_goodsCode); productionInfo.setGoodsName(out_goodsName); specialRepairFlag = jsonObject31 .optString("out_specialRepairFlag"); specialRepairFlagName = jsonObject31 .optString("out_specialRepairFlagName"); refire = Integer .parseInt(jsonObject31.optString("out_isReFire")); refireName = jsonObject31.optString("out_isReFireName"); String trademarkName = jsonObject31.optString("out_logoName"); productionInfo.setTrademarkName(trademarkName); productionInfo .setOut_Grade(jsonObject31.optInt("DefectFlagID")); productionInfo .setOfflineFlag(jsonObject31.optString("offlineFlag")); // 下标划线 String leakName = jsonObject31.optString("out_LeakFlag1Name"); productionInfo.setLeak(leakName); String internalLeak = jsonObject31 .optString("out_LeakFlag2Name"); productionInfo.setInternalLeak(internalLeak); String passBall = jsonObject31.optString("out_LeakFlag3Name"); productionInfo.setPassBall(passBall); JSONObject jsonObject45 = new JSONObject(); jsonObject45.put("accountCode", accountCode); jsonObject45.put("userCode", checkCollectModify_userCode); jsonObject45.put("userPassword", password); jsonObject45.put("sessionKey", sessionkey); jsonObject45.put("barCode", barcode);// 产品条码 client = new WebClient(); String result45 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.CHECK_COLLECT_HAND_OVER_URL, jsonObject45.toString(), "application/json"); JSONObject jsonObject46 = new JSONObject(result45); JSONObject jsonObject47 = jsonObject46.getJSONObject("d"); int status47 = jsonObject47.getInt("Status"); if (status47 == 0) { String result47 = jsonObject47.getString("Result"); JSONObject resultObj48 = new JSONObject(result47); JSONArray resultArray48 = (JSONArray) resultObj48 .opt("PreProductCheck"); if (resultArray48 != null && resultArray48.length() > 0) { JSONObject jobj49 = (JSONObject) resultArray48.opt(0); int goodsLevelTypeId = jobj49 .optInt("GOODSLEVELTYPEID"); int reworkProcedureId = jobj49 .optInt("REWORKPROCEDUREID"); productionInfo.setGoodsLevelTypeId(goodsLevelTypeId); productionInfo.setReworkProcedureId(reworkProcedureId); } } } } } } } else { operationFlag = "add"; checkFlag = "1"; JSONObject jsonObject28 = new JSONObject(); jsonObject28.put("accountCode", accountCode); jsonObject28.put("userCode", checkCollectModify_userCode); jsonObject28.put("userPassword", password); jsonObject28.put("sessionKey", sessionkey); jsonObject28.put("procedureID", proId);// 工序ID,菜单页面传过来的 jsonObject28.put("barcode", barcode);// 产品条码 jsonObject28.put("isNewCheck", true);// 用于区分新查询缺陷的checkbarcode client = new WebClient(); String result28 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.BAR_CODE_VALID, jsonObject28.toString(), "application/json"); JSONObject jsonObject29 = new JSONObject(result28); JSONObject jsonObject30 = jsonObject29.getJSONObject("d"); int status30 = jsonObject30.getInt("Status"); String message30 = jsonObject30.getString("Message"); if (status30 == 0) { String result30 = jsonObject30.getString("Result"); JSONObject resultObjBarCodeTable = new JSONObject(result30); JSONArray resultArrayBarCodeTable = (JSONArray) resultObjBarCodeTable .opt("BarCodeTable");// 之前的 JSONArray resultArrayleakFlag4Table = (JSONArray) resultObjBarCodeTable .opt("leakFlag4Table");// 养水 数据 JSONArray resultArrayleakFlag5Table = (JSONArray) resultObjBarCodeTable .opt("leakFlag5Table");// 试水 数据 JSONArray resultArrayleakFlag6Table = (JSONArray) resultObjBarCodeTable .opt("leakFlag6Table");// 补裂 位置数据 传送门 JSONArray resultArrayDefectTable = (JSONArray) resultObjBarCodeTable .opt("DefectTable");// 缺陷信息 JSONObject jsonObject31 = (JSONObject) resultArrayBarCodeTable.get(0); String outErrMsg30 = jsonObject31.getString("out_errMsg"); String missFlag = jsonObject31.optString("out_missFlag"); if (!TextUtils.isEmpty(outErrMsg30)) { if (missFlag.equals("0")) { Message m = new Message(); Bundle b = new Bundle(); b.putInt("status", status30); b.putString("errorMsg", outErrMsg30); m.what = 0; m.setData(b); exceptionHandler.sendMessage(m); return; } else { Message m1 = new Message(); Bundle b1 = new Bundle(); b1.putString("errmsg", outErrMsg30); b1.putString("flag", missFlag); m1.what = 4; m1.setData(b1); exceptionHandler.sendMessage(m1); return; } } else { produceCodeIsValid = true; if (worknovalid) { productionInfo = new ProductionInfo(); productionInfo.setUserId(Integer.parseInt(userID)); productionInfo.setUserCode(worknouserCode); productionInfo.setUserName(workNoName); } // 2023/1/3 start 增加 缺陷信息赋值 z if (resultArrayDefectTable != null && resultArrayDefectTable.length() > 0) { for (int i = 0; i < resultArrayDefectTable.length(); i++) { ProductDefectInfo pdf = new ProductDefectInfo(); JSONObject job = (JSONObject) resultArrayDefectTable.get(i); int defectId = job.optInt("DEFECTID"); String defectCode = job.optString("DEFECTCODE"); String defectName = job.optString("DEFECTNAME"); DefectNo dn = new DefectNo(); dn.setDefectId(defectId); dn.setDefectCode(defectCode); dn.setDefectName(defectName); pdf.setDefectNo(dn); pdf.setDeleteFlag("server"); int defectPositionId = (int) job.optInt("DEFECTPOSITIONID"); String defectPositionCode = job.optString("DEFECTPOSITIONCODE"); String defectPositionName = job.optString("DEFECTPOSITIONNAME"); DefectLocation dl = new DefectLocation(); dl.setDefectPositionId(defectPositionId); dl.setDefectPositionCode(defectPositionCode); dl.setDefectPositionName(defectPositionName); pdf.setDefectLocation(dl); int defectProcedureId = job.optInt("DEFECTPROCEDUREID"); String defectProcedureCode = job .optString("DEFECTPROCEDURECODE"); String defectProcedureName = job .optString("DEFECTPROCEDURENAME"); ResponsibilityProcedure rp = new ResponsibilityProcedure(); rp.setDutyProcedureId(defectProcedureId); rp.setDutyProcedureCode(defectProcedureCode); rp.setDutyProcedureName(defectProcedureName); pdf.setResponsibilityProcedure(rp); DefectDeduction defectDeduction = new DefectDeduction(); double defectDeductionNum = job.optDouble("DEFECTDEDUCTIONNUM"); defectDeduction.setDefectDeductionNum( String.valueOf(defectDeductionNum)); pdf.setDefectDeduction(defectDeduction); String specialDefect = job.optString("SPECIALDEFECT"); if (specialDefect.equals("0")) { pdf.setSpecialDefectFlag(false); } else { pdf.setSpecialDefectFlag(true); } int defectUserId = (int) job.optInt("DEFECTUSERID"); String defectUserCode = job.optString("DEFECTUSERCODE"); String defectUserName = job.optString("DEFECTUSERNAME"); int ProductionDataId = (int) job .optInt("DEFECTPRODUCTIONDATAID"); if (defectProcedureId > 0) { WorkNo wn = new WorkNo(); wn.setUserId(defectUserId); wn.setUserCode(defectUserCode); wn.setUserName(defectUserName); wn.setProductionDataId(ProductionDataId); pdf.setWorkno(wn); } else { WorkNo wn = new WorkNo(); wn.setUserId(defectUserId); wn.setUserCode(defectUserCode); wn.setUserName(defectUserName); pdf.setWorkno(wn); } int jobs = job.optInt("JOBS"); String jobsText = job.optString("JOBSTEXT"); WorkType wt = new WorkType(); wt.setJobsID(jobs); wt.setJobsName(jobsText); pdf.setWorkType(wt); int defectFineId = job.optInt("DEFECTFINEID"); String defectFinesValue = job.optString("DEFECTFINEVALUE"); DefectFines df = new DefectFines(); df.setDefectFinesId(defectFineId); df.setDefectFinesName(defectFinesValue); pdf.setDefectFines(df); JSONArray defectResponsibles = job .optJSONArray("PDADefectResponsibles"); List dutyPersonList = new ArrayList(); if (defectResponsibles != null && defectResponsibles.length() > 0) { for (int k = 0; k < defectResponsibles.length(); k++) { JSONObject jo2 = (JSONObject) defectResponsibles.get(k); int staffId = jo2.optInt("StaffID"); String staffCode = jo2.optString("StaffCode"); String staffName = jo2.optString("StaffName"); int staffStatus = jo2.optInt("StaffStatus"); int uJobsId = jo2.optInt("UJobsID"); int sJobsId = jo2.optInt("SJobsID"); DutyPerson dp = new DutyPerson(); dp.setStaffId(staffId); dp.setStaffCode(staffCode); dp.setStaffName(staffName); dp.setStaffStatus(staffStatus); dp.setJobsId(uJobsId); dp.setsJobsId(sJobsId); dp.setUserId(defectUserId); dp.setUserCode(defectUserCode); dutyPersonList.add(dp); } } pdf.setDutyPersonList(dutyPersonList); List imagePathList = new ArrayList(); JSONArray imageJsonArray = job .optJSONArray("PDADefectImageResults"); if (imageJsonArray != null && imageJsonArray.length() > 0) { for (int n = 0; n < imageJsonArray.length(); n++) { JSONObject imageJo = (JSONObject) imageJsonArray.get(n); String path = imageJo.optString("Imagepath"); ImagePath ip = new ImagePath(); ip.setServerPath(path); ip.setFlag("remote"); String pPath1 = CommonUtil.getRootFilePath(); String fileDir1 = pPath1 + Constants.DATA_CACHE_PATH; File file1 = new File(fileDir1); if (!file1.exists()) { file1.mkdir(); } String s = Md5Utils.encode(path); String imgName = s + ".jpg"; File f1 = new File(file1.getAbsolutePath(), imgName); if (!f1.exists()) { try { f1.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } ip.setLocalPath(f1.getAbsolutePath()); imagePathList.add(ip); } } String checkTime = job.optString("CHECKTIME"); pdf.setCreateTime(checkTime); pdf.setDefectImgPath(imagePathList); productBugList.add(pdf); } Message messageproductBugList = new Message(); Bundle bproductBugList = new Bundle(); bproductBugList.putSerializable("productbuglist", (Serializable) productBugList); messageproductBugList.what = 10; messageproductBugList.setData(bproductBugList); handler.sendMessage(messageproductBugList); } // end z out_goodsID = jsonObject31.getString("out_goodsID"); out_goodsCode = jsonObject31.getString("out_goodsCode"); out_goodsName = jsonObject31.getString("out_goodsName"); out_groutingUserCode = jsonObject31.getString("out_groutingUserCode"); productionInfo.setOut_Grade(jsonObject31.optInt("DefectFlagID")); productionInfo.setBarCode(barcode); productionInfo.setOfflineFlag(jsonObject31.optString("offlineFlag")); // 下标划线 productionInfo.setOut_LeakFlag1Name( jsonObject31.optString("out_LeakFlag1Name"));// 漏气 productionInfo.setOut_LeakFlag4Name( jsonObject31.optString("out_LeakFlag4Name"));// 养水 productionInfo.setOut_LeakFlag5Name( jsonObject31.optString("out_LeakFlag5Name"));// 试水 productionInfo.setOut_LeakFlag7Name( jsonObject31.optString("out_LeakFlag7Name"));// 修磨 if (resultArrayleakFlag4Table != null && resultArrayleakFlag4Table.length() > 0) { JSONObject jsonObjectleakFlag4Table = (JSONObject) resultArrayleakFlag4Table .get(0); productionInfo.setLeakFlag4TablePOSITION( jsonObjectleakFlag4Table.optString("POSITION"));// 养水 不合格位置 } if (resultArrayleakFlag5Table != null && resultArrayleakFlag5Table.length() > 0) { JSONObject jsonObjectleakFlag5Table = (JSONObject) resultArrayleakFlag5Table .get(0); productionInfo.setLeakFlag5TablePOSITION( jsonObjectleakFlag5Table.optString("POSITION"));// 试水 不合格位置 } if (resultArrayleakFlag6Table != null && resultArrayleakFlag6Table.length() > 0) { JSONObject jsonObjectleakFlag6Table = (JSONObject) resultArrayleakFlag6Table .get(0); productionInfo.setLeakFlag6TablePOSITION( jsonObjectleakFlag6Table.optString("POSITION")); // 补裂位置 mCheckRepairCrackPositionDate = jsonObjectleakFlag6Table .optString("POSITION"); } productionInfo.setGoodsId(Integer.parseInt(out_goodsID)); productionInfo.setGoodsCode(out_goodsCode); productionInfo.setGoodsName(out_goodsName); specialRepairFlag = jsonObject31.optString("out_specialRepairFlag"); specialRepairFlagName = jsonObject31 .optString("out_specialRepairFlagName"); if (jsonObject31.has("out_isReFire")) { String out_isReFire = jsonObject31.optString("out_isReFire"); if (!jsonObject31.isNull("out_isReFire")) { // 字段不为 null,可以进行相应的处理 refire = Integer .parseInt(jsonObject31.optString("out_isReFire")); } else { // 字段为 null,可以进行相应的处理 } } refireName = jsonObject31.optString("out_isReFireName"); String trademarkName = jsonObject31.optString("out_logoName"); productionInfo.setTrademarkName(trademarkName); productionInfo.setOut_Grade(jsonObject31.optInt("DefectFlagID")); productionInfo.setOfflineFlag(jsonObject31.optString("offlineFlag")); // 下标划线 String leakName = jsonObject31.optString("out_LeakFlag1Name"); productionInfo.setLeak(leakName); String internalLeak = jsonObject31.optString("out_LeakFlag2Name"); productionInfo.setInternalLeak(internalLeak); String passBall = jsonObject31.optString("out_LeakFlag3Name"); productionInfo.setPassBall(passBall); JSONObject jsonObject45 = new JSONObject(); jsonObject45.put("accountCode", accountCode); jsonObject45.put("userCode", checkCollectModify_userCode); jsonObject45.put("userPassword", password); jsonObject45.put("sessionKey", sessionkey); jsonObject45.put("barCode", barcode);// 产品条码 client = new WebClient(); String result45 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.CHECK_COLLECT_HAND_OVER_URL, jsonObject45.toString(), "application/json"); JSONObject jsonObject46 = new JSONObject(result45); JSONObject jsonObject47 = jsonObject46.getJSONObject("d"); int status47 = jsonObject47.getInt("Status"); if (status47 == 0) { String result47 = jsonObject47.getString("Result"); JSONObject resultObj48 = new JSONObject(result47); JSONArray resultArray48 = (JSONArray) resultObj48 .opt("PreProductCheck"); if (resultArray48 != null && resultArray48.length() > 0) { JSONObject jobj49 = (JSONObject) resultArray48.opt(0); int goodsLevelTypeId = jobj49.optInt("GOODSLEVELTYPEID"); int reworkProcedureId = jobj49.optInt("REWORKPROCEDUREID"); productionInfo.setGoodsLevelTypeId(goodsLevelTypeId); productionInfo.setReworkProcedureId(reworkProcedureId); } } } } else { Message m = new Message(); m.what = 0; Bundle b = new Bundle(); b.putInt("status", status30); b.putString("errorMsg", message30); m.setData(b); exceptionHandler.sendMessage(m); return; } // } } } } else { JSONObject jsonObject30 = new JSONObject(); jsonObject30.put("accountCode", accountCode); jsonObject30.put("userCode", checkCollectModify_userCode); jsonObject30.put("userPassword", password); jsonObject30.put("sessionKey", sessionkey); jsonObject30.put("procedureID", proId);// 工序ID,菜单页面传过来的 jsonObject30.put("barcode", barcode);// 产品条码 jsonObject30.put("isNewCheck", true);// 用于区分新查询缺陷的checkbarcode client = new WebClient(); String result30 = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.BAR_CODE_VALID, jsonObject30.toString(), "application/json"); JSONObject jsonObject31 = new JSONObject(result30); JSONObject jsonObject32 = jsonObject31.getJSONObject("d"); int status32 = jsonObject32.getInt("Status"); String message32 = jsonObject32.getString("Message"); if (status32 == 0) { // 2022/12/29 王英杰 修改 String result32 = jsonObject32.getString("Result"); // 没有 过多的操作 所以 不做数据处理 JSONObject resultObjBarCodeTable = new JSONObject(result32); JSONArray resultArrayBarCodeTable = (JSONArray) resultObjBarCodeTable .opt("BarCodeTable");// 之前的 JSONObject resultObjleakFlag4Table = new JSONObject(result30); JSONArray resultArrayleakFlag4Table = (JSONArray) resultObjleakFlag4Table .opt("leakFlag4Table");// 养水 数据 JSONObject resultObjleakFlag5Table = new JSONObject(result30); JSONArray resultArrayleakFlag5Table = (JSONArray) resultObjleakFlag5Table .opt("leakFlag5Table");// 试水 数据 JSONArray resultArrayleakFlag6Table = (JSONArray) resultObjBarCodeTable .opt("leakFlag6Table");// 补裂 位置数据 传送门 JSONObject jsonObject33 = (JSONObject) resultArrayBarCodeTable.get(0); String outErrMsg33 = jsonObject33.getString("out_errMsg"); String missFlag = jsonObject33.optString("out_missFlag"); if (!TextUtils.isEmpty(outErrMsg33)) { produceCodeIsValid = false; if (missFlag.equals("0")) { Message m = new Message(); Bundle b = new Bundle(); b.putInt("status", status32); b.putString("errorMsg", outErrMsg33); m.what = 0; m.setData(b); exceptionHandler.sendMessage(m); return; } else { Message m1 = new Message(); Bundle b1 = new Bundle(); b1.putString("errmsg", outErrMsg33); b1.putString("flag", missFlag); m1.what = 6; m1.setData(b1); exceptionHandler.sendMessage(m1); return; } } } else { Message m = new Message(); m.what = 0; Bundle b = new Bundle(); b.putInt("status", status32); b.putString("errorMsg", message32); m.setData(b); exceptionHandler.sendMessage(m); return; } } } else { Message m = new Message(); m.what = 0; Bundle b = new Bundle(); b.putInt("status", status); b.putString("errorMsg", msg); m.setData(b); exceptionHandler.sendMessage(m); return; } String result30; WebClient client = new WebClient(); JSONObject jsonObject30 = new JSONObject(); jsonObject30.put("accountCode", accountCode); jsonObject30.put("userCode", checkCollectModify_userCode); jsonObject30.put("userPassword", password); jsonObject30.put("sessionKey", sessionkey); result30 = client.doPost( "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.GET_GOODS_GRADE, jsonObject30.toString(), "application/json"); JSONObject jsonObject31 = new JSONObject(result30); JSONObject jsonobject32 = jsonObject31.getJSONObject("d"); int status32 = jsonobject32.getInt("Status"); String message32 = jsonobject32.getString("Message"); if (status32 == 0) { String json33 = jsonobject32.getString("Result"); JSONArray jsonArray34 = new JSONArray(json33); listProductClassify = new ArrayList(); for (int i = 0; i < jsonArray34.length(); i++) { classifyInfo = new ProductClassifyInfo(); JSONObject jsonObject35 = (JSONObject) jsonArray34.get(i); classifyInfo.setGoodsLevelTypeID((int) jsonObject35.getDouble("GOODSLEVELTYPEID")); classifyInfo.setDefectFlagName(jsonObject35.getString("DEFECTFLAGNAME")); classifyInfo.setDefectFlagId((int) jsonObject35.getInt("DEFECTFLAGID")); listProductClassify.add(i, classifyInfo); } } else { Message m = new Message(); m.what = 0; Bundle b = new Bundle(); b.putInt("status", status32); b.putString("errorMsg", message32); m.setData(b); exceptionHandler.sendMessage(m); return; } Message m = new Message(); m.what = 1; Bundle b = new Bundle(); b.putSerializable("productbuglist", (Serializable) productBugList); b.putSerializable("productclassifylist", (Serializable) listProductClassify); m.setData(b); handler.sendMessage(m); return; } catch (Exception e) { e.printStackTrace(); Message m = new Message(); m.what = 2; Bundle b4 = new Bundle(); b4.putString("message", "网络连接异常"); m.setData(b4); exceptionHandler.sendMessage(m); return; } } } }; @SuppressWarnings("unchecked") @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 101 && resultCode == 103) { barcode.setEnabled(true); barcode.setText(""); barcode.setFocusable(true); barcode.setFocusableInTouchMode(true); barcode.requestFocus(); barcode.findFocus(); barcode.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); CommonUtil.BarcodeMaxLength(barcode, 50); bugnotxt.setEnabled(true); bugnotxt.setText(""); bugnotxt.setFocusable(true); bugnotxt.setFocusableInTouchMode(true); bugnotxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); loctxt.setEnabled(true); loctxt.setText(""); loctxt.setFocusable(true); loctxt.setFocusableInTouchMode(true); loctxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); } if (requestCode == 100 && resultCode == 101) { try { Bundle bundle = data.getExtras(); productBugList = (List) bundle.getSerializable("productBugList"); if (null != productBugList && productBugList.size() > 0) { save.setText("保存(" + productBugList.size() + ")"); bugnotxt.setText(""); bugnotxt.requestFocus(); loctxt.setText(""); bugnametxt.setText(""); mAdapter = new SwipeAdapter(CheckCollectModifyActivity.this, mListView.getRightViewWidth(), ServerAddress_ip, ServerAddress_duankou, accountCode, checkCollectModify_userCode, password, sessionkey, productBugList); mListView.setAdapter(mAdapter); mAdapter.setOnRightItemClickListener(new SwipeAdapter.onRightItemClickListener() { @Override public void onRightItemClick(View v, int position) { if (!overdueFlag) { ProductDefectInfo defectInfo = productBugList.get(position); if (defectInfo.getDeleteFlag().equals("server")) { deleteFlag = true; } mListView.deleteItem(mListView.getChildAt(position)); productBugList.remove(position); save.setText("保存(" + productBugList.size() + ")"); mAdapter.notifyDataSetChanged(); } } }); } } catch (Exception e) { } } if (requestCode == 102 && resultCode == RESULT_OK) { Bundle bundle = data.getExtras(); String scanResult = bundle.getString("result"); View rootview = this.getWindow().getDecorView(); EditText v = (EditText) rootview.findFocus(); int id = v.getId(); v.setText(scanResult); v.setSelection(scanResult.length()); switch (id) { case R.id.user_code: String workno = v.getText().toString(); if (TextUtils.isEmpty(workno)) { CustomToast.showToast(getApplicationContext(), "生产工号不能为空", 2000); v.setFocusable(true); v.requestFocus(); return; } ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this); JSONObject sendJsonHead = new JSONObject(); try { sendJsonHead.put("accountCode", accountCode); sendJsonHead.put("userCode", checkCollectModify_userCode); sendJsonHead.put("userPassword", password); sendJsonHead.put("sessionKey", sessionkey); // 生产工号检验请求数据 sendJsonHead.put("procedureID", proId);// 工序ID,菜单页面传过来的 sendJsonHead.put("procedureUserCode", workno);// 生产工号 worknoEdt.setEnabled(false); worknoEdt.setFocusable(false); worknoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); barcode.setEnabled(false); barcode.setFocusable(false); barcode.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); bugnotxt.setEnabled(false); bugnotxt.setFocusable(false); bugnotxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); loctxt.setEnabled(false); loctxt.setFocusable(false); loctxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); thread = new HandlerThread("userThread", 5); thread.start(); mHandler = new Handler(thread.getLooper()); UserRunnable userRunnable = new UserRunnable(sendJsonHead); mHandler.post(userRunnable); } catch (JSONException e1) { e1.printStackTrace(); } break; case R.id.bar_code: String worknocode = worknoEdt.getText().toString(); if (TextUtils.isEmpty(worknocode)) { // Toast.makeText(getApplicationContext(), "生产工号不能为空", // Toast.LENGTH_SHORT).show(); CustomToast.showToast(getApplicationContext(), "生产工号不能为空", 2000); worknoEdt.setEnabled(true); worknoEdt.setFocusable(true); worknoEdt.setFocusableInTouchMode(true); worknoEdt.requestFocus(); worknoEdt.findFocus(); worknoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); return; } else { if (!worknovalid) { // Toast.makeText(getApplicationContext(), "请先验证生产工号", // Toast.LENGTH_SHORT).show(); CustomToast.showToast(getApplicationContext(), "请先验证生产工号", 2000); worknoEdt.setEnabled(true); worknoEdt.setFocusable(true); worknoEdt.setFocusableInTouchMode(true); worknoEdt.requestFocus(); worknoEdt.findFocus(); worknoEdt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); return; } } String code = v.getText().toString().trim(); ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this); if (!CommonUtil.isNumber(code)) { ProcessDialogUtils.closeProgressDilog(); // CommonUtil.showRepeatDialog(code+"格式不匹配",CheckCollectModifyActivity.this); // Toast.makeText(getApplicationContext(), code + "格式不匹配", // Toast.LENGTH_SHORT).show(); CustomToast.showToast(getApplicationContext(), code + "格式不匹配", 2000); barcode.setEnabled(true); barcode.setText(""); barcode.setFocusable(true); barcode.setFocusableInTouchMode(true); barcode.requestFocus(); barcode.findFocus(); barcode.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); CommonUtil.BarcodeMaxLength(barcode, 50); return; } productNumber.setText(""); productCode.setText(""); productName.setText(""); refineEdt.setText(""); bugnotxt.setText(""); bugnametxt.setText(""); loctxt.setText(""); trademarkNameTxt.setText(""); // repairEdt.setText(""); if (classifySpin.getSelectedItem() != null) { listProductClassify.removeAll(listProductClassify); if (adapterProductClassify != null) { adapterProductClassify.notifyDataSetChanged(); } } if (gotoSpin.getSelectedItem() != null) { listReWorkProcedure.clear(); if (adapterReWorkProcedure != null) { adapterReWorkProcedure.notifyDataSetChanged(); } } if (productBugList != null && productBugList.size() > 0) { productBugList.removeAll(productBugList); if (mAdapter != null) { mAdapter.notifyDataSetChanged(); } save.setText("保存(" + productBugList.size() + ")"); } barcode.setEnabled(false); barcode.setFocusable(false); barcode.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); bugnotxt.setEnabled(false); bugnotxt.setFocusable(false); bugnotxt.setFocusableInTouchMode(false); bugnotxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); loctxt.setEnabled(false); loctxt.setFocusable(false); loctxt.setFocusableInTouchMode(false); loctxt.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); thread = new HandlerThread("barcodeThread", 5); thread.start(); mHandler = new Handler(thread.getLooper()); BarcodeRunnable barcodeRunnable = new BarcodeRunnable(code, obj); mHandler.post(barcodeRunnable); break; } } } @Override public void onBackPressed() { if (productBugList != null && productBugList.size() > 0) { productBugList.removeAll(productBugList); } super.onBackPressed(); } @Override public Resources getResources() { Resources res = super.getResources(); Configuration config = new Configuration(); config.setToDefaults(); res.updateConfiguration(config, res.getDisplayMetrics()); return res; } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.update_check_collect, menu); return true; } }