You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
127 lines
6.0 KiB
127 lines
6.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using ICS.WCF.Base;
|
|
using ICSSoft.Entity;
|
|
|
|
namespace ICS.INVAndLotFreeze
|
|
{
|
|
public class INVFreeze
|
|
{
|
|
/// <summary>
|
|
/// 获取物料条码信息生成条码
|
|
/// </summary>
|
|
public FormICSCreatedArrivalNoticeModel CustGetMaterialOutBox(PalletMox m)
|
|
{
|
|
FormICSCreatedArrivalNoticeModel result = new FormICSCreatedArrivalNoticeModel();
|
|
try
|
|
{
|
|
StringBuilder strHead = new StringBuilder();
|
|
strHead.AppendLine("***************接口传入参数记录****************:");
|
|
strHead.AppendLine("外箱条码:" + m.CartonNO);
|
|
strHead.AppendLine("栈板条码:" + m.PalletCode);
|
|
strHead.AppendLine("传入站点:" + m.WorkPoint);
|
|
strHead.AppendLine("***************接口传入参数记录****************:");
|
|
Appconfig.WriteLogFile(strHead.ToString(), "物料栈板信息接口日志");
|
|
StringBuilder resultlog = new StringBuilder();
|
|
string SqlCartonNO = @"select * from ICSPallet where PalletCode = '" + m.PalletCode + "' ";
|
|
DataTable flag1 = DBhlper.Query(SqlCartonNO, Appconfig.GetMESStr());
|
|
if (flag1.Rows.Count <= 0)
|
|
{
|
|
string SqlLotNO = @"select * from ICSITEMLot2Carton where CartonNO = '" + m.CartonNO + "' ";
|
|
DataTable flag2 = DBhlper.Query(SqlLotNO, Appconfig.GetMESStr());
|
|
if (flag2.Rows.Count > 0)
|
|
{
|
|
string sql = string.Format(@"update ICSITEMLot2Carton set PalletNO='{0}'
|
|
where WorkPoint = '{2}'and CartonNO='{1}'",
|
|
m.PalletCode, m.CartonNO, m.WorkPoint);
|
|
int dt = DBhlper.EXecute(sql, Appconfig.GetMESStr());
|
|
if (dt == 0)
|
|
{
|
|
result.Code = -1;
|
|
result.ResMsg = "栈板条码信息添加失败,请查看日志";
|
|
result.ResData = "{}";
|
|
result.IsCompress = false;
|
|
result.IsSuccess = false;
|
|
resultlog.AppendLine("物料栈板信息添加失败");
|
|
resultlog.AppendLine("查询sql:" + sql);
|
|
Appconfig.WriteLogFile(resultlog.ToString(), "物料栈板信息接口日志");
|
|
return result;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
result.Code = -1;
|
|
result.ResMsg = "箱号不存在,信息添加失败";
|
|
result.ResData = "{}";
|
|
result.IsCompress = false;
|
|
result.IsSuccess = false;
|
|
resultlog.AppendLine("物料栈板信息添加失败");
|
|
resultlog.AppendLine("错误信息:箱号不存在,信息添加失败");
|
|
Appconfig.WriteLogFile(resultlog.ToString(), "物料栈板信息接口日志");
|
|
return result;
|
|
}
|
|
string sql2 = string.Format(@"insert into ICSPallet (Serial,PalletCode,BatchCode,palletStatus,MUSER,MUSERName,MTIME,WorkPoint)
|
|
Values
|
|
(NEWID(),'{0}','批量','成品','{1}','{2}',GETDATE(),'{3}')"
|
|
, m.PalletCode, m.MUSER, m.MUSERName, m.WorkPoint);
|
|
int dt2 = DBhlper.EXecute(sql2, Appconfig.GetMESStr());
|
|
if (dt2 > 0)
|
|
{
|
|
result.Code = 0;
|
|
result.ResMsg = "物料栈板条码创建成功";
|
|
result.ResData = "{}";
|
|
result.IsCompress = false;
|
|
result.IsSuccess = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
result.Code = -1;
|
|
result.ResMsg = "栈板已经存在,信息添加失败";
|
|
result.ResData = "{}";
|
|
result.IsCompress = false;
|
|
result.IsSuccess = false;
|
|
resultlog.AppendLine("物料栈板信息添加失败");
|
|
resultlog.AppendLine("错误信息:外箱条码不存在,信息添加失败");
|
|
Appconfig.WriteLogFile(resultlog.ToString(), "物料栈板信息接口日志");
|
|
return result;
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = -1;
|
|
result.ResMsg = "物料栈板信息获取失败,请查看日志";
|
|
result.ResData = "{}";
|
|
result.IsCompress = false;
|
|
result.IsSuccess = false;
|
|
StringBuilder str = new StringBuilder();
|
|
str.AppendLine("物料栈板信息获取失败");
|
|
str.AppendLine("外箱条码:" + m.CartonNO);
|
|
str.AppendLine("栈板条码:" + m.PalletCode);
|
|
str.AppendLine("传入站点:" + m.WorkPoint);
|
|
str.AppendLine("失败原因:" + ex.Message);
|
|
Appconfig.WriteLogFile(str.ToString(), "物料栈板信息接口日志");
|
|
}
|
|
return result;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 返回值
|
|
/// </summary>
|
|
public class FormICSCreatedArrivalNoticeModel
|
|
{
|
|
//0 :正常数据,-1:失败。
|
|
public int Code { get; set; }
|
|
public string ResMsg { get; set; }
|
|
public Object ResData { get; set; }
|
|
public bool IsCompress { get; set; }
|
|
public bool IsSuccess { get; set; }
|
|
}
|
|
}
|
|
}
|