using DBUtility;
using Model;
using Newtonsoft.Json.Linq;
using SQLHelper;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using WebAPI;
using WebAPI.Code;
using WebAPI.Models;
namespace WebAPI.Controllers
{
public class ProductInController : ApiController
{
public Int64 HSupID;//供应商ID
public Int64 HDeptID;//部门ID
public Int64 HWhID;//仓库ID
public Int64 HSPID;//仓位ID
public string HSupName;
public string HDeptName;
public string HWhName;
public string HSPName;
public Int64 HInterID;//本单ID
public string HBillNo;
public string HSourceBillNo;
public string HBillType = "1202";//单据类型
public string sBillCode = "ICStockBill";
public string sTranType = "2";
public bool sRedBlueFlag = false;
public bool SourceFlag = false;
//public string sSourceType = "3710";
public WebServer webserver =new WebServer();
public DataSet ds =new DataSet();
public ClsGy_BarCodeBill_WMS_Model_View oView =new ClsGy_BarCodeBill_WMS_Model_View();
public ClsKF_PonderationBillMain_Temp model = new ClsKF_PonderationBillMain_Temp();
public ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
//public ClsKf_ICStockBill_WMS oBar = new ClsKf_ICStockBill_WMS();
public double sRelQty = 0;
// private DataBaseServices objDataBaseServices = new DataBaseServices();
private json objJsonResult = new json();
// private string msgModel = "{{\"count\":{0},\"code\":{0},\"message\":\"{1}\",\"result\":{2}}}";
public static string GetSession(string sMsg)
{
try
{
string s = Common.GetSession();
return s;
}
catch (Exception e)
{
return "";
}
}
///
/// 产品入库缓存列表编辑前判断单据是否已上传 直接调WebService
///
///
//[Route("ProductIn/ProductInTempList_Modify")]
//[HttpGet]
//public Object ProductInTempList_Modify(Int64 sInterID,string sBillNo, string sBillType)
//{
// //oBar = webserver.get_CheckTypeByBarCode(sCode, sInterID, sBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID, ref DBUtility.ClsPub.sErrInfo);
// WebS.WebService1 oWebs = new WebS.WebService1();
// if (oWebs.TempList_Modify(sInterID, sBillNo, sBillType, ref sErrMsg))
// {
// objJsonResult.code = "0";
// objJsonResult.count = 0;
// objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
// objJsonResult.data = null;
// return objJsonResult;
// }
// else
// {
// objJsonResult.code = "0";
// objJsonResult.count = 1;
// objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
// objJsonResult.data = null;
// return objJsonResult;
// }
//}
///
/// 产品入库/扫条码/直接调用webservice
///
///
[Route("ProductIn/get_CheckTypeByBarCode_Json")]
[HttpGet]
public Object get_CheckTypeByBarCode_Json(string sCode, Int64 sInterID, string sBillNo, string sBillType, string sMaker, Int64 WhID, Int64 SPID, Double sQty, bool sRedBlue, bool SourceFlag, string sSourceBillNo, string sSourceType, Int64 HOWNERID)
{
//if (sRedBlue == true)
//{
// HBillType = "1245";
//}
//oBar = webserver.get_CheckTypeByBarCode(sCode, sInterID, sBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID, ref DBUtility.ClsPub.sErrInfo);
WebS.WebService1 oWebs = new WebS.WebService1();
WebS.ClsKf_ICStockBill_WMS WebSoBar = new WebS.ClsKf_ICStockBill_WMS();
string sExpressNumber = "";
//WebSoBar = oWebs.get_CheckTypeByBarCode_All(sCode, sInterID, HBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID, sExpressNumber, ref DBUtility.ClsPub.sErrInfo);
WebSoBar = oWebs.get_CheckTypeByBarCode_All(sCode, sInterID, HBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID, sExpressNumber, ref DBUtility.ClsPub.sErrInfo);
if (WebSoBar == null)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
objJsonResult.data = null;
return objJsonResult;
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
objJsonResult.data = WebSoBar;
return objJsonResult;
}
}
///
/// 一键扫码(红字)
///
///
[Route("ProductIn/get_CheckTypeByBarCode_All_Json")]
[HttpGet]
public Object get_CheckTypeByBarCode_AllN_Json(string sCode, Int64 sInterID, string HBillType, string sBillNo, string sMaker, Int64 WhID, Int64 SPID, Double sQty, bool sRedBlue, bool SourceFlag, string sSourceBillNo, string sSourceType, Int64 HOWNERID, string sExpressNumber)
{
if (sRedBlue == true)
{
HBillType = "1245";
}
oBar = webserver.get_CheckTypeByBarCode_All(sCode, sInterID, HBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID,sExpressNumber,ref DBUtility.ClsPub.sErrInfo);
if (oBar == null)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
objJsonResult.data = null;
return objJsonResult;
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
objJsonResult.data = oBar;
return objJsonResult;
}
}
///
/// 返回出入库条码临时表
///
///
[Route("ProductIn/DisBillEntryList_Webs_Json")]
[HttpGet]
public object DisBillEntryList_Webs_Json(long HBillID, string HBillType, string sWhere)
{
try
{
ds = webserver.GetKf_PonderationBillMain_Temp(HBillID, HBillType, sWhere);
if (ds == null || ds.Tables[0].Rows.Count <= 0)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "没有返回任何记录!";
objJsonResult.data = null;
return objJsonResult;
//DBUtility.ClsPub.MessageBeep((int)DBUtility.ClsPub.BeepType.Warning);
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "获取信息成功!";
objJsonResult.data = ds.Tables[0];
return objJsonResult;
}
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "没有返回任何记录!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
/////
///// 产品入库缓存列表刷新信息
/////
/////
//[Route("ProductIn/DisBillEntryList_Json1")]
//[HttpGet]
//public object DisBillEntryList_Json1(string HBillType,string sHMaker, Int64 HOrgID)
//{
// try
// {
// ds = webserver.GetKf_PonderationBillMain_TempList_New(HBillType, sHMaker, HOrgID);
// if (ds == null || ds.Tables[0].Rows.Count <= 0)
// {
// objJsonResult.code = "0";
// objJsonResult.count = 0;
// objJsonResult.Message = "没有返回任何记录!";
// objJsonResult.data = null;
// return objJsonResult;
// //DBUtility.ClsPub.MessageBeep((int)DBUtility.ClsPub.BeepType.Warning);
// }
// else
// {
// objJsonResult.code = "0";
// objJsonResult.count = 1;
// objJsonResult.Message = "获取信息成功!";
// objJsonResult.data = ds.Tables[0];
// return objJsonResult;
// }
// }
// catch (Exception e)
// {
// objJsonResult.code = "0";
// objJsonResult.count = 0;
// objJsonResult.Message = "没有返回任何记录!" + e.ToString();
// objJsonResult.data = null;
// return objJsonResult;
// }
//}
///
/// 生产入库缓存列表编辑按钮 获取表体信息
///
///
///
[Route("ProdIn/ProdInDetaiNew")]
[HttpGet]
public object ProdInDetaiNew(string HInterID)
{
DataSet ds;
List