|
|
@@ -9,8 +9,14 @@ import org.json.JSONArray;
|
|
|
import org.json.JSONException;
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
+import com.jiaju.activity.DeliveryNoteInquiryActivity.ListAPIRunnable;
|
|
|
+import com.jiaju.adapter.CarBrandSpinnerAdapter;
|
|
|
+import com.jiaju.adapter.OrderSpinnerAdapter;
|
|
|
import com.jiaju.adapter.PieceListMessageAdapter;
|
|
|
+import com.jiaju.model.CarBrandModel;
|
|
|
+import com.jiaju.model.Order;
|
|
|
import com.jiaju.model.Piece;
|
|
|
+import com.jiaju.model.ProductClassifyInfo;
|
|
|
import com.jiaju.net.WebClient;
|
|
|
import com.jiaju.utils.CommonUtil;
|
|
|
import com.jiaju.utils.Constants;
|
|
|
@@ -52,6 +58,7 @@ import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.ListView;
|
|
|
import android.widget.PopupWindow;
|
|
|
+import android.widget.Spinner;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.TextView.OnEditorActionListener;
|
|
|
import android.widget.Toast;
|
|
|
@@ -130,11 +137,15 @@ public class PieceActivity extends Activity {
|
|
|
private LinearLayout llSecurityLine;
|
|
|
private String securityCode;
|
|
|
private int functionStatus;
|
|
|
- private LinearLayout llayBoardCode, view_board_code; // 版码布局
|
|
|
+ private LinearLayout llayBoardCode, view_board_code; // 版码布局
|
|
|
+ private LinearLayout baozhuang; // 版码布局
|
|
|
private EditText edtBoardCode; // 板码输入框控件
|
|
|
- private String[] packagProId = { "13", "79", "107" }; // 包装的 页面id
|
|
|
+ private String[] packagProId = { "13", "79", "107" ,"159"}; // 包装的 页面id
|
|
|
private boolean ispackagpage = false;
|
|
|
public Button btndelete;
|
|
|
+ private Spinner trademarksource;
|
|
|
+ private List<CarBrandModel> carBrandList;
|
|
|
+ private CarBrandSpinnerAdapter carBrandAdapter;
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
@@ -164,6 +175,11 @@ public class PieceActivity extends Activity {
|
|
|
// view_board_code.setVisibility(View.VISIBLE);
|
|
|
ispackagpage = true;
|
|
|
}
|
|
|
+ if(proId==159) {
|
|
|
+ baozhuang.setVisibility(View.VISIBLE);
|
|
|
+ //获取装板数量
|
|
|
+ getsum();
|
|
|
+ }
|
|
|
// functionStatus ==0 普通 ==1绑定 ==2验证
|
|
|
switch (collectType) {
|
|
|
case 2:// 单点采集
|
|
|
@@ -197,7 +213,7 @@ public class PieceActivity extends Activity {
|
|
|
met.findFocus();
|
|
|
met.setSelectAllOnFocus(true);
|
|
|
break;
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void initview() {
|
|
|
@@ -213,7 +229,7 @@ public class PieceActivity extends Activity {
|
|
|
llayBoardCode = (LinearLayout) head.findViewById(R.id.llay_board_code);// 板码布局
|
|
|
edtBoardCode = (EditText) head.findViewById(R.id.edt_board_code);// 板码输入框
|
|
|
btndelete = (Button) head.findViewById(R.id.btndelete);
|
|
|
-
|
|
|
+ trademarksource = (Spinner) head.findViewById(R.id.trademarksource);
|
|
|
// view_board_code = (LinearLayout) head.findViewById(R.id.view_board_code);// 板码布局
|
|
|
bt2 = (Button) findViewById(R.id.btnsure);
|
|
|
backtext = (TextView) findViewById(R.id.back);
|
|
|
@@ -225,6 +241,7 @@ public class PieceActivity extends Activity {
|
|
|
parent = (LinearLayout) findViewById(R.id.parentRel);
|
|
|
productRecord = (ImageView) findViewById(R.id.search);
|
|
|
productRecord.setVisibility(View.VISIBLE);
|
|
|
+ baozhuang = (LinearLayout) head.findViewById(R.id.baozhuang);// 板码布局
|
|
|
}
|
|
|
|
|
|
private void alllistener() {
|
|
|
@@ -336,7 +353,7 @@ public class PieceActivity extends Activity {
|
|
|
CustomToast.showToast(getApplicationContext(), "没有可提交的明细信息", 2000);
|
|
|
return;
|
|
|
}
|
|
|
- if (collectType == 1 && nodeType == 3) {
|
|
|
+ if (collectType == 1 && nodeType == 3 && proId!=159) {
|
|
|
if (plateNum > 0 && piecelist.size() != plateNum) {
|
|
|
CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
CommonUtil.showBarCodeAlertDialog(0, "未达到装板数量【" + plateNum + "】", PieceActivity.this,
|
|
|
@@ -344,6 +361,28 @@ public class PieceActivity extends Activity {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
+ if (collectType == 1 && nodeType == 3 &&proId==159) {
|
|
|
+ CarBrandModel carbrandModel = (CarBrandModel) trademarksource.getSelectedItem();
|
|
|
+
|
|
|
+ String zhuangbanshuliang=carbrandModel.getCarBrandName();
|
|
|
+
|
|
|
+ int num=Integer.parseInt(zhuangbanshuliang);
|
|
|
+ if( piecelist.size()>num) {
|
|
|
+ CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
+ CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【" + num + "】", PieceActivity.this,
|
|
|
+ barcode, null, null);
|
|
|
+ ProcessDialogUtils.closeProgressDilog();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else if( piecelist.size()<num){
|
|
|
+ CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
+ CommonUtil.showBarCodeAlertDialog(0, "未达到装板数量【" + num + "】", PieceActivity.this,
|
|
|
+ barcode, null, null);
|
|
|
+ ProcessDialogUtils.closeProgressDilog();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
if (isGlazeChange == 1) {
|
|
|
Intent intent = new Intent();
|
|
|
intent.setClass(PieceActivity.this, GlazePieceSetActivity.class);
|
|
|
@@ -654,7 +693,7 @@ public class PieceActivity extends Activity {
|
|
|
//String etcode = barcode.getText().toString().trim().replaceAll("\\n", "");
|
|
|
String etcode = barcode.getText().toString().trim().replaceAll("\\n", "").replaceAll("\n", "");
|
|
|
barcode.setText(etcode);
|
|
|
- if (etcode.substring(0, 4).equals("http")) {
|
|
|
+ if (etcode.length()>=4&&etcode.substring(0, 4).equals("http")) {
|
|
|
String[] parts = etcode.split("-", 2);
|
|
|
if (parts.length == 2) {
|
|
|
etcode = parts[1];
|
|
|
@@ -703,7 +742,7 @@ public class PieceActivity extends Activity {
|
|
|
if (arg1 == EditorInfo.IME_ACTION_GO) {
|
|
|
// functionStatus ==0 普通 ==1绑定 ==2验证
|
|
|
String etcode = barcode.getText().toString().trim().replaceAll("\\n", "").replaceAll("\n", "");
|
|
|
- if (etcode.substring(0, 4).equals("http")) {
|
|
|
+ if (etcode.length()>=4&&etcode.substring(0, 4).equals("http")) {
|
|
|
String[] parts = etcode.split("-", 2);
|
|
|
if (parts.length == 2) {
|
|
|
etcode = parts[1];
|
|
|
@@ -927,7 +966,7 @@ public class PieceActivity extends Activity {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (collectType == 1 && nodeType == 3) {
|
|
|
+ if (collectType == 1 && nodeType == 3 &&proId!=159) {
|
|
|
if (plateNum > 0 && piecelist.size() == plateNum) {
|
|
|
CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【" + plateNum + "】", PieceActivity.this,
|
|
|
@@ -937,6 +976,28 @@ public class PieceActivity extends Activity {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
+ if (collectType == 1 && nodeType == 3 &&proId==159) {
|
|
|
+ CarBrandModel carbrandModel = (CarBrandModel) trademarksource.getSelectedItem();
|
|
|
+
|
|
|
+ String zhuangbanshuliang=carbrandModel.getCarBrandName();
|
|
|
+
|
|
|
+ int num=Integer.parseInt(zhuangbanshuliang);
|
|
|
+ if( piecelist.size()>num-1) {
|
|
|
+ CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
+ CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【" + num + "】", PieceActivity.this,
|
|
|
+ barcode, null, null);
|
|
|
+ ProcessDialogUtils.closeProgressDilog();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+// else {
|
|
|
+// CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
+// CommonUtil.showBarCodeAlertDialog(0, "未达到装板数量【" + num + "】", PieceActivity.this,
|
|
|
+// barcode, null, null);
|
|
|
+// ProcessDialogUtils.closeProgressDilog();
|
|
|
+// return;
|
|
|
+// }
|
|
|
+
|
|
|
+ }
|
|
|
ProcessDialogUtils.showProcessDialog(PieceActivity.this);
|
|
|
thread = null;
|
|
|
thread = new HandlerThread("BarCoderThread", 5);
|
|
|
@@ -985,6 +1046,7 @@ public class PieceActivity extends Activity {
|
|
|
}
|
|
|
break;
|
|
|
// 王英杰 2021年11月22日end。。。。。。。。
|
|
|
+ /**李士越 2025-05校验托盘下有没有产品未交接的*/
|
|
|
case 2:
|
|
|
try {
|
|
|
Bundle b5 = msg.getData();
|
|
|
@@ -1000,6 +1062,35 @@ public class PieceActivity extends Activity {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
break;
|
|
|
+ /**李士越2025-05 获取装板数量*/
|
|
|
+ case 3:
|
|
|
+ try {
|
|
|
+ Bundle b6 = msg.getData();
|
|
|
+ String result6 = b6.getString("sumResult");
|
|
|
+ JSONObject jo = new JSONObject(result6);
|
|
|
+ JSONObject jobj = jo.optJSONObject("d");
|
|
|
+ String result3 = jobj.optString("Result");
|
|
|
+ JSONArray resultArray = new JSONArray(result3);
|
|
|
+ if(resultArray!=null) {
|
|
|
+ carBrandList = new ArrayList<CarBrandModel>();
|
|
|
+ for (int i = 0; i < resultArray.length(); i++) {
|
|
|
+ JSONObject resultObj = (JSONObject) resultArray.opt(i);
|
|
|
+ int dictionaryId = resultObj.optInt("DICTIONARYID");
|
|
|
+ String dictionaryValue = resultObj.optString("DICTIONARYVALUE");
|
|
|
+ CarBrandModel carBrandModel = new CarBrandModel();
|
|
|
+ carBrandModel.setCarBrandId(String.valueOf(dictionaryId));
|
|
|
+ carBrandModel.setCarBrandName(dictionaryValue);
|
|
|
+ carBrandList.add(carBrandModel);
|
|
|
+ }
|
|
|
+
|
|
|
+ carBrandAdapter = new CarBrandSpinnerAdapter(PieceActivity.this, carBrandList);
|
|
|
+ trademarksource.setAdapter(carBrandAdapter);
|
|
|
+ }
|
|
|
+
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ break;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
@@ -2843,7 +2934,7 @@ public class PieceActivity extends Activity {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- if (collectType == 1 && nodeType == 3) {
|
|
|
+ if (collectType == 1 && nodeType == 3&&proId!=159) {
|
|
|
if (plateNum > 0 && piecelist.size() == plateNum) {
|
|
|
CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【" + plateNum + "】", PieceActivity.this,
|
|
|
@@ -2936,7 +3027,7 @@ public class PieceActivity extends Activity {
|
|
|
CustomToast.showToast(getApplicationContext(), "没有可提交的明细信息", 2000);
|
|
|
return true;
|
|
|
}
|
|
|
- if (collectType == 1 && nodeType == 3) {
|
|
|
+ if (collectType == 1 && nodeType == 3&&proId!=159) {
|
|
|
if (plateNum > 0 && piecelist.size() != plateNum) {
|
|
|
CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
CommonUtil.showBarCodeAlertDialog(0, "未达到装板数量【" + plateNum + "】", PieceActivity.this,
|
|
|
@@ -3005,7 +3096,7 @@ public class PieceActivity extends Activity {
|
|
|
Toast.makeText(getApplicationContext(), "没有可提交的明细信息", Toast.LENGTH_SHORT).show();
|
|
|
return true;
|
|
|
}
|
|
|
- if (collectType == 1 && nodeType == 3) {
|
|
|
+ if (collectType == 1 && nodeType == 3&&proId!=159) {
|
|
|
if (plateNum > 0 && piecelist.size() != plateNum) {
|
|
|
CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
CommonUtil.showBarCodeAlertDialog(0, "未达到装板数量【" + plateNum + "】", PieceActivity.this,
|
|
|
@@ -3013,6 +3104,28 @@ public class PieceActivity extends Activity {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
+ if (collectType == 1 && nodeType == 3 &&proId==159) {
|
|
|
+ CarBrandModel carbrandModel = (CarBrandModel) trademarksource.getSelectedItem();
|
|
|
+
|
|
|
+ String zhuangbanshuliang=carbrandModel.getCarBrandName();
|
|
|
+
|
|
|
+ int num=Integer.parseInt(zhuangbanshuliang);
|
|
|
+ if( piecelist.size()>num-1) {
|
|
|
+ CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
+ CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【" + num + "】", PieceActivity.this,
|
|
|
+ barcode, null, null);
|
|
|
+ ProcessDialogUtils.closeProgressDilog();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+// else {
|
|
|
+// CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
+// CommonUtil.showBarCodeAlertDialog(0, "未达到装板数量【" + num + "】", PieceActivity.this,
|
|
|
+// barcode, null, null);
|
|
|
+// ProcessDialogUtils.closeProgressDilog();
|
|
|
+// return true;
|
|
|
+// }
|
|
|
+
|
|
|
+ }
|
|
|
if (isGlazeChange == 1) {
|
|
|
Intent intent = new Intent();
|
|
|
intent.setClass(PieceActivity.this, GlazePieceSetActivity.class);
|
|
|
@@ -3108,4 +3221,50 @@ public class PieceActivity extends Activity {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+/**获取装板数量*/
|
|
|
+ public void getsum( ) {
|
|
|
+ thread = null;
|
|
|
+ thread = new HandlerThread("SavePieceThread", 5);
|
|
|
+ thread.start();
|
|
|
+ mHandler = new Handler(thread.getLooper());
|
|
|
+ Togetsum getsum=new Togetsum();
|
|
|
+ mHandler.post(getsum);
|
|
|
+ }
|
|
|
+ private class Togetsum implements Runnable {
|
|
|
+ public Togetsum() {
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ try {
|
|
|
+ client = null;
|
|
|
+ client = new WebClient();
|
|
|
+ JSONObject js = new JSONObject();
|
|
|
+ js.put("accountCode", accountCode);
|
|
|
+ js.put("userCode", piece_userCode);
|
|
|
+ js.put("userPassword", userPassword);
|
|
|
+ js.put("sessionKey", sessionKey);
|
|
|
+ js.put("dicType", "TPC030");
|
|
|
+ String result = client.doPost("http://"+ ServerAddress_ip + ":" + ServerAddress_duankou +"/DKService/PDAModuleService/GetDataDictionaryByType",
|
|
|
+ js.toString(), "application/json");
|
|
|
+ Message m = new Message();
|
|
|
+ m.what = 3;
|
|
|
+ Bundle b = new Bundle();
|
|
|
+ b.putString("sumResult", result);
|
|
|
+ m.setData(b);
|
|
|
+ handler1.sendMessage(m);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ Message m = new Message();
|
|
|
+ Bundle b = new Bundle();
|
|
|
+ b.putString("message", "网络连接异常");
|
|
|
+ m.setData(b);
|
|
|
+ m.what = 1;
|
|
|
+ exceptionHandler.sendMessage(m);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
}
|