diff --git a/zhuike/src/main/java/com/novelbook/android/Activity_blue.java b/zhuike/src/main/java/com/novelbook/android/Activity_blue.java index 14d57fc..6bf12fa 100644 --- a/zhuike/src/main/java/com/novelbook/android/Activity_blue.java +++ b/zhuike/src/main/java/com/novelbook/android/Activity_blue.java @@ -140,7 +140,7 @@ public abstract class Activity_blue extends Activity_base { String address = sharedPreferences.getString(GPreferences.BLUE_JK_PRINT_MAC, ""); // Toast.makeText(this, " printer mac is " +address, Toast.LENGTH_SHORT).show(); if (StringUtils.isTrimEmpty(address)) { - openBlueDeviceList(false); + // openBlueDeviceList(false); } else { mConnectedDevicePrintMac = address; diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/GoodsQuery_fragment.java b/zhuike/src/main/java/com/novelbook/android/Fragments/GoodsQuery_fragment.java new file mode 100644 index 0000000..f8c1c98 --- /dev/null +++ b/zhuike/src/main/java/com/novelbook/android/Fragments/GoodsQuery_fragment.java @@ -0,0 +1,401 @@ +package com.novelbook.android.Fragments; + +import android.content.Context; +import android.graphics.Bitmap; +import android.os.Bundle; +import android.support.v7.widget.GridLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.util.Log; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.google.zxing.BarcodeFormat; +import com.google.zxing.WriterException; +import com.google.zxing.common.BitMatrix; +import com.google.zxing.qrcode.QRCodeWriter; +import com.novelbook.android.Main2Activity; +import com.novelbook.android.R; +import com.novelbook.android.bean.stockGoods; +import com.novelbook.android.netsubscribe.BookSubscribe; +import com.novelbook.android.netutils.OnSuccessAndFaultListener; +import com.novelbook.android.netutils.OnSuccessAndFaultSub; +import com.novelbook.android.utils.WmsUtil; + +import org.json.JSONObject; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnEditorAction; + + +public class GoodsQuery_fragment extends BasicFragment { + public static final String TAG = GoodsQuery_fragment.class.getSimpleName(); + @BindView(R.id.rvStockList) + RecyclerView mRecyclerView; + private StockLocListAdapter mAdapter; + private List mStockGoods; + private stockGoods mStockGood; + @BindView(R.id.edit_barcode) + EditText edBarcode; + + @Override + protected void fillData11(){ + + } + + + + @OnEditorAction(R.id.edit_barcode) + boolean onEditorAction(KeyEvent key) { + + if (!WmsUtil.isKeyEnterDown(key)) { + return true; + } + + Log.d(TAG, "----start query doGetStockGoods----"); + doGetGoods(edBarcode.getText().toString()); + edBarcode.selectAll(); + + + return false; + } + + private void doGetGoods(String keywords) { + + clearData(); + BookSubscribe.getGoodsInfo(keywords , new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() { + @Override + public void onSuccess(String result) { + + try { + Log.d(TAG," result:" +result); + Gson gson = new Gson(); + mStockGoods = new ArrayList(); + Type type = new TypeToken>(){}.getType(); + mStockGoods =(List ) gson.fromJson(result,type); + if(mStockGoods.size()>0){ + mStockGood=mStockGoods.get(0); + } + Log.d(TAG,"get stock items succeed, size is " +mStockGoods.size()); + + } catch (Exception e) { + e.printStackTrace(); + Log.e(TAG, "onSuccess: 解析失败", e); + } + Log.d(TAG, "progress: progress to hide"); + handler.sendEmptyMessage(1); + + + + } + + @Override + public void onSuccess(JSONObject jsonObject) { + + } + @Override + public void onFault(String errorMsg) { + //tvIp.setText("failure"); + //失败 + Log.e(TAG, "error on get firstpage: " + errorMsg); + failureMsg =errorMsg; + handler.sendEmptyMessage(2); + } + }, this.getActivity(),true)); + + + } + + + @Override + protected void initDebugData() { + edBarcode.setText( "酱油"); + } + + @Override + protected int getLayoutRes() { + return R.layout.fragment_goods_query_fragment; + } + + @Override + protected void initData() { + + } + + + + @Override + protected void fillData() { + + mAdapter = new StockLocListAdapter(getActivity(), mStockGoods, R.layout.recycle_list_item_goods, new OnItemClickLitener() { + @Override + public void onItemClick(View view, int position) { + stockGoods data = mStockGoods.get(position); + showData(data); + } + + }); + + initReceyleView(); + + bindData(); + + + } + + private void bindData() { + + + } + private void clearData(){ + mStockGood= new stockGoods(); + bindData();; + } + + //show stock location detail + private void showData(stockGoods data) { + ((Main2Activity)getActivity()).showStockItem(data); + + } + + void initReceyleView() { + + // mRecyclerView.setLayoutManager(new LinearLayoutManager(this.activity)); + mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(),1)); + mRecyclerView.setAdapter(mAdapter ); + + } + + @Override + protected void initViews() { + + + } + + public GoodsQuery_fragment() { + // Required empty public constructor + } + + + public static GoodsQuery_fragment newInstance(String param1, String param2) { + GoodsQuery_fragment fragment = new GoodsQuery_fragment(); + + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + if (getArguments() != null) { + + } + } + + @Override + protected void processArguments() { + + } + + + class StockLocListAdapter extends RecyclerView.Adapter { + private final int EMPTY_VIEW = 1; + private final int PROGRESS_VIEW = 2; + private final int IMAGE_VIEW = 3; + + private Context context; + private List mDatas = new ArrayList(); + private OnItemClickLitener mOnItemClickLitener; + private int listItemID; + public StockLocListAdapter(Context context, List mDatas, int listItemID, OnItemClickLitener clickLitener) { + this.context = context; + this.mDatas = mDatas; + this.mOnItemClickLitener = clickLitener; + this.listItemID = listItemID; + } + public StockLocListAdapter(Context context, OnItemClickLitener clickLitener) { + this.context = context; + this.mOnItemClickLitener = clickLitener; + + } + + @Override + public int getItemViewType(int position) { + if(mDatas.size() == 0){ + return EMPTY_VIEW; + } else if(mDatas.get(position) == null){ + return PROGRESS_VIEW; + } else { + return super.getItemViewType(position); + } + } + + @Override + public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) + { + MyViewHolder holder = new MyViewHolder(LayoutInflater.from( + context).inflate(listItemID, parent, + false)); + return holder; + } + + public void setParameters(List mDatas,int listItemID ) { + this.mDatas = mDatas; + this.listItemID = listItemID; + } + + public void setOnItemClickLitener(OnItemClickLitener mOnItemClickLitener) + { + this.mOnItemClickLitener = mOnItemClickLitener; + } + + @Override + public void onBindViewHolder(MyViewHolder holder, int position) + { + + + holder.goodsName.setText(mDatas.get(position).getGoodsName()); + holder.spec.setText(mDatas.get(position).getSpec()); + holder.unit.setText(mDatas.get(position).getUnit()); + holder.manufacture.setText(mDatas.get(position).getManufacturer()); + holder.tvBarcode.setText(mDatas.get(position).getBarCode()); + holder.tvGoodsId.setText(mDatas.get(position).getGoodsId()); + + holder.spec.setText(mDatas.get(position).getSpec()); + holder.unit.setText(mDatas.get(position).getUnit()); + holder.manufacture.setText(mDatas.get(position).getManufacturer()); + holder.tvExpireDays.setText(mDatas.get(position).getExpiryDays()+""); + holder.tvStoreType.setText(mDatas.get(position).getGoodsTypeName()); + holder.tvMinOperationCnt.setText(mDatas.get(position).getMinOperateCount()+""); + holder.tvMinOperationUnit.setText(mDatas.get(position).getMinOperateUnit()); + + holder.bigcnt.setText(mDatas.get(position).getBigCount()+""); + + + + try { + BitMatrix bitMatrix = new QRCodeWriter().encode(mDatas.get(position).getBarCode(), BarcodeFormat.QR_CODE, 500, 500); + Bitmap qrCode = toBitmap(bitMatrix); + holder.imageView.setImageBitmap(qrCode); + } catch (WriterException e) { + e.printStackTrace(); + } + + /* if( mDatas.get(position).getNovel()!=null) { + ImageUtil.loadImage(context, mDatas.get(position).getNovel().getCover(), holder.imageView); + }*/ + + + // 如果设置了回调,则设置点击事件 + if (mOnItemClickLitener != null) + { + holder.itemView.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) + { + int pos = holder.getLayoutPosition(); + mOnItemClickLitener.onItemClick(holder.itemView, pos); + } + }); + } + } + + @Override + public int getItemCount() + { + return mDatas!=null?mDatas.size():0; + } + public void addData(int position) { + // mDatas.add(position, "Insert One"); + // notifyItemInserted(position); + } + + public void removeData(int position) { + mDatas.remove(position); + notifyItemRemoved(position); + } + class MyViewHolder extends RecyclerView.ViewHolder + { + + @BindView(R.id.goodsName) + TextView goodsName; + @BindView(R.id.manufacture) + TextView manufacture; + @BindView(R.id.expireterm) + TextView tvExpireDays; + + @BindView(R.id.spec) + TextView spec; + @BindView(R.id.tvbigcnt) + TextView bigcnt; + + @BindView(R.id.tvGoodsBarcode) + TextView tvBarcode; + + @BindView(R.id.unit) + TextView unit; + + @BindView(R.id.tvGoodsId) + TextView tvGoodsId; + + @BindView(R.id.tvStoreType) + TextView tvStoreType; + + @BindView(R.id.tvMinOperationCnt) + TextView tvMinOperationCnt; + @BindView(R.id.tvMinOperationUnit) + TextView tvMinOperationUnit; + + + @BindView(R.id.imageView) + ImageView imageView; + + public MyViewHolder(View view) + { + super(view); + ButterKnife.bind(this, view); + + + + } + } + } + interface OnItemClickLitener + { + void onItemClick(View view, int position); + + } + + @Override + public void onResume() { + super.onResume(); + initReceyleView(); + bindData();; + } + + private Bitmap toBitmap(BitMatrix matrix) { + int width = matrix.getWidth(); + int height = matrix.getHeight(); + Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + bitmap.setPixel(x, y, matrix.get(x, y) ? 0xFF000000 : 0xFFFFFFFF); + } + } + + return bitmap; + } +} \ No newline at end of file diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/LocMgrItemFragment.java b/zhuike/src/main/java/com/novelbook/android/Fragments/LocMgrItemFragment.java index a3dba83..671ac6d 100644 --- a/zhuike/src/main/java/com/novelbook/android/Fragments/LocMgrItemFragment.java +++ b/zhuike/src/main/java/com/novelbook/android/Fragments/LocMgrItemFragment.java @@ -218,7 +218,7 @@ public class LocMgrItemFragment extends BasicFragment { if(isSuccess){ stkItem.setAvCount( stkItem.getAvCount() - newCnt* stkItem.getMinOperateCount()); } - printStockInItem("移库下架",stkItem.getGoodsName(),newCnt+"", stkItem.getMinOperateUnit(),edFlowNo.getText()+"", Enums.enumWhType.存储区.toString()); //打印上架交接单 + // printStockInItem("移库下架",stkItem.getGoodsName(),newCnt+"", stkItem.getMinOperateUnit(),edFlowNo.getText()+"", Enums.enumWhType.存储区.toString()); //打印上架交接单 Log.d(TAG,"return result: " + failureMsg ); handler.sendEmptyMessage(1); diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/PlateLoadTruckFragment.java b/zhuike/src/main/java/com/novelbook/android/Fragments/PlateLoadTruckFragment.java index f1c4395..3fc1d97 100644 --- a/zhuike/src/main/java/com/novelbook/android/Fragments/PlateLoadTruckFragment.java +++ b/zhuike/src/main/java/com/novelbook/android/Fragments/PlateLoadTruckFragment.java @@ -536,13 +536,14 @@ public class PlateLoadTruckFragment extends BasicFragment { } String url = "http://%s/DNlight/printOutTrans?plateId=%s"; url = String.format(url, deskIp, targetFlow); + final String urlMsg= url; Request request = new Request.Builder().url(url).build(); showProgressDialog(); HttpMethods.getOkClient().newCall(request).enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { Log.d(TAG, " print out tasks onFailure(int, Header[],byte[], Throwable ) was received"); - failureMsg = "打印信息发送失败"; + failureMsg = "打印信息发送失败: " +urlMsg ; handler.sendEmptyMessage(12); } diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/PlateStock_fragment.java b/zhuike/src/main/java/com/novelbook/android/Fragments/PlateStock_fragment.java index 108e584..9deb559 100644 --- a/zhuike/src/main/java/com/novelbook/android/Fragments/PlateStock_fragment.java +++ b/zhuike/src/main/java/com/novelbook/android/Fragments/PlateStock_fragment.java @@ -56,6 +56,11 @@ public class PlateStock_fragment extends BasicFragment { @BindView(R.id.tvLineName) TextView tvLineName; + @Override + protected int getLayoutRes() { + return R.layout.fragment_plate_store; + } + @Override protected void fillData11(){ @@ -69,7 +74,6 @@ public class PlateStock_fragment extends BasicFragment { private boolean isCheck =false; - private String flowNo=""; @OnEditorAction(R.id.edFlowNo) boolean onEditorAction(KeyEvent key) { @@ -183,10 +187,6 @@ private String flowNo=""; edFlowNo.setText( "H-1-1-15"); } - @Override - protected int getLayoutRes() { - return R.layout.fragment_plate_store; - } @Override protected void initData() { diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/StockGoodsInitial_fragment.java b/zhuike/src/main/java/com/novelbook/android/Fragments/StockGoodsInitial_fragment.java index d009008..f78d146 100644 --- a/zhuike/src/main/java/com/novelbook/android/Fragments/StockGoodsInitial_fragment.java +++ b/zhuike/src/main/java/com/novelbook/android/Fragments/StockGoodsInitial_fragment.java @@ -115,21 +115,23 @@ public class StockGoodsInitial_fragment extends BasicFragment { } setInfo(""); + String prdDate = String.valueOf(edProductDate.getText()); + String batch = String.valueOf(edBatch.getText()); + if(TextUtils.isEmpty(batch)){ + batch= prdDate; + } Map map = new HashMap<>(); map.put("goodsId",stkItem.getGoodsId()); map.put("locId", tvLocationId.getText().toString().trim()); map.put("batchCount",getBatchCount()+""); - map.put("prodDate", String.valueOf(edProductDate.getText())); - map.put("batch",edBatch.getText().toString()); + map.put("prodDate", prdDate); + map.put("batch",batch); //edLocation.setText(""); BookSubscribe.initialStockIn(map, new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() { @Override public void onSuccess(String result) { - - - } @Override @@ -178,6 +180,12 @@ public class StockGoodsInitial_fragment extends BasicFragment { return false; } + if(TextUtils.isEmpty( String.valueOf(edProductDate.getText()))){ + setInfo("请输入生产日期"); + edProductDate.selectAll();; + edProductDate.requestFocus(); + return false; + } return true; diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/StockInSeedsOut2Fragment.java b/zhuike/src/main/java/com/novelbook/android/Fragments/StockInSeedsOut2Fragment.java index 29047c1..f605533 100644 --- a/zhuike/src/main/java/com/novelbook/android/Fragments/StockInSeedsOut2Fragment.java +++ b/zhuike/src/main/java/com/novelbook/android/Fragments/StockInSeedsOut2Fragment.java @@ -112,6 +112,7 @@ public class StockInSeedsOut2Fragment extends BasicFragment { Enums.enumValidInResult validResult;; + List OriData = new ArrayList();; String preNo="",barcode=""; public void setPreInNo(String preInNo){ @@ -141,18 +142,19 @@ public class StockInSeedsOut2Fragment extends BasicFragment { barcode =edBarcode.getText().toString().trim().replaceAll("\\r|\\n",""); currentPage=0; - if(!TextUtils.isEmpty(barcode) &&mDatas.size()>0){ + if(!TextUtils.isEmpty(barcode) && !OriData.isEmpty()){ List tmp = new ArrayList(); - for (StockInDetailPackBarcode s: mDatas + for (StockInDetailPackBarcode s: OriData ) { if(s.getCustomerId().equalsIgnoreCase(barcode)){ tmp.add(s); } } - if(tmp.size()>0){ + if(tmp.size()>0 || !barcode.toLowerCase().startsWith("p")){ + mDatas=tmp ; fillData(); return true; @@ -194,7 +196,7 @@ public class StockInSeedsOut2Fragment extends BasicFragment { Type type = new TypeToken>(){}.getType(); mDatas =(List ) gson.fromJson(result,type); Log.d(TAG,"get stock items succeed, size is " + mDatas.size()); - + OriData =(List ) gson.fromJson(result,type); } catch (Exception e) { e.printStackTrace(); @@ -249,6 +251,7 @@ public class StockInSeedsOut2Fragment extends BasicFragment { @Override protected void fillData() { + clearDetail(); setDetail(); diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/StockLightJobs.java b/zhuike/src/main/java/com/novelbook/android/Fragments/StockLightJobs.java index 1747364..c39780a 100644 --- a/zhuike/src/main/java/com/novelbook/android/Fragments/StockLightJobs.java +++ b/zhuike/src/main/java/com/novelbook/android/Fragments/StockLightJobs.java @@ -127,7 +127,7 @@ public class StockLightJobs extends BasicFragment { try { deskIp = edDeskId.getText().toString();; - // deskIp = edDeskId.getText().toString().split(":")[0]; + // serviceIp = edDeskId.getText().toString().split(":")[0]; // edDeskId.setText(edDeskId.getText().toString().split(":")[1]); // edJobNo.selectAll(); // edJobNo.requestFocus(); diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/StockLightSeedsWms.java b/zhuike/src/main/java/com/novelbook/android/Fragments/StockLightSeedsWms.java new file mode 100644 index 0000000..4685491 --- /dev/null +++ b/zhuike/src/main/java/com/novelbook/android/Fragments/StockLightSeedsWms.java @@ -0,0 +1,501 @@ +package com.novelbook.android.Fragments; + +import android.content.Context; +import android.os.Bundle; +import android.support.v7.widget.GridLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.text.TextUtils; +import android.util.Log; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.novelbook.android.MyApp; +import com.novelbook.android.R; +import com.novelbook.android.bean.Plate; +import com.novelbook.android.bean.PlateStock; +import com.novelbook.android.netsubscribe.BookSubscribe; +import com.novelbook.android.netutils.HttpMethods; +import com.novelbook.android.netutils.OnSuccessAndFaultListener; +import com.novelbook.android.netutils.OnSuccessAndFaultSub; +import com.novelbook.android.utils.Constants; +import com.novelbook.android.utils.WmsUtil; + +import org.json.JSONObject; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnEditorAction; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + + +public class StockLightSeedsWms extends BasicFragment { + public static final String TAG = StockLightSeedsWms.class.getSimpleName(); + @BindView(R.id.rvStockList) + RecyclerView mRecyclerView; + private StockLocListAdapter mAdapter; + private List mPlateStocks; + private Plate mPlate; + @BindView(R.id.edDeskIp) + EditText edDeskIp; + @BindView(R.id.edDeskId) + EditText edDeskId; + @BindView(R.id.edFlowNo) + EditText edFlowNo; + + @BindView(R.id.edBarcode) + EditText edBarcode; + + @Override + protected int getLayoutRes() { + return R.layout.fragment_light_seeds_wms; + } + + + @Override + protected void fillData11(){ + setInfo(lightResult); + } + + public void setCheck(boolean check) { + isCheck = check; + } + + private boolean isCheck =false; + + String serviceIp,lightResult; + + @OnEditorAction({R.id.edDeskIp}) + boolean onBarcodeEditorAction3(KeyEvent key) { + if (!WmsUtil.isKeyEnterDown(key)) { + return true; + } + + try { + serviceIp = edDeskIp.getText().toString();; + Constants.SEEDS_SERVICE_IP = serviceIp; + return false; + } catch (Exception er) { + setInfo("请扫描分播台标签"); + edDeskIp.selectAll(); + edDeskIp.requestFocus(); + } + + return true; + } + @OnEditorAction({R.id.edDeskId}) + boolean onBarcodeEditorAction2(KeyEvent key) { + if (!WmsUtil.isKeyEnterDown(key)) { + return true; + } + + try { + deskId= edDeskId.getText().toString();; + Constants.SEEDS_DESK_NO =deskId; + // serviceIp = edDeskId.getText().toString().split(":")[0]; + // edDeskId.setText(edDeskId.getText().toString().split(":")[1]); + // edJobNo.selectAll(); + // edJobNo.requestFocus(); + return false; + } catch (Exception er) { + setInfo("请扫描分播台标签"); + edDeskId.selectAll(); + edDeskId.requestFocus(); + } + + return true; + } + +private String flowNo="", deskId=""; + @OnEditorAction(R.id.edFlowNo) + boolean onEditorAction(KeyEvent key) { + + if (!WmsUtil.isKeyEnterDown(key)) { + return true; + } + flowNo=edFlowNo.getText().toString(); + Log.d(TAG, "----start query doGetStockGoods----"); + + deskId = edDeskId.getText().toString(); + doGetPlateStock(); + + + return false; + } + + private void doGetPlateStock() { + + + clearData(); + + if(TextUtils.isEmpty(flowNo)){ + return; + } + BookSubscribe.getPlateContent(flowNo , false,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() { + @Override + public void onSuccess(String result) { + + try { + Log.d(TAG," result:" +result); + Gson gson = new Gson(); + mPlateStocks = new ArrayList(); + Type type = new TypeToken>(){}.getType(); + mPlateStocks =(List ) gson.fromJson(result,type); + + Log.d(TAG,"get stock items succeed, size is " +mPlateStocks.size()); + + } catch (Exception e) { + e.printStackTrace(); + Log.e(TAG, "onSuccess: 解析失败", e); + } + Log.d(TAG, "progress: progress to hide"); + handler.sendEmptyMessage(1); + + } + + @Override + public void onSuccess(JSONObject jsonObject) { + + } + @Override + public void onFault(String errorMsg) { + //tvIp.setText("failure"); + //失败 + Log.e(TAG, "error on get firstpage: " + errorMsg); + failureMsg =errorMsg; + handler.sendEmptyMessage(2); + } + }, this.getActivity(),true)); + + + } + + + private void doLIghtSeeds(String deskNo, String flowNo, String barcode, int pcs,boolean isValid) { + lightResult=""; + failureMsg=""; + setInfo(""); + + + String url = String.format( "http://%s/DNLight/lightSeed?deskId=%s&flowNo=%s&barcode=%s&pcs=%s&isValid=%s&userId=%s", + Constants.SEEDS_SERVICE_IP,Constants.SEEDS_DESK_NO,flowNo,barcode,pcs,isValid, MyApp.user .getID()); + Request request = new Request.Builder().url(url) + .build(); + + showProgressDialog(true,"正在加载"); + HttpMethods.getOkClient().newCall(request).enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + failureMsg = e.getMessage(); + handler.sendEmptyMessage(2); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + ResponseBody body = response.body(); + // Log.d(TAG, "onResponse:test " + body.string()); + lightResult = body.string(); + handler.sendEmptyMessage(11); + } + }); + + + } + + @Override + protected void initDebugData() { + + edDeskIp.setText("192.168.2.9"); + edDeskId.setText("101"); + + + + } + + + @Override + protected void initData() { + + } + + + + @Override + protected void fillData() { + + mAdapter = new StockLocListAdapter(getActivity(), mPlateStocks, R.layout.recycle_list_item_stkout_rec, new OnItemClickLitener() { + @Override + public void onItemClick(View view, int position) { + PlateStock data = mPlateStocks.get(position); + // if(TextUtils.isEmpty(data.getToLocationId())) + { + // Log.d(TAG, "onItemClick: to locaiton id is " + data.getToLocationId()); + showData(data); + } + } + + }); + + initReceyleView(); + + bindData(); + + + + } + + public void setFlowNo(String flowNo) { + this.flowNo=flowNo; + + + } + + private void bindData() { + edDeskIp .setText( Constants.SEEDS_SERVICE_IP ); + edDeskId .setText( Constants.SEEDS_DESK_NO ); + if(!TextUtils.isEmpty(flowNo)){ + edFlowNo.setText(flowNo); + } + + } + private void clearData(){ + mPlate= new Plate(); + setInfo(""); + bindData();; + } + + //show stock location detail + private void showData(PlateStock data) { + // ((Main2Activity)getActivity()).showPlateStockItem(data); + int pcs =(int) data.getOperationCnt() ; + doLIghtSeeds(deskId,flowNo,data.getBarcode(), pcs,false); + + } + + void initReceyleView() { + + // mRecyclerView.setLayoutManager(new LinearLayoutManager(this.activity)); + mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(),1)); + mRecyclerView.setAdapter(mAdapter ); + + } + + @Override + protected void initViews() { + + edDeskIp .setText( Constants.SEEDS_SERVICE_IP ); + edDeskId .setText( Constants.SEEDS_DESK_NO ); + + if(!TextUtils.isEmpty(flowNo)){ + edFlowNo.setText(flowNo); + doGetPlateStock(); + } + } + + public StockLightSeedsWms() { + // Required empty public constructor + } + + + public static StockLightSeedsWms newInstance(String param1, String param2) { + StockLightSeedsWms fragment = new StockLightSeedsWms(); + + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + if (getArguments() != null) { + + } + } + + @Override + protected void processArguments() { + + } + + + class StockLocListAdapter extends RecyclerView.Adapter { + private final int EMPTY_VIEW = 1; + private final int PROGRESS_VIEW = 2; + private final int IMAGE_VIEW = 3; + + private Context context; + private List mDatas = new ArrayList(); + private OnItemClickLitener mOnItemClickLitener; + private int listItemID; + public StockLocListAdapter(Context context, List mDatas, int listItemID, OnItemClickLitener clickLitener) { + this.context = context; + this.mDatas = mDatas; + this.mOnItemClickLitener = clickLitener; + this.listItemID = listItemID; + } + public StockLocListAdapter(Context context, OnItemClickLitener clickLitener) { + this.context = context; + this.mOnItemClickLitener = clickLitener; + + } + + @Override + public int getItemViewType(int position) { + if(mDatas.size() == 0){ + return EMPTY_VIEW; + } else if(mDatas.get(position) == null){ + return PROGRESS_VIEW; + } else { + return super.getItemViewType(position); + } + } + + @Override + public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) + { + MyViewHolder holder = new MyViewHolder(LayoutInflater.from( + context).inflate(listItemID, parent, + false)); + return holder; + } + + public void setParameters(List mDatas,int listItemID ) { + this.mDatas = mDatas; + this.listItemID = listItemID; + } + + public void setOnItemClickLitener(OnItemClickLitener mOnItemClickLitener) + { + this.mOnItemClickLitener = mOnItemClickLitener; + } + + @Override + public void onBindViewHolder(MyViewHolder holder, int position) + { + holder.goodsName.setText(mDatas.get(position).getGoodsName()); + holder.tvCount.setText(mDatas.get(position). getPickCnt()); + holder.tvFlowNo.setText(mDatas.get(position).getPlateId()); + holder.productDate.setText(mDatas.get(position).getProductDate()); + holder.tvTaskType.setText(mDatas.get(position).getJobType()); + holder.tvCustomer.setText(mDatas.get(position).getCustName()); + holder.tvToPartion.setText(mDatas.get(position).getDestination()); + holder.tvChecktime.setText(mDatas.get(position).getCheckTime()); + holder.tvCheckedBy.setText(mDatas.get(position).getCheckByName()); + holder.tvSpec.setText(mDatas.get(position).getSpec()); + holder.tvPickBy.setText(mDatas.get(position).getPickByName()); + holder.tvTranArea.setText(mDatas.get(position).getToPartionName()); + holder.tvPickTime.setText(mDatas.get(position).getPickTime()); + holder.btnPrint.setVisibility(View.INVISIBLE); + + /* if( mDatas.get(position).getNovel()!=null) { + ImageUtil.loadImage(context, mDatas.get(position).getNovel().getCover(), holder.imageView); + }*/ + + + // 如果设置了回调,则设置点击事件 + if (mOnItemClickLitener != null) + { + holder.itemView.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) + { + int pos = holder.getLayoutPosition(); + mOnItemClickLitener.onItemClick(holder.itemView, pos); + } + }); + } + } + + @Override + public int getItemCount() + { + return mDatas!=null?mDatas.size():0; + } + public void addData(int position) { + // mDatas.add(position, "Insert One"); + // notifyItemInserted(position); + } + + public void removeData(int position) { + mDatas.remove(position); + notifyItemRemoved(position); + } + class MyViewHolder extends RecyclerView.ViewHolder + { + + @BindView(R.id.flowNo) + TextView tvFlowNo; + @BindView(R.id.goodsName) + TextView goodsName; + + @BindView(R.id.productDate) + TextView productDate; + @BindView(R.id.tvCount) + TextView tvCount; + + @BindView(R.id.tvCustomer) + TextView tvCustomer; + + @BindView(R.id.tvToPartion) + TextView tvToPartion; + @BindView(R.id.tvTaskType) + TextView tvTaskType; + @BindView(R.id.tvCheckTime) + TextView tvChecktime; + + @BindView((R.id.tvCheckedBy)) + TextView tvCheckedBy; + + @BindView((R.id.tvSpec)) + TextView tvSpec; + @BindView((R.id.tvPickBy)) + TextView tvPickBy; + @BindView((R.id.tvPicktime)) + TextView tvPickTime; + @BindView((R.id.tvtranArea)) + TextView tvTranArea; + + @BindView((R.id.btnPrint)) + Button btnPrint; + + public MyViewHolder(View view) + { + super(view); + ButterKnife.bind(this, view); + + + + } + } + } + interface OnItemClickLitener + { + void onItemClick(View view, int position); + + } + + @Override + public void onResume() { + super.onResume(); + initReceyleView(); + // getTargetPlate(flowNo); + doGetPlateStock(); + bindData();; + + } +} \ No newline at end of file diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/StockOutPickOneByOne.java b/zhuike/src/main/java/com/novelbook/android/Fragments/StockOutPickOneByOne.java index adacc5c..cd9dfef 100644 --- a/zhuike/src/main/java/com/novelbook/android/Fragments/StockOutPickOneByOne.java +++ b/zhuike/src/main/java/com/novelbook/android/Fragments/StockOutPickOneByOne.java @@ -357,7 +357,7 @@ public class StockOutPickOneByOne extends BasicFragment { // edLoc.setEnabled(true); if( !TextUtils.isEmpty( mStockOutPort().getCustomerId() ) &&connectBlueWeight(edBulk,mStockOutPort().getPickUnit(),edFlowNo) ){ - // edPickcnt.setText("0"); + edPickcnt.setText("0"); edBulk.setText(mStockOutPort().getCount()+""); edLoc.setText(mStockOutPort().getLocationId()); //货位分蔬菜。。 @@ -399,7 +399,7 @@ public class StockOutPickOneByOne extends BasicFragment { lastJobNo = mStockOutPort().getJobNo(); tvPages.setText(currentPage+1 +"/" +mListOutTasks.size()); - if(BuildConfig.DEBUG) { + if(BuildConfig.DEBUG || MyApp.user.hasSpecialAuth("虚拟扫码下架")) { edLoc.setText(mStockOutPort().getLocationId()); /* @@ -846,7 +846,7 @@ public class StockOutPickOneByOne extends BasicFragment { } - @OnClick({R.id.btnConfirm,R.id.btnNextPage,R.id.btnLastPage, R.id.btnGoSeeds}) + @OnClick({R.id.btnConfirm,R.id.btnNextPage,R.id.btnLastPage, R.id.btnGoSeeds,R.id.btnGoSeedsLight}) void btnOnClick(View view) { setInfo(""); switch (view.getId()) { @@ -862,7 +862,9 @@ public class StockOutPickOneByOne extends BasicFragment { case R.id.btnGoSeeds: goSeeds(); break; - + case R.id.btnGoSeedsLight: + goSeedsLight(); + break; // case R.id.btnBlueInput: // ((Main2Activity)activity).connectScale(edSeedsBulkCnt);; // break; @@ -883,6 +885,18 @@ public class StockOutPickOneByOne extends BasicFragment { canBack=!canBack; } + private void goSeedsLight() { + + if(canBack) { + popBack(); + }else{ + ( (Main2Activity)activity).showSeedsOutLight(edFlowNo.getText().toString(),false); + + } + canBack=!canBack; + } + + @Override public void onResume(){ super.onResume(); diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/StockPandianItem.java b/zhuike/src/main/java/com/novelbook/android/Fragments/StockPandianItem.java index 0a01ba2..34c7cd9 100644 --- a/zhuike/src/main/java/com/novelbook/android/Fragments/StockPandianItem.java +++ b/zhuike/src/main/java/com/novelbook/android/Fragments/StockPandianItem.java @@ -483,7 +483,8 @@ public class StockPandianItem extends BasicFragment { void showNewPanItem(String locId){ PanddianTarget ssd = getCurrentObj(); - ((Main2Activity)activity).showNewPandianItem(ssd.getOrderNo(), locId,ssd.getId(),ssd.getType()==2,ssd.getGoodsId()); + if( !TextUtils.isEmpty( ssd.getOrderNo())) + ((Main2Activity)activity).showNewPandianItem(ssd.getOrderNo(), locId,ssd.getId(),ssd.getType()==2,ssd.getGoodsId()); } diff --git a/zhuike/src/main/java/com/novelbook/android/Main2Activity.java b/zhuike/src/main/java/com/novelbook/android/Main2Activity.java index 763274f..adf16a1 100644 --- a/zhuike/src/main/java/com/novelbook/android/Main2Activity.java +++ b/zhuike/src/main/java/com/novelbook/android/Main2Activity.java @@ -38,6 +38,7 @@ import android.widget.Toast; import com.novelbook.android.AD.toutiao.TTAdManagerHolder; import com.novelbook.android.Fragments.FragmentCates; import com.novelbook.android.Fragments.FragmentTopCates; +import com.novelbook.android.Fragments.GoodsQuery_fragment; import com.novelbook.android.Fragments.ImageFragment; import com.novelbook.android.Fragments.LocMgrUpItemFragment; import com.novelbook.android.Fragments.LocMgr_UpShelfFragment; @@ -64,6 +65,7 @@ import com.novelbook.android.Fragments.StockInValidItemFragment; import com.novelbook.android.Fragments.StockLightDeskSeeds; import com.novelbook.android.Fragments.StockLightJobs; import com.novelbook.android.Fragments.StockLightSeeds; +import com.novelbook.android.Fragments.StockLightSeedsWms; import com.novelbook.android.Fragments.StockOutPickFragment; import com.novelbook.android.Fragments.StockOutPickOneByOne; import com.novelbook.android.Fragments.StockOutSeedsOutFragment; @@ -586,6 +588,12 @@ private int bottomSelectedIndex; @Override public void setInfo(String text){ + + Log.d(TAG, "setInfo: extrMsg is " +MyApp.user.getExtrMsg()); + if(! TextUtils.isEmpty((MyApp.user.getExtrMsg()))){ + text = MyApp.user.getExtrMsg(); + } + tvInfo.setText(text); if(TextUtils.isEmpty(text)){ tvInfo.setVisibility(View.INVISIBLE); @@ -652,6 +660,8 @@ public void popBackFragment(){ showCombineElId(); break; case 108://商品维护 showGoodsMaintain(""); break; + case 109://商品查询 + showGoodsQuery(""); break; case 200://商品养护 showStockMaintain(); break; case 300://入库收货质检 @@ -708,6 +718,8 @@ public void popBackFragment(){ showSeedsOut("",true); break; case 430://亮灯拣货 showStockLightJob(); break; + case 431://亮灯拣货 + showStockLightSeedsWms(); break; case 440://分拣记录 showPickRecs(); break; case 500://客户集货 @@ -788,6 +800,13 @@ public void popBackFragment(){ showFragment(fragment , StockInValidFragment.TAG); } + public void showGoodsQuery(String goodsId ) { + GoodsQuery_fragment fragment = (GoodsQuery_fragment) getSupportFragmentManager() + .findFragmentByTag(StockGoodsMaintain_fragment.TAG); + if(fragment ==null) fragment =new GoodsQuery_fragment(); + fragment.setTitleName(getAuth().getAuth_name()); + showFragment(fragment , GoodsQuery_fragment.TAG); + } public void showGoodsMaintain(String goodsId ) { StockGoodsMaintain_fragment fragment = (StockGoodsMaintain_fragment) getSupportFragmentManager() .findFragmentByTag(StockGoodsMaintain_fragment.TAG); @@ -806,6 +825,15 @@ public void popBackFragment(){ showFragment(fragment , StockOutSeedsOutFragment.TAG,isAddToBackStack); } + public void showSeedsOutLight(String flowNo ,boolean isAddToBackStack) { + StockLightSeedsWms fragment = (StockLightSeedsWms) getSupportFragmentManager() + .findFragmentByTag(StockLightSeedsWms.TAG); + if(fragment ==null) fragment =new StockLightSeedsWms(); + fragment.setTitleName(getAuth().getAuth_name()); + fragment.setFlowNo(flowNo); + showFragment(fragment , StockLightSeedsWms.TAG,isAddToBackStack); + } + public void showStockOutSequence(String flowNo,boolean isAddToBackStack) { StockOutPickOneByOne fragment = (StockOutPickOneByOne) getSupportFragmentManager() .findFragmentByTag(StockOutPickOneByOne.TAG); @@ -935,6 +963,13 @@ public void popBackFragment(){ showFragment(fragment , StockLightSeeds.TAG); } + private void showStockLightSeedsWms() { + StockLightSeedsWms fragment = (StockLightSeedsWms) getSupportFragmentManager() + .findFragmentByTag(StockLightSeedsWms.TAG); + if(fragment ==null) fragment =new StockLightSeedsWms(); + + showFragment(fragment , StockLightSeedsWms.TAG); + } private void showStockLightJob() { StockLightJobs fragment = (StockLightJobs) getSupportFragmentManager() .findFragmentByTag(StockLightJobs.TAG); diff --git a/zhuike/src/main/java/com/novelbook/android/bean/PlateStock.java b/zhuike/src/main/java/com/novelbook/android/bean/PlateStock.java index 68c0e04..3a34ea7 100644 --- a/zhuike/src/main/java/com/novelbook/android/bean/PlateStock.java +++ b/zhuike/src/main/java/com/novelbook/android/bean/PlateStock.java @@ -186,6 +186,10 @@ public class PlateStock { } public String getBarcode() { + if(TextUtils.isEmpty(barcode) ){ + return goodsId; + } + return barcode; } diff --git a/zhuike/src/main/java/com/novelbook/android/bean/User.java b/zhuike/src/main/java/com/novelbook/android/bean/User.java index 6655173..cddf793 100644 --- a/zhuike/src/main/java/com/novelbook/android/bean/User.java +++ b/zhuike/src/main/java/com/novelbook/android/bean/User.java @@ -48,6 +48,12 @@ public class User { private String em_account=""; private String token=""; + private String extrMsg=""; + + public String getExtrMsg() { + return extrMsg; + } + public Map> getAuthMap() { /* String key200 = "库管工具"; diff --git a/zhuike/src/main/java/com/novelbook/android/netapi/HttpApi.java b/zhuike/src/main/java/com/novelbook/android/netapi/HttpApi.java index fd53e5a..e5c0344 100644 --- a/zhuike/src/main/java/com/novelbook/android/netapi/HttpApi.java +++ b/zhuike/src/main/java/com/novelbook/android/netapi/HttpApi.java @@ -158,6 +158,11 @@ public interface HttpApi { @POST("stock/initialStockIn")//stock/initialStockIn(string goodsId, string locId, decimal batchCount, string prodDate, string validDate, string batch); Observable initialStockIn( @Body Map map); + + @GET("stock/getGoodsInfo") //stock/getGoodsInfo?keywords={keywords} + Observable getGoodsInfo(@Query("keywords") String keywords ); + + @GET("stock/getGoodsPackByBarcode") //stock/getGoodsPackByBarcode?barcode={barcode} Observable getGoodsPackByBarcode(@Query("barcode") String barcode ); diff --git a/zhuike/src/main/java/com/novelbook/android/netsubscribe/BookSubscribe.java b/zhuike/src/main/java/com/novelbook/android/netsubscribe/BookSubscribe.java index 375d9fd..dc1cbd0 100644 --- a/zhuike/src/main/java/com/novelbook/android/netsubscribe/BookSubscribe.java +++ b/zhuike/src/main/java/com/novelbook/android/netsubscribe/BookSubscribe.java @@ -363,6 +363,11 @@ public class BookSubscribe { HttpMethods.getInstance().toSubscribe(observable, subscriber); } + public static void getGoodsInfo(String keywords , DisposableObserver subscriber){ + Observable observable = HttpMethods.getInstance("getGoodsInfo").getHttpApi(). + getGoodsInfo(keywords ); + HttpMethods.getInstance().toSubscribe(observable, subscriber); + } public static void getGoodsPackByBarcode(String barcode , DisposableObserver subscriber){ Observable observable = HttpMethods.getInstance("getGoodsPackByBarcode").getHttpApi(). diff --git a/zhuike/src/main/java/com/novelbook/android/utils/Constants.java b/zhuike/src/main/java/com/novelbook/android/utils/Constants.java index 2300b33..43b1e9f 100644 --- a/zhuike/src/main/java/com/novelbook/android/utils/Constants.java +++ b/zhuike/src/main/java/com/novelbook/android/utils/Constants.java @@ -126,7 +126,6 @@ public class Constants { private static float weightScopePercent = 0; - - - + public static String SEEDS_SERVICE_IP =""; //分播区亮灯服务电脑地址 + public static String SEEDS_DESK_NO ="101"; //分播台编号 } diff --git a/zhuike/src/main/res/layout/content_activity_cate_books.xml b/zhuike/src/main/res/layout/content_activity_cate_books.xml index a828304..588e22e 100644 --- a/zhuike/src/main/res/layout/content_activity_cate_books.xml +++ b/zhuike/src/main/res/layout/content_activity_cate_books.xml @@ -9,7 +9,7 @@ tools:showIn="@layout/activity_cate_books" android:orientation="vertical" > - + \ No newline at end of file diff --git a/zhuike/src/main/res/layout/fragment_fragment_paihang.xml b/zhuike/src/main/res/layout/fragment_fragment_paihang.xml index 68079ed..0eadba8 100644 --- a/zhuike/src/main/res/layout/fragment_fragment_paihang.xml +++ b/zhuike/src/main/res/layout/fragment_fragment_paihang.xml @@ -16,6 +16,7 @@ android:theme="@style/ToolBarTheme.AppBarOverlay"> + diff --git a/zhuike/src/main/res/layout/fragment_goods_query_fragment.xml b/zhuike/src/main/res/layout/fragment_goods_query_fragment.xml new file mode 100644 index 0000000..5818f50 --- /dev/null +++ b/zhuike/src/main/res/layout/fragment_goods_query_fragment.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zhuike/src/main/res/layout/fragment_light_seeds_wms.xml b/zhuike/src/main/res/layout/fragment_light_seeds_wms.xml new file mode 100644 index 0000000..ff3de58 --- /dev/null +++ b/zhuike/src/main/res/layout/fragment_light_seeds_wms.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zhuike/src/main/res/layout/fragment_stock_goods_initial.xml b/zhuike/src/main/res/layout/fragment_stock_goods_initial.xml index f4fc2c9..ea95ef5 100644 --- a/zhuike/src/main/res/layout/fragment_stock_goods_initial.xml +++ b/zhuike/src/main/res/layout/fragment_stock_goods_initial.xml @@ -258,7 +258,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="0dp" - android:visibility="gone" + android:visibility="visible" android:orientation="horizontal"> +