@@ -4,10 +4,10 @@ | |||
<selectionStates> | |||
<SelectionState runConfigName="app"> | |||
<option name="selectionMode" value="DROPDOWN" /> | |||
<DropdownSelection timestamp="2024-05-30T07:26:51.182873700Z"> | |||
<DropdownSelection timestamp="2024-05-31T01:56:05.992353200Z"> | |||
<Target type="DEFAULT_BOOT"> | |||
<handle> | |||
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=c8bf86d2" /> | |||
<DeviceId pluginId="Default" identifier="serial=10.24.61.116:5555;connection=ddfc653b" /> | |||
</handle> | |||
</Target> | |||
</DropdownSelection> | |||
@@ -38,6 +38,30 @@ public class ProcessValueUtil { | |||
return stringBuffer.toString(); | |||
} | |||
public static String dealProcessSms(String value){ | |||
StringBuilder stringBuffer = new StringBuilder(); | |||
stringBuffer.append("("); | |||
if(value.contains("|")){ | |||
String[] res = value.split("\\|"); | |||
for(String s:res){ | |||
if(s.contains(",")){ | |||
String[] res2 = s.split(","); | |||
stringBuffer.append(res2[1]).append(","); | |||
}else { | |||
stringBuffer.append(s).append(","); | |||
} | |||
} | |||
}else { | |||
if(value.contains(",")){ | |||
String[] res2 = value.split(","); | |||
stringBuffer.append(res2[1]).append(","); | |||
}else { | |||
stringBuffer.append(value).append(","); | |||
} | |||
} | |||
return stringBuffer.toString().substring(0,stringBuffer.length()-1)+")"; | |||
} | |||
public static HashMap<String,String> dealProcessValueToJson(String value){ | |||
HashMap<String,String> map = new HashMap<>(); | |||
if (value.contains("|")) { | |||
@@ -11,6 +11,7 @@ import com.bonait.bnframework.HBL.Logs.MessageLog; | |||
import com.bonait.bnframework.HBL.Result.OperateResultT; | |||
import com.bonait.bnframework.HBL.Thread.ThreadManager; | |||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||
import com.bonait.bnframework.business.NewExecuteTheRecipe; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
@@ -382,14 +383,14 @@ public class ModbusHelper extends ModbusMaster { | |||
*/ | |||
public boolean readUpdDownStop(int status){ | |||
if(status == 2){ | |||
NewToastUtil.getInstance().showToast("工序: 搅拌爪正在下降"); | |||
// NewToastUtil.getInstance().showToast("工序: 搅拌爪正在下降"); | |||
OperateResultT<Boolean> resultT = ReadBool(getPLC(ControlAdress.下降).PlcAddress); | |||
if(resultT == null){ | |||
return false; | |||
} | |||
return resultT.Content != null && resultT.Content; | |||
}else { | |||
NewToastUtil.getInstance().showToast("工序: 搅拌爪正在上升"); | |||
// NewToastUtil.getInstance().showToast("工序: 搅拌爪正在上升"); | |||
OperateResultT<Boolean> resultT = ReadBool(getPLC(ControlAdress.上升).PlcAddress); | |||
if(resultT == null){ | |||
return false; | |||
@@ -439,11 +440,10 @@ public class ModbusHelper extends ModbusMaster { | |||
* 搅拌停止 | |||
*/ | |||
public boolean setStirStop(){ | |||
OperateResultT<Boolean> resultT = ReadBool(getPLC(ControlAdress.搅拌模式).PlcAddress); | |||
OperateResultT<Boolean> resultT = ReadBool(getPLC(ControlAdress.搅拌停止).PlcAddress); | |||
if(resultT == null){ | |||
return false; | |||
} | |||
// LogUtils.d(TAG+"搅拌模式 setStirStop "); | |||
return resultT.Content != null && resultT.Content; | |||
} | |||
@@ -514,19 +514,30 @@ public class ModbusHelper extends ModbusMaster { | |||
public void reset(){ | |||
try { | |||
NewToastUtil.getInstance().showToast("正在复位"); | |||
Heating(0,false); | |||
setStirMotor(0,2); | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
boolean stirStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop){ | |||
while (stirStop){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false:setStirStop(); | |||
stirStop = ConfigName.TEST?false:setStirStop(); | |||
Thread.sleep(10); | |||
} | |||
setUpdDownMotor(1); | |||
long t = System.currentTimeMillis(); | |||
boolean upStop = true; | |||
while (upStop && !hasErrorInfo()){ | |||
if(System.currentTimeMillis() - t > 30*1000){ | |||
break; | |||
} | |||
upStop = ConfigName.TEST?false: ModbusHelper.get().readUpdDownStop(1); | |||
Thread.sleep(10); | |||
} | |||
setCookStatus(false); | |||
NewToastUtil.getInstance().showToast("完成复位"); | |||
} catch (InterruptedException e) { | |||
throw new RuntimeException(e); | |||
} | |||
@@ -654,6 +665,9 @@ public class ModbusHelper extends ModbusMaster { | |||
upDownError = ModbusHelper.get().getUpDownError(); | |||
downError = ModbusHelper.get().getDownError(); | |||
stirError = ModbusHelper.get().getStirError(); | |||
if(isBtnStop||upError||upDownError||downError||stirError){ | |||
NewExecuteTheRecipe.IsStart =false; | |||
} | |||
Thread.sleep(ConfigName.TEST?500:200); | |||
}); | |||
} | |||
@@ -167,7 +167,7 @@ public class NewExecuteTheRecipe { | |||
} | |||
} | |||
isCHeckSilosEnd = isEnd; | |||
Thread.sleep(50); | |||
Thread.sleep(10); | |||
} | |||
} | |||
if(isTest&& IsStart){ | |||
@@ -334,7 +334,6 @@ public class NewExecuteTheRecipe { | |||
if(!isTest){ | |||
ModbusHelper.get().setStirMotor(0,2); | |||
} | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (IsStart&&isStop && !isTest){ | |||
@@ -342,7 +341,7 @@ public class NewExecuteTheRecipe { | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | |||
Thread.sleep(50); | |||
Thread.sleep(10); | |||
} | |||
if(isTest && IsStart){ | |||
Thread.sleep(1000); | |||
@@ -414,7 +413,6 @@ public class NewExecuteTheRecipe { | |||
if(!isTest){ | |||
ModbusHelper.get().setStirMotor(0,2); | |||
} | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (IsStart&&isStop &&!isTest){ | |||
@@ -422,7 +420,7 @@ public class NewExecuteTheRecipe { | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | |||
Thread.sleep(50); | |||
Thread.sleep(10); | |||
} | |||
if(IsStart && isTest){ | |||
Thread.sleep(1000); | |||
@@ -482,7 +480,7 @@ public class NewExecuteTheRecipe { | |||
break; | |||
}else { | |||
isCHeckSilosEnd= ConfigName.TEST?true:Read_MainFood(position); | |||
Thread.sleep(50); | |||
Thread.sleep(10); | |||
} | |||
} | |||
if(IsStart && isTest){ | |||
@@ -601,7 +599,7 @@ public class NewExecuteTheRecipe { | |||
break; | |||
}else { | |||
isCHeckSilosEnd = !Read_Water(); | |||
Thread.sleep(100); | |||
Thread.sleep(10); | |||
} | |||
} | |||
if(IsStart && isTest){ | |||
@@ -680,7 +678,6 @@ public class NewExecuteTheRecipe { | |||
} | |||
ModbusHelper.get().Heating(0,false); | |||
ModbusHelper.get().setStirMotor(0,2); | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (IsStart && isStop){ | |||
@@ -688,7 +685,7 @@ public class NewExecuteTheRecipe { | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false: ModbusHelper.get().setStirStop(); | |||
Thread.sleep(100); | |||
Thread.sleep(10); | |||
} | |||
ModbusHelper.get().setUpdDownMotor(1); | |||
ModbusHelper.get().setCookStatus(false); | |||
@@ -727,7 +724,7 @@ public class NewExecuteTheRecipe { | |||
break; | |||
}else { | |||
isCHeckSilosEnd = !Read_ThickenWater(); | |||
Thread.sleep(100); | |||
Thread.sleep(10); | |||
} | |||
} | |||
if(IsStart && isTest){ | |||
@@ -780,7 +777,18 @@ public class NewExecuteTheRecipe { | |||
if(!isTest){ | |||
ModbusHelper.get().setUpdDownMotor(1); | |||
} | |||
Thread.sleep(50); | |||
ModbusHelper.get().setStirMotor(0,2); | |||
boolean stirStop = true; | |||
long t = System.currentTimeMillis(); | |||
while (stirStop){ | |||
if(System.currentTimeMillis() - t > 30*1000){ | |||
break; | |||
} | |||
stirStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | |||
Thread.sleep(10); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(4,"停止搅拌")); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (IsStart && isStop&&!isTest){ | |||
@@ -788,10 +796,10 @@ public class NewExecuteTheRecipe { | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false: ModbusHelper.get().readUpdDownStop(1); | |||
Thread.sleep(100); | |||
Thread.sleep(10); | |||
} | |||
if(IsStart && isTest){ | |||
for(int i = 0;i<16 ;i++){ | |||
for(int i = 0;i<8 ;i++){ | |||
if(!IsStart){ | |||
break; | |||
} | |||
@@ -804,7 +812,6 @@ public class NewExecuteTheRecipe { | |||
if(!isTest){ | |||
ModbusHelper.get().setUpdDownMotor(2); | |||
} | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (IsStart && isStop && !isTest){ | |||
@@ -812,10 +819,10 @@ public class NewExecuteTheRecipe { | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false: ModbusHelper.get().readUpdDownStop(2); | |||
Thread.sleep(100); | |||
Thread.sleep(10); | |||
} | |||
if(IsStart && isTest){ | |||
for(int i = 0;i<16 ;i++){ | |||
for(int i = 0;i<8 ;i++){ | |||
if(!IsStart){ | |||
break; | |||
} | |||
@@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentHashMap; | |||
*/ | |||
public class ConfigName { | |||
//是否是测试模式 | |||
public final static boolean TEST = true; | |||
public final static boolean TEST = false; | |||
//日志打印 | |||
public final static boolean LOG_TEST = false; | |||
//region 单例模式 | |||
@@ -104,6 +104,7 @@ public class GlideUtil { | |||
return false; | |||
} | |||
}) | |||
.placeholder(placeId) | |||
.transition(DrawableTransitionOptions.withCrossFade(CROSS_FADE_DURATION)) | |||
// .apply(RequestOptions.bitmapTransform(new RoundedCorners(RADIUS))) | |||
.apply(new RequestOptions().transform(new FitXYRoundRadiusTransform(DimensUtil.getDimens(radius)))) | |||
@@ -181,11 +181,6 @@ public class CookingActivity extends BaseActivity { | |||
* 复位 | |||
*/ | |||
private void setReset() { | |||
if(!isTest){ | |||
ThreadManager.get().execute(new Thread(()->{ | |||
ModbusHelper.get().reset(); | |||
})); | |||
} | |||
stepAdapter.setCurrentPosition(-1); | |||
stepAdapter.notifyDataSetChanged(); | |||
@@ -236,6 +231,7 @@ public class CookingActivity extends BaseActivity { | |||
private void startMakingThread(){ | |||
ThreadManager.get().execute(new Thread(()->{ | |||
if (NewExecuteTheRecipe.IsStart && goodsSubattributeGroup != null) { | |||
ModbusHelper.get().reset(); | |||
long startTime= System.currentTimeMillis(); //起始时间 | |||
boolean isError = false; | |||
try { | |||
@@ -286,14 +282,16 @@ public class CookingActivity extends BaseActivity { | |||
NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage()); | |||
} finally { | |||
isMaking = false; | |||
NewExecuteTheRecipe.IsStart = false; | |||
if (!NewExecuteTheRecipe.IsForcedEnd && !isError && !isTest){ | |||
if (!NewExecuteTheRecipe.IsForcedEnd && !ModbusHelper.get().hasErrorInfo() && NewExecuteTheRecipe.IsStart && !isTest){ | |||
long endTime = System.currentTimeMillis(); //结束时间 | |||
int time=(int) ((endTime-startTime)/1000); | |||
LogUtils.d("运行时长 "+String.format("方法使用时间 %d s",time)); | |||
SubAttributeGroupDBUtil.updateMakeTime(goodsSubattributeGroup.id,time); | |||
goodsSubattributeGroup.maketime = time; | |||
} | |||
NewExecuteTheRecipe.IsStart = false; | |||
ModbusHelper.get().reset(); | |||
boolean finalIsError = isError; | |||
if(handler!=null){ | |||
handler.post(new Runnable() { | |||
@@ -246,6 +246,9 @@ public class DiyProcessActivity extends BaseActivity { | |||
viewBinding.btnInsertDown.setOnClickListener(view -> { | |||
insertDownProcess(); | |||
}); | |||
/** | |||
*导入工序 | |||
*/ | |||
viewBinding.btnCopyProcess.setOnClickListener(view -> { | |||
if(attributeSelectDialog == null){ | |||
attributeSelectDialog = new AttributeSelectDialog(); | |||
@@ -259,6 +262,7 @@ public class DiyProcessActivity extends BaseActivity { | |||
public void submit() { | |||
processDetails.clear(); | |||
processDetails = GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId); | |||
changeMainFoods(); | |||
stepAdapter.setCurrentPosition(0); | |||
stepAdapter.setNewData(processDetails); | |||
if(!processDetails.isEmpty()){ | |||
@@ -610,6 +614,68 @@ public class DiyProcessActivity extends BaseActivity { | |||
} | |||
} | |||
private void changeMainFoods(){ | |||
mainFoods.clear(); | |||
String main1 = ""; | |||
String main2 = ""; | |||
String main3 = ""; | |||
String main4 = ""; | |||
String main5 = ""; | |||
String main6 = ""; | |||
if(!processDetails.isEmpty()){ | |||
for(BPA_GOODS_PROCESS_DETAIL bean:processDetails ){ | |||
String processname = bean.processname; | |||
if(processname.contains("主料")){ | |||
String processvalue = bean.processvalue; | |||
if(!processvalue.isEmpty()){ | |||
HashMap<String,String> params = ProcessValueUtil.dealProcessValue(processvalue); | |||
if(!params.isEmpty()){ | |||
int position = -1;//几号位 | |||
String name = "";//主料名称 | |||
for (HashMap.Entry<String, String> entry : params.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if(key.contains("名称")){ | |||
name = value; | |||
}else if(key.contains("位置")){ | |||
position = Integer.parseInt(value.replace("号位","")); | |||
} | |||
} | |||
if(position>=0){ | |||
switch (position){ | |||
case 1: | |||
main1 = name; | |||
break; | |||
case 2: | |||
main2 = name; | |||
break; | |||
case 3: | |||
main3 = name; | |||
break; | |||
case 4: | |||
main4 = name; | |||
break; | |||
case 5: | |||
main5 = name; | |||
break; | |||
case 6: | |||
main6 = name; | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
mainFoods.add(main1); | |||
mainFoods.add(main2); | |||
mainFoods.add(main3); | |||
mainFoods.add(main4); | |||
mainFoods.add(main5); | |||
mainFoods.add(main6); | |||
} | |||
private boolean isFirst = true; | |||
@Override | |||
protected void onResume() { | |||
@@ -617,6 +683,7 @@ public class DiyProcessActivity extends BaseActivity { | |||
if(!isFirst){ | |||
processDetails.clear(); | |||
processDetails.addAll(GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId)); | |||
changeMainFoods(); | |||
stepAdapter.setCurrentPosition(0); | |||
stepAdapter.notifyDataSetChanged(); | |||
if(!processDetails.isEmpty()){ | |||
@@ -4,7 +4,7 @@ import android.content.Context; | |||
import android.graphics.Color; | |||
import android.os.Bundle; | |||
import android.view.View; | |||
import android.widget.FrameLayout; | |||
import android.widget.RelativeLayout; | |||
import androidx.annotation.Nullable; | |||
import androidx.core.content.ContextCompat; | |||
@@ -64,7 +64,7 @@ public class EditGoodsActivity extends BaseActivity { | |||
* 初始化TopBar | |||
*/ | |||
private void initTopBar() { | |||
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) viewBinding.frame.getLayoutParams(); | |||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) viewBinding.frame.getLayoutParams(); | |||
params.bottomMargin = 0; | |||
viewBinding.frame.setLayoutParams(params); | |||
viewBinding.topbar.setBackgroundColor(ContextCompat.getColor(this, R.color.topbj1)); | |||
@@ -349,6 +349,7 @@ public class RecProcessActivity extends BaseActivity { | |||
isUp=false; | |||
break; | |||
case "上升": | |||
viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
ConstraintLayout.LayoutParams params2 = (ConstraintLayout.LayoutParams) viewBinding.device.btnUpDown.getLayoutParams(); | |||
params2.topMargin = DimensUtil.getDimens(150); | |||
viewBinding.device.btnUpDown.setLayoutParams(params2); | |||
@@ -65,10 +65,10 @@ public class SelectAttributeListAdapter extends ArrayAdapter<BPA_ATTRIBUTE> { | |||
if(recyclerView.getAdapter()==null && position == subAttributeAdapters.size()){ | |||
List<BPA_SUBATTRIBUTE> subattributeList = SubAttributeDBUtil.getByParentAttributeId(bean.id); | |||
SelectSubAttributeAdapter adapter = new SelectSubAttributeAdapter(); | |||
adapter.setCurrentPosition(-1); | |||
adapter.setGroupIdList(groupIdList); | |||
adapter.setNewData(subattributeList); | |||
adapter.setListener(listener); | |||
adapter.setCurrentPosition(-1); | |||
recyclerView.setAdapter(adapter); | |||
LogUtils.d(" SelectAttributeListAdapter getView position="+position); | |||
if(position == subAttributeAdapters.size()){ | |||
@@ -8,6 +8,7 @@ import android.view.ViewGroup; | |||
import androidx.annotation.NonNull; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.common.base.BaseAdapter; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
@@ -45,18 +46,22 @@ public class SelectSubAttributeAdapter extends BaseAdapter<BPA_SUBATTRIBUTE,Sele | |||
DisplayManager.scaleViewGroup(holder.binding.getRoot()); | |||
} | |||
BPA_SUBATTRIBUTE subattribute = mData.get(position); | |||
if(groupIdList.contains("-")){ | |||
String[] res = groupIdList.split("-"); | |||
for(String s : res){ | |||
if(s.equals(subattribute.name)){ | |||
if(mCurrentPosition<0){ | |||
if(groupIdList.contains("-")){ | |||
String[] res = groupIdList.split("-"); | |||
for(String s : res){ | |||
if(s.equals(subattribute.name)){ | |||
mCurrentPosition = position; | |||
} | |||
} | |||
}else { | |||
if(subattribute.name.equals(groupIdList)){ | |||
mCurrentPosition = position; | |||
} | |||
} | |||
}else { | |||
if(subattribute.name.equals(groupIdList)){ | |||
mCurrentPosition = position; | |||
} | |||
} | |||
LogUtils.d(" groupIdList="+groupIdList +" subattribute="+subattribute.name +" mCurrentPosition="+mCurrentPosition); | |||
holder.binding.name.setText(subattribute.name+""); | |||
holder.binding.name.setSelected(mCurrentPosition == position); | |||
@@ -36,7 +36,7 @@ public abstract class CloudGoodsAdapter extends BaseAdapter<BPA_GOODS,CloudGoods | |||
@Override | |||
public void onBindViewHolder(@NonNull GoodsViewHolder holder, @SuppressLint("RecyclerView") int position) { | |||
try { | |||
if(holder.binding.name.getTextSize()>28||holder.binding.name.getTextSize()<24){ | |||
if(holder.binding.name.getTextSize()>34||holder.binding.name.getTextSize()<30){ | |||
DisplayManager.scaleViewGroup(holder.binding.getRoot()); | |||
} | |||
holder.binding.add.setVisibility(View.GONE); | |||
@@ -129,29 +129,23 @@ public class AttributeSelectDialog extends DialogFragment { | |||
dismiss(); | |||
}); | |||
viewBinding.btnSubmit.setOnClickListener(view -> { | |||
// if(hasGroup().isEmpty()){ | |||
// NewToastUtil.getInstance().showToast("请选择每行对应的子属性"); | |||
// } | |||
// if(!selectAttributeListAdapter.isAllSelected()){ | |||
// if(getContext()!=null){ | |||
// NewToastUtil.getInstance().showToast("请选择每行对应的子属性"); | |||
// } | |||
// return; | |||
// } | |||
BPA_GOODS_SUBATTRIBUTE_GROUP currentGroupBean = SubAttributeGroupDBUtil.getById(groupId); | |||
if(currentGroupBean!=null){ | |||
if(selectAttributeListAdapter.getSubAttributeIdList().equals(currentGroupBean.subAttributeIdList)){ | |||
NewToastUtil.getInstance().showToast("当前正在编辑此组合,无法导入"); | |||
return; | |||
} | |||
String hasId = hasGroup(); | |||
if(hasId.isEmpty()){ | |||
NewToastUtil.getInstance().showToast("未找到选中分组,无法导入"); | |||
return; | |||
} | |||
if(groupId.equals(hasId)){ | |||
NewToastUtil.getInstance().showToast("当前正在编辑此组合,无法导入"); | |||
return; | |||
} | |||
BPA_GOODS_SUBATTRIBUTE_GROUP group = SubAttributeGroupDBUtil.getByGoodIdAndListId(goodId,selectAttributeListAdapter.getSubAttributeIdList()); | |||
BPA_GOODS_SUBATTRIBUTE_GROUP group = SubAttributeGroupDBUtil.getById(hasId); | |||
if(group == null){ | |||
NewToastUtil.getInstance().showToast("还未创建该组合,无法导入"); | |||
return; | |||
} | |||
List<BPA_GOODS_PROCESS_DETAIL> list = GoodsProcessDetailDBUtil.getByGroupId(group.id); | |||
List<BPA_GOODS_PROCESS_DETAIL> list = new ArrayList<>(GoodsProcessDetailDBUtil.getByGroupId(group.id)); | |||
if(!list.isEmpty()){ | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity) getActivity(), R.layout.dialog_delete_classify, (layoutView, xCom) -> { | |||
DialogDeleteClassifyBinding binding = DialogDeleteClassifyBinding.bind(layoutView); | |||
@@ -164,6 +158,7 @@ public class AttributeSelectDialog extends DialogFragment { | |||
binding.submit.setOnClickListener(view1 -> { | |||
GoodsProcessDetailDBUtil.removeList(GoodsProcessDetailDBUtil.getByGroupId(groupId)); | |||
for (int i=0;i<list.size();i++){ | |||
list.get(i).id = java.util.UUID.randomUUID().toString(); | |||
list.get(i).goodsSubAttributeGroupId = groupId; | |||
list.get(i).sort = i+1; | |||
} | |||
@@ -510,17 +510,34 @@ public class DeviceControlDialog extends DialogFragment { | |||
detail.materialType = 1; | |||
detail.processvalue = "升降控制,下降|延迟(秒),0"; | |||
detail.processms = "升降(下降,0)"; | |||
deviceCallBack.onClickEvent(type,"下降",8000,detail); | |||
deviceCallBack.onClickEvent(type,"下降",5000,detail); | |||
}); | |||
viewBinding.layoutStir.btnStirUp.setOnClickListener(v->{ | |||
NewToastUtil.getInstance().showToast("电机上升"); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setUpdDownMotor(1))); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
try { | |||
NewToastUtil.getInstance().showToast("等待搅拌停止"); | |||
ModbusHelper.get().setStirMotor(0,2); | |||
boolean stirStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (stirStop){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
stirStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | |||
Thread.sleep(50); | |||
} | |||
NewToastUtil.getInstance().showToast("电机上升"); | |||
ModbusHelper.get().setUpdDownMotor(1); | |||
}catch (Exception e){ | |||
e.printStackTrace(); | |||
} | |||
})); | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "升降"; | |||
detail.materialType = 1; | |||
detail.processvalue = "升降控制,上升|延迟(秒),0"; | |||
detail.processms = "升降(上升,0)"; | |||
deviceCallBack.onClickEvent(type,"上升",8000,detail); | |||
deviceCallBack.onClickEvent(type,"上升",5000,detail); | |||
}); | |||
} | |||
@@ -236,6 +236,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
} | |||
} | |||
if (xx) { | |||
subattributeGroup = bean; | |||
groupId = bean.id; | |||
break; | |||
} | |||
@@ -288,16 +289,10 @@ public class EditGoodsDialog extends DialogFragment { | |||
* 添加属性组 | |||
*/ | |||
private void addAttributeGroup(){ | |||
boolean isExist = false; | |||
for(BPA_GOODS_SUBATTRIBUTE_GROUP bean : SubAttributeGroupDBUtil.getByGoodsId(goods.id)){ | |||
if(bean.name.equals(selectAttributeListAdapter.getSubAttributeNameList())){ | |||
isExist = true; | |||
subattributeGroup = bean; | |||
break; | |||
} | |||
if(!isEdit){ | |||
return; | |||
} | |||
LogUtils.d(TAG+" addAttributeGroup isExist="+isExist); | |||
if(!isExist){ | |||
if(subattributeGroup==null){ | |||
subattributeGroup = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | |||
subattributeGroup.goodsId = goods.id; | |||
subattributeGroup.maketime = 0; | |||
@@ -415,7 +410,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
intent.putStringArrayListExtra("mainFoods",mainFoods); | |||
intent.putExtra("goodId",goods.id); | |||
intent.putExtra("subAttributeGroupId",subattributeGroup.id); | |||
intent.putExtra("subAttributeGroupName",selectAttributeListAdapter.getSubAttributeNameList()); | |||
intent.putExtra("subAttributeGroupName",subattributeGroup.name); | |||
startActivity(intent); | |||
dismiss(); | |||
} | |||
@@ -425,6 +420,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
*/ | |||
private void initView(){ | |||
if(goods!=null){ | |||
picUrl = goods.url; | |||
updateImage(picUrl); | |||
} | |||
viewBinding.layoutName.editName.setText(Objects.requireNonNull(GoodsDBUtil.getById(goodId)).name); | |||
@@ -468,13 +464,31 @@ public class EditGoodsDialog extends DialogFragment { | |||
viewBinding.layoutAttribute.groupDesc.setText("存在选中组合"); | |||
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_yellow_btn); | |||
int pos = 0; | |||
String nameList = selectAttributeListAdapter.getSubAttributeNameList(); | |||
for(int i =0;i<groupList.size();i++){ | |||
if(groupList.get(i).equals(selectAttributeListAdapter.getSubAttributeNameList())){ | |||
if(groupList.get(i).equals(nameList)){ | |||
pos = i; | |||
break; | |||
}else if(nameList.contains("-")&&groupList.get(i).contains("-")){ | |||
String[] res1 = nameList.split("-"); | |||
String[] res2 = groupList.get(i).split("-"); | |||
if(res1.length == res2.length){ | |||
boolean same = true; | |||
for(String s : res1){ | |||
if(!groupList.get(i).contains(s)){ | |||
same = false; | |||
} | |||
} | |||
if(same){ | |||
pos = i; | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
viewBinding.layoutAttribute.spinnerList.setSelection(pos); | |||
}else{ | |||
viewBinding.layoutAttribute.spinnerList.setSelection(0); | |||
viewBinding.layoutAttribute.groupDesc.setText("不存在选中组合"); | |||
if(!isEdit){ | |||
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_gray_btn); | |||
@@ -525,7 +539,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
if(!isEdit){ | |||
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_gray_btn); | |||
} | |||
updateAttributeData(viewBinding.layoutAttribute.spinnerList.getSelectedItem().toString()); | |||
updateAttributeData(""); | |||
}else { | |||
updateAttributeData(viewBinding.layoutAttribute.spinnerList.getSelectedItem().toString()); | |||
viewBinding.layoutAttribute.groupDesc.setText("存在选中组合"); | |||
@@ -548,8 +562,12 @@ public class EditGoodsDialog extends DialogFragment { | |||
public void updateImage(String url){ | |||
picUrl = url; | |||
LogUtils.d(TAG+" updateCircleImage url="+url); | |||
GlideUtil.showImageWithRadius(getContext(),url,viewBinding.layoutName.goodImage, | |||
R.mipmap.loading123, DimensUtil.getDimens(0)); | |||
if(picUrl.isEmpty()){ | |||
viewBinding.layoutName.goodImage.setImageResource(R.mipmap.loading123); | |||
}else { | |||
GlideUtil.showImageWithRadius(getContext(),url,viewBinding.layoutName.goodImage, | |||
R.mipmap.loading123, DimensUtil.getDimens(0)); | |||
} | |||
} | |||
@Override | |||
@@ -69,7 +69,16 @@ public class HomeDevicesFragment extends BaseFragment { | |||
} | |||
changeTextDeviceStatus(2,ModbusHelper.get().getConnected()?"在线":"掉线"); | |||
if(ModbusHelper.get().isBtnStop()){ | |||
clear(); | |||
viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
viewBinding.device.btnFire.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
viewBinding.device.fireView.SetLevel(0); | |||
isFire = false; | |||
isUp = true; | |||
isStir = false; | |||
changeDevicePic(); | |||
} | |||
break; | |||
case MSG_STOP_FOOD: | |||
@@ -79,7 +88,7 @@ public class HomeDevicesFragment extends BaseFragment { | |||
viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
break; | |||
case MSG_STOP_STIR: | |||
viewBinding.device.btnFire.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
break; | |||
case MSG_STOP_UPDOWN: | |||
viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
@@ -219,6 +228,7 @@ public class HomeDevicesFragment extends BaseFragment { | |||
isUp=false; | |||
break; | |||
case "上升": | |||
viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
ConstraintLayout.LayoutParams params2 = (ConstraintLayout.LayoutParams) viewBinding.device.btnUpDown.getLayoutParams(); | |||
params2.topMargin = DimensUtil.getDimens(150); | |||
viewBinding.device.btnUpDown.setLayoutParams(params2); | |||
@@ -57,9 +57,9 @@ public class HomeFoodsFragment extends BaseFragment { | |||
switch (msg.what){ | |||
case 1: | |||
if(ModbusHelper.get().getConnected()){ | |||
viewBinding.tvConnect.setText("设备状态:未连接"); | |||
}else { | |||
viewBinding.tvConnect.setText("设备状态:已连接"); | |||
}else { | |||
viewBinding.tvConnect.setText("设备状态:未连接"); | |||
} | |||
if(hasMessages(1)){ | |||
removeMessages(1); | |||
@@ -334,7 +334,7 @@ public class HomeGoodsViewModel extends ViewModel { | |||
BPA_SUBATTRIBUTE bpa_goodpropertySub = new BPA_SUBATTRIBUTE(); | |||
bpa_goodpropertySub.name = item.getGoodsAttributeList().get(n).getGoodsAttributeValueList().get(i).getAttributeValue(); | |||
bpa_goodpropertySub.parentAttributeId = item.getGoodsAttributeList().get(n).getGoodsAttributeId(); | |||
bpa_goodpropertySub.id = item.getGoodsAttributeList().get(n).getGoodsAttributeValueList().get(i).getGoodsAttributeId(); | |||
bpa_goodpropertySub.id = item.getGoodsAttributeList().get(n).getGoodsAttributeValueList().get(i).getGoodsAttributeValueId(); | |||
bpa_goodpropertySub.sort = i+1; | |||
bpa_goodpropertySub.userID="超级管理员"; | |||
dataSub.add(bpa_goodpropertySub); | |||
@@ -392,7 +392,9 @@ public class HomeGoodsViewModel extends ViewModel { | |||
item.getGoodsInfoList().forEach(goodinfo->{ | |||
try { | |||
List<String> groupList = new ArrayList<>(); | |||
for (GoodsClassifyBean.GoodsInfoListBean.GoodsTechnologyActionListBean goodsTechnologyActionListBean:goodinfo.getGoodsTechnologyActionList()){ | |||
int pos1 = 0; | |||
for (GoodsClassifyBean.GoodsInfoListBean.GoodsTechnologyActionListBean goodsTechnologyActionListBean: | |||
goodinfo.getGoodsTechnologyActionList()){ | |||
//添加子属性组合 | |||
if(!groupList.contains(goodsTechnologyActionListBean.getGoodsAttributeId())){ | |||
BPA_GOODS_SUBATTRIBUTE_GROUP group = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | |||
@@ -408,7 +410,9 @@ public class HomeGoodsViewModel extends ViewModel { | |||
processDetail.goodsSubAttributeGroupId = goodsTechnologyActionListBean.getGoodsAttributeId()==null?"xxxxx123":goodsTechnologyActionListBean.getGoodsAttributeId(); | |||
processDetail.materialType = goodsTechnologyActionListBean.getStepName().contains("液体")?0:1; | |||
String value = ProcessValueUtil.dealProcessJsonToValue(goodsTechnologyActionListBean.getActionJson()); | |||
processDetail.processms = ""; | |||
processDetail.processms = ProcessValueUtil.dealProcessSms(value); | |||
pos1++; | |||
processDetail.sort = pos1; | |||
processDetail.processname = goodsTechnologyActionListBean.getStepName(); | |||
processDetail.processvalue = value; | |||
datas1.add(processDetail); | |||
@@ -437,7 +441,7 @@ public class HomeGoodsViewModel extends ViewModel { | |||
String id = props[i]; | |||
for(GoodsClassifyBean.GoodsAttributeListBean bean : attributes){ | |||
for(GoodsClassifyBean.GoodsAttributeListBean.GoodsAttributeValueListBean sub:bean.getGoodsAttributeValueList()){ | |||
if(sub!=null && sub.getGoodsAttributeId().equals(id)){ | |||
if(sub!=null && sub.getGoodsAttributeValueId().equals(id)){ | |||
recpipeNameTemp.append(sub.getAttributeValue()).append("-"); | |||
} | |||
} | |||
@@ -82,7 +82,7 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_below="@id/tab" | |||
android:paddingBottom="@dimen/dp_95" | |||
android:layout_marginBottom="@dimen/dp_95" | |||
/> | |||
</RelativeLayout> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -32,7 +32,7 @@ | |||
tools:text="三月瓜" | |||
android:textAlignment="center" | |||
android:textColor="@color/black" | |||
android:textSize="@dimen/sp_26" | |||
android:textSize="@dimen/sp_32" | |||
android:textStyle="bold" | |||
android:background="#99FFFFFF" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||