This commit is contained in:
mwang 2024-10-26 16:39:09 +08:00 committed by bobwang
parent d1a17b9f05
commit 2c609374fb
26 changed files with 1375 additions and 32 deletions

View File

@ -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;

View File

@ -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<stockGoods> 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<stockGoods>();
Type type = new TypeToken<ArrayList<stockGoods>>(){}.getType();
mStockGoods =(List<stockGoods> ) 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<StockLocListAdapter.MyViewHolder> {
private final int EMPTY_VIEW = 1;
private final int PROGRESS_VIEW = 2;
private final int IMAGE_VIEW = 3;
private Context context;
private List<stockGoods> mDatas = new ArrayList<stockGoods>();
private OnItemClickLitener mOnItemClickLitener;
private int listItemID;
public StockLocListAdapter(Context context, List<stockGoods> 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<stockGoods> 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;
}
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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() {

View File

@ -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<String,String> 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;

View File

@ -112,6 +112,7 @@ public class StockInSeedsOut2Fragment extends BasicFragment {
Enums.enumValidInResult validResult;;
List<StockInDetailPackBarcode> OriData = new ArrayList<StockInDetailPackBarcode>();;
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<StockInDetailPackBarcode> tmp = new ArrayList<StockInDetailPackBarcode>();
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<ArrayList<StockInDetailPackBarcode>>(){}.getType();
mDatas =(List<StockInDetailPackBarcode> ) gson.fromJson(result,type);
Log.d(TAG,"get stock items succeed, size is " + mDatas.size());
OriData =(List<StockInDetailPackBarcode> ) gson.fromJson(result,type);
} catch (Exception e) {
e.printStackTrace();
@ -249,6 +251,7 @@ public class StockInSeedsOut2Fragment extends BasicFragment {
@Override
protected void fillData() {
clearDetail();
setDetail();

View File

@ -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();

View File

@ -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<PlateStock> 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<PlateStock>();
Type type = new TypeToken<ArrayList<PlateStock>>(){}.getType();
mPlateStocks =(List<PlateStock> ) 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<StockLocListAdapter.MyViewHolder> {
private final int EMPTY_VIEW = 1;
private final int PROGRESS_VIEW = 2;
private final int IMAGE_VIEW = 3;
private Context context;
private List<PlateStock> mDatas = new ArrayList<PlateStock>();
private OnItemClickLitener mOnItemClickLitener;
private int listItemID;
public StockLocListAdapter(Context context, List<PlateStock> 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<PlateStock> 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();;
}
}

View File

@ -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();

View File

@ -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());
}

View File

@ -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);

View File

@ -186,6 +186,10 @@ public class PlateStock {
}
public String getBarcode() {
if(TextUtils.isEmpty(barcode) ){
return goodsId;
}
return barcode;
}

View File

@ -48,6 +48,12 @@ public class User {
private String em_account="";
private String token="";
private String extrMsg="";
public String getExtrMsg() {
return extrMsg;
}
public Map<String, List<Authority>> getAuthMap() {
/*
String key200 = "库管工具";

View File

@ -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<ResponseBody> initialStockIn( @Body Map<String, String> map);
@GET("stock/getGoodsInfo") //stock/getGoodsInfo?keywords={keywords}
Observable<ResponseBody> getGoodsInfo(@Query("keywords") String keywords );
@GET("stock/getGoodsPackByBarcode") //stock/getGoodsPackByBarcode?barcode={barcode}
Observable<ResponseBody> getGoodsPackByBarcode(@Query("barcode") String barcode );

View File

@ -363,6 +363,11 @@ public class BookSubscribe {
HttpMethods.getInstance().toSubscribe(observable, subscriber);
}
public static void getGoodsInfo(String keywords , DisposableObserver<ResponseBody> subscriber){
Observable<ResponseBody> observable = HttpMethods.getInstance("getGoodsInfo").getHttpApi().
getGoodsInfo(keywords );
HttpMethods.getInstance().toSubscribe(observable, subscriber);
}
public static void getGoodsPackByBarcode(String barcode , DisposableObserver<ResponseBody> subscriber){
Observable<ResponseBody> observable = HttpMethods.getInstance("getGoodsPackByBarcode").getHttpApi().

View File

@ -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"; //分播台编号
}

View File

@ -9,7 +9,7 @@
tools:showIn="@layout/activity_cate_books"
android:orientation="vertical"
>
<!--
<com.ixiaow.multilayout.MultiLayout
android:id="@+id/topic_layout"
android:layout_width="match_parent"
@ -20,6 +20,7 @@
app:tab_text_size="15sp"
app:tab_text_width="60dp"
app:tl_textUnselectColor="@color/darkgray" />
<com.flyco.tablayout.SlidingTabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
@ -41,6 +42,6 @@
</android.support.v4.view.ViewPager>
-->
</LinearLayout>

View File

@ -16,6 +16,7 @@
android:theme="@style/ToolBarTheme.AppBarOverlay">
<!--
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
@ -119,6 +120,8 @@
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
-->
</android.support.design.widget.AppBarLayout>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp"
tools:context=".Fragments.LocMgr_fragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<!-- TODO: Update blank fragment layout -->
<EditText
android:id="@+id/edit_barcode"
style="@style/EditText.scanIn"
android:hint="@string/goodsName" >
<requestFocus />
</EditText>
<android.support.v7.widget.RecyclerView
android:id="@+id/rvStockList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="true"
android:padding="10dp"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp"
tools:context=".Fragments.LocMgr_fragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:layout_marginStart="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginStart="0dp">
<!-- TODO: Update blank fragment layout -->
<EditText
android:id="@+id/edDeskIp"
style="@style/EditText.scanIn"
android:hint="@string/deskip"
android:selectAllOnFocus="true"
>
</EditText>
<EditText
android:id="@+id/edDeskId"
style="@style/EditText.scanIn"
android:visibility="gone"
android:hint="@string/seedsDesk"
android:selectAllOnFocus="true"
>
</EditText>
<EditText
android:id="@+id/edFlowNo"
style="@style/EditText.scanIn"
android:hint="@string/flowno"
android:selectAllOnFocus="true"
>
<requestFocus />
</EditText>
<EditText
android:id="@+id/edBarcode"
style="@style/EditText.scanIn"
android:hint="@string/goodsBarcode"
android:selectAllOnFocus="true"
>
</EditText>
<android.support.v7.widget.RecyclerView
android:id="@+id/rvStockList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="true"
android:paddingTop="10dp"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -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">
<TextView
style="@style/TextViewTitle.EditTitle"

View File

@ -30,9 +30,17 @@
android:id="@+id/btnGoSeeds"
style="@style/buttonCates"
android:layout_weight="0"
android:layout_width="wrap_content"
android:layout_width="60dp"
android:text="@string/goSeeds" />
<Button
android:id="@+id/btnGoSeedsLight"
style="@style/buttonCates"
android:layout_weight="0"
android:layout_width="60dp"
android:text="@string/goSeedsLight" />
</LinearLayout>

View File

@ -44,7 +44,7 @@
android:id="@+id/tv_source_desc_layout"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_below="@id/layout_image_group"
android:layout_centerVertical="true"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"

View File

@ -0,0 +1,224 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:orientation="vertical"
android:gravity="center"
android:layout_weight="1">
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<!-- TODO: Update blank fragment layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:orientation="horizontal">
<TextView
style="@style/TextViewTitle"
android:text="@string/goodsName" />
<TextView
android:id="@+id/goodsName"
style="@style/TextViewValue.bold"
android:text=" " />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:orientation="horizontal">
<TextView
style="@style/TextViewTitle"
android:text="@string/goodsId" />
<TextView
android:id="@+id/tvGoodsId"
android:layout_weight="1"
style="@style/TextViewValue"
android:text=" " />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:orientation="horizontal">
<TextView
style="@style/TextViewTitle"
android:text="@string/manufacture" />
<TextView
android:id="@+id/manufacture"
style="@style/TextViewValue"
android:text=" " />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:orientation="horizontal">
<TextView
style="@style/TextViewTitle"
android:text="@string/expireterm" />
<TextView
android:id="@+id/expireterm"
style="@style/TextViewValue"
android:text=" " />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:orientation="horizontal">
<TextView
style="@style/TextViewTitle"
android:text="@string/spec" />
<TextView
android:id="@+id/spec"
style="@style/TextViewValue"
android:text=" " />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:orientation="horizontal">
<TextView
style="@style/TextViewTitle"
android:text="@string/goodsBarcode" />
<TextView
android:id="@+id/tvGoodsBarcode"
style="@style/TextViewValue"
android:layout_weight="1"
android:text=" " />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="2dp"
android:orientation="horizontal">
<TextView
style="@style/TextViewTitle"
android:text="@string/bigCount" />
<TextView
android:id="@+id/tvbigcnt"
style="@style/TextViewValue"
android:layout_weight="1"
android:text=" " />
<TextView
style="@style/TextViewTitle"
android:text="@string/unit" />
<TextView
android:id="@+id/unit"
style="@style/TextViewValue"
android:layout_weight="1"
android:text=" " />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="2dp"
android:orientation="horizontal">
<TextView
style="@style/TextViewTitle"
android:text="@string/minOperationCnt" />
<TextView
android:id="@+id/tvMinOperationCnt"
style="@style/TextViewValue"
android:layout_weight="1"
android:text=" " />
<TextView
style="@style/TextViewTitle"
android:text="@string/MinOperationUnit" />
<TextView
android:id="@+id/tvMinOperationUnit"
style="@style/TextViewValue"
android:layout_weight="1"
android:text=" " />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:orientation="horizontal">
<TextView
style="@style/TextViewTitle"
android:text="@string/storeType" />
<TextView
android:id="@+id/tvStoreType"
style="@style/TextViewValue"
android:text=" " />
</LinearLayout>
</LinearLayout>
<LinearLayout style="@style/llGraySplit"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"/>
</LinearLayout>

View File

@ -371,8 +371,11 @@
<string name="orderprice">订单单价</string>
<string name="validby">验收人</string>
<string name="validtime">验收时间</string>
<string name="goSeeds"></string>
<string name="goSeeds"></string>
<string name="goPick">去下架</string>
<string name="pcount">盘点数量</string>
<string name="deskip">分播区地址</string>
<string name="goSeedsLight"></string>
</resources>