using DAL;
|
using DBUtility;
|
using Model;
|
using Newtonsoft.Json;
|
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Linq;
|
using SQLHelper;
|
using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq;
|
using System.Net;
|
using System.Net.Http;
|
using System.Web.Http;
|
using WebAPI;
|
using WebAPI.Models;
|
using WebAPI.Service;
|
|
namespace WebAPI.Controllers
|
{
|
public class WEBSController : ApiController
|
{
|
public string sWhere = "";
|
public WebServer webserver = new WebServer();
|
public DataSet ds = new DataSet();
|
private json objjson = new json();
|
private json objJsonResult = new json();
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
public ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
|
public WebS.WebService1 oWebs = new WebS.WebService1();
|
public WebS.ClsKf_ICStockBill_WMS WebSoBar = new WebS.ClsKf_ICStockBill_WMS();
|
Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
|
|
|
|
|
#region 提交生单处理方法
|
|
|
#endregion
|
|
|
#region 源单条码处理方法
|
|
#region 生产入库 扫描源单条码
|
|
/// <summary>
|
/// 生产入库 扫描源单条码
|
/// </summary>
|
/// <returns></returns>
|
[Route("WEBSController/Get_SourceBarCode_ProductIn_Json")]
|
[HttpGet]
|
public object get_SourceBarCode_ProductIn_Json(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HStockOrgID)
|
{
|
try
|
{
|
WebSoBar = oWebs.get_SourceBarCode_ProductIn(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HStockOrgID, 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;
|
}
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "扫描源单条码失败!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
|
#endregion
|
|
#region 生产领料 扫描源单条码
|
|
|
#endregion
|
|
#region 销售出库 扫描源单条码
|
|
/// <summary>
|
/// 销售出库 扫描源单条码
|
/// </summary>
|
/// <returns></returns>
|
[Route("WEBSController/Get_SourceBarCode_SellOut_Json")]
|
[HttpGet]
|
public object get_SourceBarCode_SellOut_Json(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HFIFOWhID, Int64 HOWNERID)
|
{
|
try
|
{
|
WebSoBar = oWebs.get_SourceBarCode_SellOut(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HFIFOWhID, HOWNERID, 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;
|
}
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "扫描源单条码失败!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
|
#endregion
|
|
#region 委外出库 扫描源单条码
|
|
|
#endregion
|
|
#region 直接调拨 扫描源单条码
|
|
|
#endregion
|
|
#region 分步式调出 扫描源单条码
|
|
|
#endregion
|
|
#region 分步式调入 扫描源单条码
|
|
|
#endregion
|
|
#endregion
|
|
|
#region 物料条码处理方法
|
|
/// <summary>
|
/// 物料条码文本框 扫码调用
|
/// </summary>
|
/// <returns></returns>
|
[Route("WEBSController/Get_BarCode_Json")]
|
[HttpGet]
|
public Object get_BarCode_Json(string sBarCode, Int64 HInterID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, bool HRedBlueFlag, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HStockOrgID, string HScanStyle, string HCustom1, string HCustom2)
|
{
|
try
|
{
|
WebSoBar = oWebs.get_BarCode(sBarCode, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HStockOrgID, HScanStyle, HCustom1, HCustom2, 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;
|
}
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "扫描条码失败!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
|
#endregion
|
|
|
#region 单据新增模块 获取单据列表信息处理方法
|
|
/// <summary>
|
/// 获取单据列表信息
|
/// </summary>
|
/// <returns></returns>
|
[Route("WEBSController/GetBillEntryTmpList_Json")]
|
[HttpGet]
|
public object GetBillEntryTmpList(long HInterID, string HBillNo, string HBillType, Int64 HStockOrgID, string sMouldManagerCtl, string sFIFOCtl)
|
{
|
try
|
{
|
string sSimpleMode = "N"; //是否启用扫码简易模式,只显示已扫码源单记录(Y,N)
|
string sReturn = "";
|
|
//获取系统参数
|
if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sReturn) == true)
|
{
|
//判断是否启用器具管理(Y,N)
|
if (oSystemParameter.omodel.WMS_MouldManagerCtl == "Y") //启用模治具管理
|
{
|
sMouldManagerCtl = "Y";
|
}
|
|
//判断是否启用先进先出管理(Y,N),是否启用扫码简易模式,只显示已扫码源单记录(Y,N)
|
if (HBillType == "1204") //生产领料单
|
{
|
if (oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_MateOutBill_FIFOList == "Y") //生产领料单-先进先出控制
|
{
|
sFIFOCtl = "Y";
|
}
|
if (oSystemParameter.omodel.Kf_MateOutBill_SimpleMode == "Y") //生产领料单-扫码简易模式
|
{
|
sSimpleMode = "Y";
|
}
|
}
|
else if (HBillType == "1205" && (oSystemParameter.omodel.Kf_SellOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_SellOutBill_FIFOList == "Y")) //销售出库单-先进先出控制
|
{
|
sFIFOCtl = "Y";
|
}
|
else if (HBillType == "1211" && (oSystemParameter.omodel.Kf_EntrustOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_EntrustOutBill_FIFOList == "Y")) //委外出库单-先进先出控制
|
{
|
sFIFOCtl = "Y";
|
}
|
else if (HBillType == "1207" && (oSystemParameter.omodel.Kf_MoveStockBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_MoveStockBill_FIFOList == "Y")) //直接调拨单-先进先出控制
|
{
|
sFIFOCtl = "Y";
|
}
|
else if (HBillType == "1250" && (oSystemParameter.omodel.Kf_MoveStockStepOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_MoveStockStepOutBill_FIFOList == "Y")) //分步式调出单-先进先出控制
|
{
|
sFIFOCtl = "Y";
|
}
|
|
DataSet ds = oCn.RunProcReturn("exec h_p_WMS_BillEntryTmpList_LayUI " + HInterID.ToString() + ",'" + HBillType + "','" + sMouldManagerCtl + "','" + sFIFOCtl + "','" + sSimpleMode + "'", "h_p_WMS_BillEntryTmpList_LayUI");
|
|
List<object> columnNameList = new List<object>();
|
//添加列名
|
foreach (DataColumn col in ds.Tables[0].Columns)
|
{
|
Type dataType = col.DataType;
|
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
|
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
|
}
|
|
if (ds == null || ds.Tables[0].Rows.Count <= 0)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "没有返回任何记录!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
else
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "获取信息成功!";
|
objJsonResult.data = ds;
|
objJsonResult.list = columnNameList;
|
return objJsonResult;
|
}
|
}
|
else
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";返回物料明细列表时获取系统参数失败! " + sReturn;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "获取列表信息失败!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
|
#endregion
|
|
|
#region 处理方法
|
|
|
#endregion
|
|
|
|
|
}
|
}
|