wuhb 11 месяцев назад
Родитель
Сommit
ec232d0273

+ 56 - 2
app/src/main/java/com/ygtx/emcs/activity/StockInBindActivity.java

@@ -20,6 +20,7 @@ import android.widget.TextView;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import com.ygtx.emcs.R;
+import com.ygtx.emcs.activity.model.AreaModel;
 import com.ygtx.emcs.activity.model.EventMessage;
 import com.ygtx.emcs.activity.model.StockLineAreaModel;
 import com.ygtx.emcs.activity.model.StockLineModel;
@@ -59,6 +60,7 @@ public class StockInBindActivity extends BaseActivity {
     private Button submit;
     private BigDecimal totalQty;
     private String box_flag;
+    private AreaModel areaModel;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -88,7 +90,7 @@ public class StockInBindActivity extends BaseActivity {
         if(lineModel.getLineId()!=null){
             searchLineTask(lineModel.getLineId());
         }else{
-            addFirst();
+            searchEmptyArea();
         }
 
         if("1".equals(lineModel.getAutomatic())){
@@ -193,6 +195,10 @@ public class StockInBindActivity extends BaseActivity {
             qty.setTextColor(Color.BLUE);
             boxCode.setTextColor(Color.BLUE);
         }
+        //推荐库位,不能判断是否满
+        if(areaModel!=null){
+//            areaCodeET.setText(areaModel.getAreaCode());
+        }
         del.setOnClickListener(v->{
             if("1".equals(lineModel.getAutomatic())){
                 if(StringUtils.isEmpty(lineModel.getBoxCode())){
@@ -508,7 +514,7 @@ public class StockInBindActivity extends BaseActivity {
                         int total = rs.getInt("total");
                         if(total == 0){
                             mylog.info("没有记录");
-                            addFirst();
+                            searchEmptyArea();
                             return;
                         }
                         stockLineAreaModels = new Gson().fromJson(rs.get("rows").toString(), rds);
@@ -546,6 +552,54 @@ public class StockInBindActivity extends BaseActivity {
         });
     }
 
+    private void searchEmptyArea() {
+        if(Constant.user==null || Constant.user.getUserId() == null){
+            return;
+        }
+        MyProgress myProgress = MyProgress.getInstance();
+        myProgress.show(context, "提示", "正在查询");
+        RequestParams params = httParams(Constant.EMPTY_AREA);
+        params.addBodyParameter("lineId", lineModel.getLineId().toString());
+        x.http().get(params, new Callback.CommonCallback<JSONObject>() {
+            @Override
+            public void onSuccess(JSONObject rs) {
+                mylog.info(rs.toString());
+                try {
+                    if (rs.getInt("code") == 200) {
+                        areaModel = new Gson().fromJson(rs.get("data").toString(), AreaModel.class);
+                    }else if(rs.getInt("code") == 401){
+                        ToastUtils.showToast(context, "会话过期");
+                        logoutAuth(rs.getInt("code"));
+                    }else{
+                        ToastUtils.showToast(context, rs.getString("msg"));
+                    }
+                    addFirst();
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }finally {
+                    myProgress.close();
+                }
+            }
+            @Override
+            public void onError(Throwable ex, boolean isOnCallback) {
+                ex.printStackTrace();
+                HttpsUtil.parserError(StockInBindActivity.this, ex);
+                mylog.error("请求异常:", ex);
+            }
+
+            @Override
+            public void onFinished() {
+                myProgress.close();
+            }
+
+            @Override
+            public void onCancelled(CancelledException arg0) {
+                mylog.error("onRead:", arg0);
+            }
+        });
+    }
+
+
     @Override
     public void receiverTask(String barcode) {
         System.out.println("扫码:" + barcode);

+ 205 - 0
app/src/main/java/com/ygtx/emcs/activity/model/AreaModel.java

@@ -0,0 +1,205 @@
+package com.ygtx.emcs.activity.model;
+
+import java.math.BigDecimal;
+
+public class AreaModel {
+
+    private Long areaId;
+    private String areaCode;
+    private String areaName;
+    private Long locationId;
+    private String locationAddr;
+    private BigDecimal area;
+    private BigDecimal maxLoa;
+    private Long positionX;
+    private Long positionY;
+    private Long positionZ;
+    private Long deviceType;
+    private String point;
+    private String enableFlag;
+    private String clientCode;
+    private Long clientId;
+    private String clientName;
+    private String erpKw;
+    private String attr1;
+    private String attr2;
+    private Long attr3;
+    private Long attr4;
+    private String status;
+
+    public Long getAreaId() {
+        return areaId;
+    }
+
+    public void setAreaId(Long areaId) {
+        this.areaId = areaId;
+    }
+
+    public String getAreaCode() {
+        return areaCode;
+    }
+
+    public void setAreaCode(String areaCode) {
+        this.areaCode = areaCode;
+    }
+
+    public String getAreaName() {
+        return areaName;
+    }
+
+    public void setAreaName(String areaName) {
+        this.areaName = areaName;
+    }
+
+    public Long getLocationId() {
+        return locationId;
+    }
+
+    public void setLocationId(Long locationId) {
+        this.locationId = locationId;
+    }
+
+    public String getLocationAddr() {
+        return locationAddr;
+    }
+
+    public void setLocationAddr(String locationAddr) {
+        this.locationAddr = locationAddr;
+    }
+
+    public BigDecimal getArea() {
+        return area;
+    }
+
+    public void setArea(BigDecimal area) {
+        this.area = area;
+    }
+
+    public BigDecimal getMaxLoa() {
+        return maxLoa;
+    }
+
+    public void setMaxLoa(BigDecimal maxLoa) {
+        this.maxLoa = maxLoa;
+    }
+
+    public Long getPositionX() {
+        return positionX;
+    }
+
+    public void setPositionX(Long positionX) {
+        this.positionX = positionX;
+    }
+
+    public Long getPositionY() {
+        return positionY;
+    }
+
+    public void setPositionY(Long positionY) {
+        this.positionY = positionY;
+    }
+
+    public Long getPositionZ() {
+        return positionZ;
+    }
+
+    public void setPositionZ(Long positionZ) {
+        this.positionZ = positionZ;
+    }
+
+    public Long getDeviceType() {
+        return deviceType;
+    }
+
+    public void setDeviceType(Long deviceType) {
+        this.deviceType = deviceType;
+    }
+
+    public String getPoint() {
+        return point;
+    }
+
+    public void setPoint(String point) {
+        this.point = point;
+    }
+
+    public String getEnableFlag() {
+        return enableFlag;
+    }
+
+    public void setEnableFlag(String enableFlag) {
+        this.enableFlag = enableFlag;
+    }
+
+    public String getClientCode() {
+        return clientCode;
+    }
+
+    public void setClientCode(String clientCode) {
+        this.clientCode = clientCode;
+    }
+
+    public Long getClientId() {
+        return clientId;
+    }
+
+    public void setClientId(Long clientId) {
+        this.clientId = clientId;
+    }
+
+    public String getClientName() {
+        return clientName;
+    }
+
+    public void setClientName(String clientName) {
+        this.clientName = clientName;
+    }
+
+    public String getErpKw() {
+        return erpKw;
+    }
+
+    public void setErpKw(String erpKw) {
+        this.erpKw = erpKw;
+    }
+
+    public String getAttr1() {
+        return attr1;
+    }
+
+    public void setAttr1(String attr1) {
+        this.attr1 = attr1;
+    }
+
+    public String getAttr2() {
+        return attr2;
+    }
+
+    public void setAttr2(String attr2) {
+        this.attr2 = attr2;
+    }
+
+    public Long getAttr3() {
+        return attr3;
+    }
+
+    public void setAttr3(Long attr3) {
+        this.attr3 = attr3;
+    }
+
+    public Long getAttr4() {
+        return attr4;
+    }
+
+    public void setAttr4(Long attr4) {
+        this.attr4 = attr4;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+}

+ 1 - 0
app/src/main/res/layout/ygtx_material_product_item.xml

@@ -27,6 +27,7 @@
                 android:paddingTop="5dp"
                 android:paddingStart="5dp"
                 android:textSize="18dp"
+                android:textColor="@color/blue"
                 android:text="库位:"
                 />
             <TextView