196 lines
8.4 KiB
C#
196 lines
8.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web;
|
|
using SuperMap.RealEstate.CoreFrameWork;
|
|
using SuperMap.RealEstate.SendRec.Storage.Business;
|
|
using HZQR.Common;
|
|
using QRWL.Common;
|
|
|
|
namespace SuperMap.RealEstate.SendRec.Handler
|
|
{
|
|
/// <summary>
|
|
/// handler_ajax 的摘要说明
|
|
/// </summary>
|
|
public class handler_ajax : IHttpHandler
|
|
{
|
|
|
|
public void ProcessRequest(HttpContext context)
|
|
{
|
|
ServiceModel.Transaction _Transaction = new ServiceModel.Transaction();
|
|
string action_type = Pub.Request("action_type");
|
|
string action_data = Pub.Request("action_data");
|
|
string reString = string.Empty;
|
|
string StrSql = string.Empty;
|
|
List<TreeItem> _ListTreeItem = null;
|
|
Dictionary<string, string> _DictString = DictionaryHelper.GetDictionaryKeyValue(_Transaction, "COMMODITY_UNIT");
|
|
Dictionary<string, string> _MATERIALFLOW = DictionaryHelper.GetDictionaryKeyValue(_Transaction, "MATERIALFLOW");
|
|
|
|
try
|
|
{
|
|
switch (action_type)
|
|
{
|
|
#region 获得申请商品
|
|
case "getApplyCommodity":
|
|
try
|
|
{
|
|
//获得枚举信息
|
|
List<Storage.Model.APPLYCOMMODITY> _ListAPPLYCOMMODITY = new List<Storage.Model.APPLYCOMMODITY>();
|
|
|
|
foreach (APPLYCOMMODITY _APPLYCOMMODITY in (new APPLYCOMMODITY(_Transaction)).FillCollection(
|
|
"where APPLYPROINST_ID = " + action_data.ToDecrypt()))
|
|
{
|
|
foreach (var item in _DictString)
|
|
{
|
|
if (_APPLYCOMMODITY.PropertyObject.UNIT.ToString() == item.Key)
|
|
{
|
|
_APPLYCOMMODITY.PropertyObject.PURCHASEDETAIL_DESC = item.Value;
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
_APPLYCOMMODITY.PropertyObject.PURCHASEDETAIL_DESC = "";
|
|
}
|
|
}
|
|
|
|
foreach (var item in _MATERIALFLOW)
|
|
{
|
|
if (_APPLYCOMMODITY.PropertyObject.MATERIALFLOW.ToString() == item.Key)
|
|
{
|
|
_APPLYCOMMODITY.PropertyObject.COMMODITY_WEIGHT = item.Value;
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
_APPLYCOMMODITY.PropertyObject.COMMODITY_WEIGHT = "";
|
|
}
|
|
}
|
|
|
|
_ListAPPLYCOMMODITY.Add(_APPLYCOMMODITY.PropertyObject);
|
|
}
|
|
reString = JsonHelper.ListToJson<SuperMap.RealEstate.SendRec.Storage.Model.APPLYCOMMODITY>(_ListAPPLYCOMMODITY, "APPLYCOMMODITY");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
reString = "error:" + ex.Message;
|
|
}
|
|
break;
|
|
#endregion
|
|
|
|
#region 获得入库物资
|
|
case "getRecCommodity":
|
|
try
|
|
{
|
|
//获得枚举信息
|
|
List<Storage.Model.RECCOMMODITY> _ListAPPLYCOMMODITY = new List<Storage.Model.RECCOMMODITY>();
|
|
|
|
foreach (RECCOMMODITY _RECCOMMODITY in (new RECCOMMODITY(_Transaction)).FillCollection(
|
|
"where APPLYPROINST_ID = " + action_data.ToDecrypt()))
|
|
{
|
|
foreach (var item in _DictString)
|
|
{
|
|
if (_RECCOMMODITY.PropertyObject.UNIT.ToString() == item.Key)
|
|
{
|
|
_RECCOMMODITY.PropertyObject.PURCHASEDETAIL_DESC = item.Value;
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
_RECCOMMODITY.PropertyObject.PURCHASEDETAIL_DESC = "";
|
|
}
|
|
}
|
|
|
|
foreach (var item in _MATERIALFLOW)
|
|
{
|
|
if (_RECCOMMODITY.PropertyObject.MATERIALFLOW.ToString() == item.Key)
|
|
{
|
|
_RECCOMMODITY.PropertyObject.COMMODITY_WEIGHT = item.Value;
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
_RECCOMMODITY.PropertyObject.COMMODITY_WEIGHT = "";
|
|
}
|
|
}
|
|
|
|
_ListAPPLYCOMMODITY.Add(_RECCOMMODITY.PropertyObject);
|
|
}
|
|
reString = JsonHelper.ListToJson<Storage.Model.RECCOMMODITY>(_ListAPPLYCOMMODITY, "APPLYCOMMODITY");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
reString = "error:" + ex.Message;
|
|
}
|
|
break;
|
|
#endregion
|
|
|
|
#region 获得退货物资
|
|
case "getBackCommodity":
|
|
try
|
|
{
|
|
//获得枚举信息
|
|
List<Storage.Model.BACKCOMMODITY> _ListBACKCOMMODITY = new List<Storage.Model.BACKCOMMODITY>();
|
|
|
|
foreach (BACKCOMMODITY _BACKCOMMODITY in (new BACKCOMMODITY(_Transaction)).FillCollection(
|
|
"where APPLYPROINST_ID = " + action_data.ToDecrypt()))
|
|
{
|
|
foreach (var item in _DictString)
|
|
{
|
|
if (_BACKCOMMODITY.PropertyObject.UNIT.ToString() == item.Key)
|
|
{
|
|
_BACKCOMMODITY.PropertyObject.BACK_DESC = item.Value;
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
_BACKCOMMODITY.PropertyObject.BACK_DESC = "";
|
|
}
|
|
}
|
|
|
|
_ListBACKCOMMODITY.Add(_BACKCOMMODITY.PropertyObject);
|
|
}
|
|
reString = JsonHelper.ListToJson<Storage.Model.BACKCOMMODITY>(_ListBACKCOMMODITY, "APPLYCOMMODITY");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
reString = "error:" + ex.Message;
|
|
}
|
|
break;
|
|
#endregion
|
|
|
|
#region 记录商品销售日志
|
|
case "DeductStock":
|
|
reString = BusinessHelper.DeductStock(_Transaction);
|
|
break;
|
|
#endregion
|
|
|
|
default:
|
|
reString = "error";
|
|
break;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SuperMap.RealEstate.Utility.ErrorLogHelper.Write(ex);
|
|
}
|
|
finally
|
|
{
|
|
if (_Transaction.IsOpen)
|
|
{
|
|
_Transaction.Dispose();
|
|
}
|
|
}
|
|
|
|
context.Response.ContentType = "text/plain";
|
|
context.Response.Write(reString);
|
|
context.Response.End();
|
|
}
|
|
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
} |