增加 - 返修统计数量

master
wangh 2 years ago
parent 3febefc900
commit 9518165a04

@ -148,7 +148,7 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
public void checkSubmint1(View view) {
sanInfo("B24031383025017990002");
sanInfo("B24031483025025351528");
} // 提交
public void checkSubmint(View view) {
if (checkViewModel.getName() == null || checkViewModel.getName().isEmpty()) return;
@ -172,6 +172,7 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
checkViewModel.setButtonVisbleState(false);
submitList.clear();
checkAdapter.notifyDataSetChanged();
initStationSum();
} else {
Toast.makeText(CheckActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
}

@ -74,6 +74,7 @@ public class HomePageActivity extends AppCompatActivity {
intent = new Intent(this, RepairActivity.class);
intent.putExtra("userPermission", infoBeen.getUserPermission());
intent.putExtra("stationName", stationName);
intent.putExtra("stationCode", stationCode);
startActivity(intent);
});
binding.homeButton4.setOnClickListener(v -> {

@ -133,7 +133,7 @@ public class MainActivity extends BaseActivity {
public void login(View view) {
if (!loginState) {
Toast.makeText(this, "设备未注册,不允许登录", Toast.LENGTH_SHORT).show();
return;
// return;
}
String teamCode = user.getTeamCode();
if (teamCode==null||teamCode.isEmpty()) return;

@ -11,6 +11,7 @@ import android.widget.Toast;
import com.example.aucma_mes.adapter.RepairAdapter;
import com.example.aucma_mes.base.BaseActivity;
import com.example.aucma_mes.databinding.ActivityRepairBinding;
import com.example.aucma_mes.entity.CheckSum;
import com.example.aucma_mes.entity.DefectBeen;
import com.example.aucma_mes.entity.RepairSubmitInfo;
import com.example.aucma_mes.entity.RepairMeasures;
@ -43,14 +44,14 @@ public class RepairActivity extends BaseActivity {
binding = DataBindingUtil.setContentView(this, R.layout.activity_repair);
adapter = new RepairAdapter(this);
repairVm = new RepairVm();
binding.setTitle("质量返修 — "+getIntent().getStringExtra("stationName"));
binding.setTitle("质量返修 — " + getIntent().getStringExtra("stationName"));
binding.setVm(repairVm);
submitList = new ArrayList<>();
binding.recyclerView.setAdapter(adapter);
//查询返修措施
// 查询返修措施
OkGo.<Result>get(url + "/report/repairMeasures/getRepairMeasures").tag(this)
.headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
.params("userPermission",getIntent().getIntExtra("userPermission",-1))
.params("userPermission", getIntent().getIntExtra("userPermission", -1))
.execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<Result> response) {
@ -65,6 +66,35 @@ public class RepairActivity extends BaseActivity {
}
}
});
checkSum = new CheckSum();
stationCode = getIntent().getStringExtra("stationCode");
binding.setSum(checkSum);
initStationSum();
}
private CheckSum checkSum;
private String stationCode;
private void initStationSum() {
OkGo.<Result>post(url + "/api/pdaQueryQuantityNumber").tag(this)
.headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
.params("stationCode", stationCode).execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<Result> response) {
super.onSuccess(response);
Result result = response.body();
if (result.getCode() == 200) {
var data = result.getData();
if (data != null) {
CheckSum checkSum1 = gson.fromJson(data.toString(), CheckSum.class);
checkSum.setQUANTITY_SUM(checkSum1.getQUANTITY_SUM());
checkSum.setREPAIR_SUM(checkSum1.getREPAIR_SUM());
}
}
}
});
}
@Override
@ -81,14 +111,13 @@ public class RepairActivity extends BaseActivity {
if (result.getCode() == 200) {
defectBeens = gson.fromJson(gson.toJson(result.getData()), new TypeToken<List<DefectBeen>>() {
}.getType());
Log.e("TAG", "onSuccess:" + defectBeens.toString());
Log.e("TAG", "onSuccess:" + defectBeens.toString());
defectBeens.forEach(t -> submitList.add(t.getObjId()));
adapter.setList(defectBeens);
adapter.notifyDataSetChanged();
repairVm.setMaterialName(defectBeens.get(0).getMaterialName());
} else {
Toast.makeText(RepairActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
repairSubmit(null);
}
}
});
@ -96,11 +125,11 @@ public class RepairActivity extends BaseActivity {
public void repairSubmit(View view) {
if (submitList.isEmpty()) return;
RepairSubmitInfo repairSubmitInfo =new RepairSubmitInfo(submitList,
RepairSubmitInfo repairSubmitInfo = new RepairSubmitInfo(submitList,
SharedPreferencesUtils.getstring("loginName", "pda01")
,repairVm.getRepairName(),repairVm.getIsFlag());
, repairVm.getRepairName(), repairVm.getIsFlag());
MediaType JSON = MediaType.parse("application/json; charset=utf-8");
RequestBody body = RequestBody.create(JSON,gson.toJson(repairSubmitInfo) );
RequestBody body = RequestBody.create(JSON, gson.toJson(repairSubmitInfo));
OkGo.<Result>post(url + "/api/submitRepair")
.tag(this).headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
.upRequestBody(body)
@ -110,12 +139,13 @@ public class RepairActivity extends BaseActivity {
super.onSuccess(response);
Result result = response.body();
Toast.makeText(RepairActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
if (result.getCode()==200){
if (result.getCode() == 200) {
defectBeens.clear();
adapter.notifyDataSetChanged();
repairVm.setCode(null);
repairVm.setMaterialName(null);
submitList.clear();
initStationSum();
}
}
});

@ -50,21 +50,25 @@ public class RepaitSubmintInfoAdapter extends RecyclerView.Adapter<RepaitSubmint
DefectBeen defectBeen = list.get(position);
defectBeen.setIndex(position + 1);
ItemRepairInfoBinding databing = holder.getInflate1();
databing.setVariable(BR.item, defectBeen);
String processResult = defectBeen.getProcessResult();
if (processResult.equals("放行")){
databing.itemLinear.setBackgroundColor(context.getResources().getColor(R.color.yellow));
}else if (processResult.equals("KA")){
databing.itemLinear.setBackgroundColor(context.getResources().getColor(R.color.red));
}else {
defectBeen.setProcessResult("样品机");
}else if (processResult.equals("未完成")){
databing.itemLinear.setBackgroundColor(context.getResources().getColor(R.color.item1));
}else {
defectBeen.setProcessResult("下返修");
databing.itemLinear.setBackgroundColor(context.getResources().getColor(R.color.item1));
}
if (!processResult.equals("未完成")){
databing.itemButtom.setOnClickListener(t -> {
checkItemClickCall.submintRepair(position);
});
}
databing.setVariable(BR.item, defectBeen);
databing.executePendingBindings();
}

@ -26,8 +26,8 @@ import okhttp3.MediaType;
public abstract class BaseActivity extends AppCompatActivity {
private MyBroad receiver;
// public static String url="http://192.168.137.1:8080";
public static String url="http://10.100.72.10:8080";
public static String url="http://192.168.137.1:8080";
// public static String url="http://10.100.72.10:8080";
public ProgressDialog dialog;
public Gson gson;
public MediaType JSON = MediaType.parse("application/json; charset=utf-8");

@ -11,6 +11,9 @@
<variable
name="title"
type="String" />
<variable
name="sum"
type="com.example.aucma_mes.entity.CheckSum" />
</data>
<LinearLayout
@ -33,7 +36,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_marginTop="12dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="4dp">
<TextView
@ -53,7 +56,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_marginTop="5dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="4dp">
<TextView
@ -69,7 +72,49 @@
android:text="@={vm.materialName}" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="当班检测数据"
android:textColor="@color/blue" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="38dp"
android:layout_marginEnd="4dp"
android:background="@color/white"
android:orientation="horizontal">
<TextView
style="@style/text_style1"
android:layout_width="100dp"
android:layout_height="match_parent"
android:background="@color/grey"
android:text="已检测数量:" />
<TextView
style="@style/text_style1_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@{String.valueOf(sum.QUANTITY_SUM)}" />
<TextView
style="@style/text_style1"
android:layout_width="80dp"
android:layout_height="match_parent"
android:background="@color/grey"
android:text="返修数量:" />
<TextView
style="@style/text_style1_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@{String.valueOf(sum.REPAIR_SUM)}" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="20dp"
@ -79,14 +124,14 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="215dp"
android:layout_height="175dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:background="@color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_marginTop="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="4dp"
android:background="@color/white"
android:orientation="horizontal">
@ -114,7 +159,7 @@
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginStart="20dp"
android:layout_marginTop="12dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="20dp"
android:onClick="repairSubmit"
android:text="提交" />

@ -67,7 +67,7 @@
style="@style/item_text_style"
android:layout_width="50dp"
android:layout_height="match_parent"
android:text='@{item.processResult.equals("未完成")?"未完成":"下返修"}'
android:text='@{item.processResult}'
android:textSize="15sp"
android:textColor="#E71717" />

Loading…
Cancel
Save