using Newtonsoft.Json;
|
using Newtonsoft.Json.Converters;
|
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.Models;
|
|
namespace WebAPI.Controllers.仓存管理.条码生成
|
{
|
public class Sc_BarCodeController : ApiController
|
{
|
public DBUtility.ClsPub.Enum_BillStatus BillStatus;//单据状态(新增,修改,浏览,更新单价,变更)
|
|
private json objJsonResult = new json();
|
public DataSet ds = new DataSet();
|
public WebServer webserver = new WebServer();
|
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
|
private WebS.WebService1 oWebs = new WebS.WebService1();
|
//获取系统参数
|
Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
|
|
|
|
#region 条码生成
|
|
#region 条码生成获取工厂代码数据
|
|
[Route("Sc_BarCode/GetHWorksNumberBill")]
|
[HttpGet]
|
public object GetHWorksNumberBill()
|
{
|
try
|
{
|
string ERPMode = "";
|
string CampanyName = "";
|
string SourceQtyCtl = "";
|
List<object> list = new List<object>();
|
if (oSystemParameter.ShowBill(ref DBUtility.ClsPub.sExeReturnInfo) == false)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "获取系统参数失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
else
|
{
|
ERPMode = oSystemParameter.omodel.WMS_WMSStockCtl_ERPMode;
|
CampanyName = oSystemParameter.omodel.WMS_CampanyName;
|
SourceQtyCtl = oSystemParameter.omodel.BarCode_SourceQtyCtl;
|
}
|
if (CampanyName == "飞龙") //系统参数 客户定制化名称
|
{
|
list.Add("ZL");
|
list.Add("ST");
|
list.Add("SQ");
|
list.Add("MQ");
|
}
|
else
|
{
|
list.Add("");
|
}
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "返回记录成功!";
|
objJsonResult.list = list;
|
return objJsonResult;
|
}
|
catch (Exception ex)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
|
public static DataSet Sc_GetMESBeginStepWorkBill(string sWhere)
|
{
|
if (sWhere == null || sWhere.Equals(""))
|
{
|
return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MESBeginWorkBillList_NEW order by hmainid desc ", "h_v_Sc_MESBeginWorkBillList_NEW");
|
}
|
else
|
{
|
string sql1 = "select * from h_v_Sc_MESBeginWorkBillList_NEW where 1 = 1 ";
|
string sql = sql1 + sWhere + " order by hmainid desc ";
|
return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MESBeginWorkBillList_NEW");
|
}
|
|
}
|
|
#endregion
|
|
#region 条码生成获取条码类型数据
|
|
[Route("Sc_BarCode/GetHBarCodeTypeBill")]
|
[HttpGet]
|
public object GetHBarCodeTypeBill()
|
{
|
try
|
{
|
List<object> list = new List<object>();
|
string sCapName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (sCapName == "夏宝电器")
|
{
|
list.Add("内销机条码");
|
list.Add("外销机条码");
|
list.Add("半成品条码");
|
}
|
else if (sCapName == "博日科技")
|
{
|
list.Add("仪器外购件条码普通规则");
|
list.Add("仪器外购件条码容器规则");
|
list.Add("仪器成品条码规则");
|
list.Add("试剂成品条码规则");
|
}
|
else
|
{
|
list.Add("唯一条码");
|
list.Add("品种条码");
|
list.Add("批次条码");
|
//list.Add("托盘条码");
|
}
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "返回记录成功!";
|
objJsonResult.list = list;
|
return objJsonResult;
|
}
|
catch (Exception ex)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
#endregion
|
|
#region [通过源单类型查找不通单据信息]
|
[Route("Sc_BarCode/ReportFromBillList")]
|
[HttpGet]
|
public object ReportFromBillList(int page, int limit, string sWhere,string HSouceBillType,string HOrgID)
|
{
|
List<object> columnNameList = new List<object>();
|
try
|
{
|
int count = 0;
|
int pageNum = page;
|
int pageSize = limit;
|
string sql = "";
|
string tabname = "";
|
if (sWhere == null || sWhere.Equals(""))
|
{
|
sWhere = " where 1=1 and HOrgID='"+HOrgID+"' ";
|
}
|
else
|
{
|
sWhere = " where 1=1 and HOrgID='" + HOrgID + "' " + sWhere;
|
}
|
switch (HSouceBillType)
|
{
|
case "生产订单":
|
tabname = "h_v_IFCLD_ICMOBillList_Source";
|
count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IFCLD_ICMOBillList_Source "+sWhere+ " and 任务数量>isnull(入库数量,0) and 状态<>'结案' order by 单据号", "h_v_IFCLD_ICMOBillList_Source").Tables[0].Rows.Count;
|
sql = string.Format(@"select top " + pageSize + " * from(select row_number() over (order by 单据号) as HRowNumber,* from h_v_IFCLD_ICMOBillList_Source " + sWhere + " and 任务数量>isnull(入库数量,0) and 状态<>'结案') as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
|
break;
|
case "生产汇报单":
|
break;
|
case "采购订单":
|
break;
|
case "收料通知单":
|
break;
|
case "委外订单":
|
break;
|
case "退货通知单":
|
break;
|
case "其他入库单":
|
break;
|
case "直接调拨单":
|
break;
|
case "采购退料单":
|
break;
|
case "生产退料单":
|
break;
|
case "组装拆卸单":
|
break;
|
default:
|
break;
|
}
|
ds = new SQLHelper.ClsCN().RunProcReturn(sql, tabname);
|
string aa = ds.Tables[0].Columns[0].ToString();
|
|
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.Tables[0].Rows.Count > 0)
|
{
|
objJsonResult.code = "1";
|
objJsonResult.count = count;
|
objJsonResult.Message = "获取资源绑定数据成功!";
|
objJsonResult.data = JsonConvert.DeserializeObject<DataTable>(JsonConvert.SerializeObject(ds.Tables[0], new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" })); //序列化DataSet中的时间格式,然后再反序列化回来
|
objJsonResult.list = columnNameList;
|
return objJsonResult;
|
}
|
else
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "暂无资源绑定!";
|
objJsonResult.data = null;
|
objJsonResult.list = columnNameList;
|
return objJsonResult;
|
}
|
}
|
catch (Exception e)
|
{
|
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = e.Message.ToString();
|
objJsonResult.data = null;
|
objJsonResult.list = columnNameList;
|
}
|
return objJsonResult;
|
}
|
#endregion
|
|
#endregion
|
}
|
}
|