增加 - 返修统计数量

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) { public void checkSubmint1(View view) {
sanInfo("B24031383025017990002"); sanInfo("B24031483025025351528");
} // 提交 } // 提交
public void checkSubmint(View view) { public void checkSubmint(View view) {
if (checkViewModel.getName() == null || checkViewModel.getName().isEmpty()) return; if (checkViewModel.getName() == null || checkViewModel.getName().isEmpty()) return;
@ -172,6 +172,7 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
checkViewModel.setButtonVisbleState(false); checkViewModel.setButtonVisbleState(false);
submitList.clear(); submitList.clear();
checkAdapter.notifyDataSetChanged(); checkAdapter.notifyDataSetChanged();
initStationSum();
} else { } else {
Toast.makeText(CheckActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show(); 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 = new Intent(this, RepairActivity.class);
intent.putExtra("userPermission", infoBeen.getUserPermission()); intent.putExtra("userPermission", infoBeen.getUserPermission());
intent.putExtra("stationName", stationName); intent.putExtra("stationName", stationName);
intent.putExtra("stationCode", stationCode);
startActivity(intent); startActivity(intent);
}); });
binding.homeButton4.setOnClickListener(v -> { binding.homeButton4.setOnClickListener(v -> {

@ -133,7 +133,7 @@ public class MainActivity extends BaseActivity {
public void login(View view) { public void login(View view) {
if (!loginState) { if (!loginState) {
Toast.makeText(this, "设备未注册,不允许登录", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "设备未注册,不允许登录", Toast.LENGTH_SHORT).show();
return; // return;
} }
String teamCode = user.getTeamCode(); String teamCode = user.getTeamCode();
if (teamCode==null||teamCode.isEmpty()) return; 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.adapter.RepairAdapter;
import com.example.aucma_mes.base.BaseActivity; import com.example.aucma_mes.base.BaseActivity;
import com.example.aucma_mes.databinding.ActivityRepairBinding; 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.DefectBeen;
import com.example.aucma_mes.entity.RepairSubmitInfo; import com.example.aucma_mes.entity.RepairSubmitInfo;
import com.example.aucma_mes.entity.RepairMeasures; import com.example.aucma_mes.entity.RepairMeasures;
@ -43,14 +44,14 @@ public class RepairActivity extends BaseActivity {
binding = DataBindingUtil.setContentView(this, R.layout.activity_repair); binding = DataBindingUtil.setContentView(this, R.layout.activity_repair);
adapter = new RepairAdapter(this); adapter = new RepairAdapter(this);
repairVm = new RepairVm(); repairVm = new RepairVm();
binding.setTitle("质量返修 — "+getIntent().getStringExtra("stationName")); binding.setTitle("质量返修 — " + getIntent().getStringExtra("stationName"));
binding.setVm(repairVm); binding.setVm(repairVm);
submitList = new ArrayList<>(); submitList = new ArrayList<>();
binding.recyclerView.setAdapter(adapter); binding.recyclerView.setAdapter(adapter);
//查询返修措施 // 查询返修措施
OkGo.<Result>get(url + "/report/repairMeasures/getRepairMeasures").tag(this) OkGo.<Result>get(url + "/report/repairMeasures/getRepairMeasures").tag(this)
.headers("Authorization", SharedPreferencesUtils.getstring("token", "")) .headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
.params("userPermission",getIntent().getIntExtra("userPermission",-1)) .params("userPermission", getIntent().getIntExtra("userPermission", -1))
.execute(new MyRecultCall(dialog, this) { .execute(new MyRecultCall(dialog, this) {
@Override @Override
public void onSuccess(Response<Result> response) { 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 @Override
@ -88,7 +118,6 @@ public class RepairActivity extends BaseActivity {
repairVm.setMaterialName(defectBeens.get(0).getMaterialName()); repairVm.setMaterialName(defectBeens.get(0).getMaterialName());
} else { } else {
Toast.makeText(RepairActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show(); 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) { public void repairSubmit(View view) {
if (submitList.isEmpty()) return; if (submitList.isEmpty()) return;
RepairSubmitInfo repairSubmitInfo =new RepairSubmitInfo(submitList, RepairSubmitInfo repairSubmitInfo = new RepairSubmitInfo(submitList,
SharedPreferencesUtils.getstring("loginName", "pda01") SharedPreferencesUtils.getstring("loginName", "pda01")
,repairVm.getRepairName(),repairVm.getIsFlag()); , repairVm.getRepairName(), repairVm.getIsFlag());
MediaType JSON = MediaType.parse("application/json; charset=utf-8"); 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") OkGo.<Result>post(url + "/api/submitRepair")
.tag(this).headers("Authorization", SharedPreferencesUtils.getstring("token", "")) .tag(this).headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
.upRequestBody(body) .upRequestBody(body)
@ -110,12 +139,13 @@ public class RepairActivity extends BaseActivity {
super.onSuccess(response); super.onSuccess(response);
Result result = response.body(); Result result = response.body();
Toast.makeText(RepairActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show(); Toast.makeText(RepairActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
if (result.getCode()==200){ if (result.getCode() == 200) {
defectBeens.clear(); defectBeens.clear();
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
repairVm.setCode(null); repairVm.setCode(null);
repairVm.setMaterialName(null); repairVm.setMaterialName(null);
submitList.clear(); submitList.clear();
initStationSum();
} }
} }
}); });

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

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

@ -11,6 +11,9 @@
<variable <variable
name="title" name="title"
type="String" /> type="String" />
<variable
name="sum"
type="com.example.aucma_mes.entity.CheckSum" />
</data> </data>
<LinearLayout <LinearLayout
@ -33,7 +36,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="43dp" android:layout_height="43dp"
android:layout_marginTop="12dp" android:layout_marginTop="4dp"
android:layout_marginEnd="4dp"> android:layout_marginEnd="4dp">
<TextView <TextView
@ -53,7 +56,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="43dp" android:layout_height="43dp"
android:layout_marginTop="5dp" android:layout_marginTop="4dp"
android:layout_marginEnd="4dp"> android:layout_marginEnd="4dp">
<TextView <TextView
@ -69,7 +72,49 @@
android:text="@={vm.materialName}" /> android:text="@={vm.materialName}" />
</LinearLayout> </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 <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="20dp" android:layout_height="20dp"
@ -79,14 +124,14 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView" android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="215dp" android:layout_height="175dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:background="@color/white" /> android:background="@color/white" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="43dp" android:layout_height="43dp"
android:layout_marginTop="8dp" android:layout_marginTop="4dp"
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:background="@color/white" android:background="@color/white"
android:orientation="horizontal"> android:orientation="horizontal">
@ -114,7 +159,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="45dp" android:layout_height="45dp"
android:layout_marginStart="20dp" android:layout_marginStart="20dp"
android:layout_marginTop="12dp" android:layout_marginTop="8dp"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
android:onClick="repairSubmit" android:onClick="repairSubmit"
android:text="提交" /> android:text="提交" />

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

Loading…
Cancel
Save