|
|
@@ -4,10 +4,63 @@
|
|
|
RemotePackConfig::RemotePackConfig(QObject *parent) : QObject(parent)
|
|
|
{
|
|
|
connect(&_request,&HttpRequest::result,this,&RemotePackConfig::result);
|
|
|
+ parsefUNS.insert("A1000100",[this](const QJsonObject & obj){this->_config.jitai = this->getConfigStringList(obj);});
|
|
|
+
|
|
|
+ parsefUNS.insert("A1000101",[this](const QJsonObject & obj){this->_config.dangchegongbanci = this->getConfigStringList(obj);});
|
|
|
+ parsefUNS.insert("A1000102",[this](const QJsonObject & obj){this->_config.daBaoGongBanCi = this->getConfigStringList(obj);});
|
|
|
+ parsefUNS.insert("A1000103",[this](const QJsonObject & obj){this->_config.xiangzhong = this->getConfigStringDouble(obj);});
|
|
|
+ parsefUNS.insert("A1000104",[this](const QJsonObject & obj){this->_config.tongZhong = this->getConfigStringDouble(obj);});
|
|
|
+ parsefUNS.insert("A1000105",[this](const QJsonObject & obj){this->_config.guanse = this->getConfigStringList(obj);});
|
|
|
+ parsefUNS.insert("A1000106",[this](const QJsonObject & obj){this->_config.nianxiang = this->getConfigStringList(obj);});
|
|
|
+ parsefUNS.insert("A1000107",[this](const QJsonObject & obj){this->_config.zhixiang = this->getConfigStringList(obj);});
|
|
|
+ parsefUNS.insert("A1000108",[this](const QJsonObject & obj){this->_config.mashu = this->getConfigStringInt(obj);});
|
|
|
+ parsefUNS.insert("A1000109",[this](const QJsonObject & obj){this->_config.cheZhong = this->getConfigStringList(obj);});
|
|
|
+ parsefUNS.insert("A1000110",[this](const QJsonObject & obj){this->_config.gangHao = this->getConfigStringList(obj);});
|
|
|
+ parsefUNS.insert("A1000111",[this](const QJsonObject & obj){this->_config.xiangHaoXianShiGuiZe = this->getConfigInt(obj);});
|
|
|
+ parsefUNS.insert("A1000112",[this](const QJsonObject & obj){this->_config.daBaoRuku = this->getConfigBool(obj);});
|
|
|
+ parsefUNS.insert("A1000113",[this](const QJsonObject & obj){this->_config.daBaoRiQiXianShiFangShi = this->getConfigInt(obj);});
|
|
|
+ parsefUNS.insert("A2000200",[this](const QJsonObject & obj){this->_config.ziDongDushu = this->getConfigBool(obj);});
|
|
|
+ parsefUNS.insert("A2000201",[this](const QJsonObject & obj){this->_config.buDingZhongDaBaoXianzhi = this->getConfigBool(obj);});
|
|
|
+ parsefUNS.insert("A2000202",[this](const QJsonObject & obj){this->_config.dingZhongDaBaoXianZhiKaiQi = this->getConfigBool(obj);});
|
|
|
+ parsefUNS.insert("A2000203",[this](const QJsonObject & obj){this->_config.jiTaiBangDingMaDan = this->getConfigBool(obj);});
|
|
|
+ parsefUNS.insert("A2000204",[this](const QJsonObject & obj){this->_config.morenTongZhongGUDing = this->getConfigBool(obj);});
|
|
|
+ parsefUNS.insert("A2000205",[this](const QJsonObject & obj){this->_config.morenXiandhiMaoZhong = this->getConfigBool(obj);});
|
|
|
+
|
|
|
+
|
|
|
+ parsefUNS.insert("A2000206",[this](const QJsonObject & obj){this->_config.morenDaYinRuKuMadan = this->getConfigBool(obj);});
|
|
|
+ parsefUNS.insert("A2000207",[this](const QJsonObject & obj){this->_config.morenBudingZhongMaoZhongXianZhi = this->getConfigBool(obj);});
|
|
|
+ parsefUNS.insert("A2000208",[this](const QJsonObject & obj){this->_config.daBaoZhuangLeiXingGuiZeKaiQi = this->getConfigBool(obj);});
|
|
|
+ parsefUNS.insert("A2000209",[this](const QJsonObject & obj){this->_config.daBaoZhuangMaoZhongXianZhiKaiQi = this->getConfigBool(obj);});
|
|
|
+ parsefUNS.insert("A2000210",[this](const QJsonObject & obj){this->_config.ziDongDaBaoKaiQi = this->getConfigBool(obj);});
|
|
|
+ parsefUNS.insert("A2000211",[this](const QJsonObject & obj){this->_config.pingBanZiDongTongBuShuJu = this->getConfigBool(obj);});
|
|
|
+ parsefUNS.insert("A2000212",[this](const QJsonObject & obj){
|
|
|
+ auto jingdu = this->daBaoJingDu(obj);
|
|
|
+ this->_config.chengZhongJIngDu = jingdu.first;
|
|
|
+ this->_config.chengZhongJingDuMode = jingdu.second;
|
|
|
+ });
|
|
|
+
|
|
|
+ parsefUNS.insert("A2000213",[this](const QJsonObject & obj){this->_config.buDingZhongTongShuFanWei = this->getConfigpAIR(obj);});
|
|
|
+ parsefUNS.insert("A2000214",[this](const QJsonObject & obj){this->_config.dingZhongTongShuFanwei = this->getConfigpAIR(obj);});
|
|
|
+
|
|
|
+ //TODO:http://doc.vanlai.net:3001/web/#/1?page_id=57 补全剩下
|
|
|
+//http://erp.itwsw.cn/#/packageCon
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+QList<DIYPackConfig> RemotePackConfig::getDiys(const QJsonObject & data)
|
|
|
+{
|
|
|
+ // TODO:
|
|
|
+}
|
|
|
+
|
|
|
+QList<POYPackConfig> RemotePackConfig::getPoys(const QJsonObject & data)
|
|
|
+{
|
|
|
+ // TODO:
|
|
|
}
|
|
|
|
|
|
void RemotePackConfig::refConfig()
|
|
|
{
|
|
|
+ getDdengji = false;
|
|
|
GlobalInfo * glo = GlobalInfo::this_();
|
|
|
// _aid = QString::number(body["user_id"].toInt());
|
|
|
// _token = body["access_token"].toString();
|
|
|
@@ -23,63 +76,165 @@ void RemotePackConfig::result(int code, const QJsonObject & body)
|
|
|
emit configUpdateError(ecode,body.value("message").toString(""));
|
|
|
return;
|
|
|
}
|
|
|
- QJsonArray object = body.value("data").toArray();
|
|
|
- _config.jitai = getConfig(object, "A1000100");//机台
|
|
|
- _config.dangchegongbanci = getConfig(object, "A1000101");//挡车工班次
|
|
|
- _config.dabaogongbanci = getConfig(object, "A1000102");//机台
|
|
|
- _config.xiangzhong = getConfig(object, "A1000103");//箱重
|
|
|
+ if(!getDdengji){
|
|
|
+ QJsonArray object = body.value("data").toArray();
|
|
|
+ for(int i = 0; i < object.size(); ++ i){
|
|
|
+ QJsonObject obj = object.at(i).toObject();
|
|
|
+ QString key = obj.value("key").toString();
|
|
|
+ auto handle = parsefUNS.value(key,[](const QJsonObject &){});
|
|
|
+ handle(obj);
|
|
|
+ }
|
|
|
+ emit configUpdate(_config);
|
|
|
+ refDengJiList();
|
|
|
+ } else {
|
|
|
+ // TODO: 解析等级列表
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
- _config.tongzhong = getConfig(object, "A1000104");//筒重
|
|
|
+void RemotePackConfig::refDengJiList()
|
|
|
+{
|
|
|
+ // todo: http://doc.vanlai.net:3001/web/#/1?page_id=35
|
|
|
+}
|
|
|
|
|
|
- _config.guanse = getConfig(object, "A1000105");//管色
|
|
|
- _config.nianxiang = getConfig(object, "A1000106");//捻向
|
|
|
- _config.zhixiang = getConfig(object, "A1000107");//纸箱
|
|
|
- _config.mashu = getConfig(object, "A1000108");//码数
|
|
|
+bool RemotePackConfig::getConfigBool(const QJsonObject & data)
|
|
|
+{
|
|
|
+ QJsonArray value_array = data.value("value").toArray();
|
|
|
+ int vSize = value_array.size();
|
|
|
+ QString select;
|
|
|
+ for(int i = 0; i < vSize; ++i){
|
|
|
+ QJsonValue value_content = value_array.at(i);
|
|
|
+ if(value_content.isObject()){
|
|
|
+ QJsonObject value_object = value_content.toObject();
|
|
|
+ if(value_object.value("selected").toBool(false)){
|
|
|
+ select = value_object.value("name").toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// select = select.trimmed();
|
|
|
+ if(select.contains("是") || select.contains("yes",Qt::CaseInsensitive))
|
|
|
+ return true;
|
|
|
+ return false;
|
|
|
+}
|
|
|
|
|
|
- _config.chezhong = getConfig(object, "A1000109");//车重
|
|
|
+QStringList RemotePackConfig::getConfigStringList(const QJsonObject & data)
|
|
|
+{
|
|
|
+ QJsonArray value_array = data.value("value").toArray();
|
|
|
+ QStringList list;
|
|
|
+ int vSize = value_array.size();
|
|
|
+ for(int i = 0; i < vSize; ++i){
|
|
|
+ QJsonValue value_content = value_array.at(i);
|
|
|
+ if(value_content.isObject()){
|
|
|
+ QJsonObject value_object = value_content.toObject();
|
|
|
+ list.append(value_object.value("value").toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- _config.ganghao = getConfig(object, "A1000110");//缸号
|
|
|
- _config.xianghaoxianshiguize = getConfig(object, "A1000111");//箱号显示规则
|
|
|
- _config.dabaojiruku = getConfig(object, "A1000112");//打包即入库
|
|
|
+ return list;
|
|
|
+}
|
|
|
|
|
|
- _config.dabaoriqishijianxianshifangshi = getConfig(object, "A100013");//打包日期时间显示方式
|
|
|
- emit configUpdate(_config);
|
|
|
+int RemotePackConfig::getConfigInt(const QJsonObject & data)
|
|
|
+{
|
|
|
+ QJsonArray value_array = data.value("value").toArray();
|
|
|
+ int list;
|
|
|
+ int vSize = value_array.size();
|
|
|
+ for(int i = 0; i < vSize; ++i){
|
|
|
+ QJsonValue value_content = value_array.at(i);
|
|
|
+ if(value_content.isObject()){
|
|
|
+ QJsonObject value_object = value_content.toObject();
|
|
|
+ if(value_content.isObject()){
|
|
|
+ QJsonObject value_object = value_content.toObject();
|
|
|
+ if(value_object.value("selected").toBool(false)){
|
|
|
+ list = value_object.value("value").toInt();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
-QStringList RemotePackConfig::getConfig(const QJsonArray & data,const QString & key)
|
|
|
+
|
|
|
+QPair<int,int> getConfigpAIR(const QJsonObject & data)
|
|
|
{
|
|
|
-// QJsonArray data_array = data;
|
|
|
- QStringList list;
|
|
|
- int nSize = data.size();
|
|
|
- for (int i = 0; i < nSize; ++i) {
|
|
|
- QJsonValue data_content = data.at(i);
|
|
|
- if (data_content.isObject()) {
|
|
|
- QJsonObject data_object = data_content.toObject();
|
|
|
- if(data_object["key"]==key){
|
|
|
- QJsonValue value = data_object.value("value");
|
|
|
- if (value.isArray()) {
|
|
|
- QJsonArray value_array = value.toArray();
|
|
|
- int vSize = value_array.size();
|
|
|
- for(int i = 0; i < vSize; ++i){
|
|
|
- QJsonValue value_content = value_array.at(i);
|
|
|
- if(value_content.isObject()){
|
|
|
- QJsonObject value_object = value_content.toObject();
|
|
|
- QString option;
|
|
|
- if(value_object["value"].isString())
|
|
|
- {
|
|
|
- option = value_object["value"].toString();
|
|
|
- }
|
|
|
- if(value_object["value"].isDouble())
|
|
|
- {
|
|
|
- double mid_key = value_object["value"].toDouble();
|
|
|
- option = QString::number(mid_key);
|
|
|
- }
|
|
|
- list.append(option);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ QJsonArray value_array = data.value("value").toArray();
|
|
|
+ QPair<int,int> list;
|
|
|
+ int vSize = value_array.size();
|
|
|
+ bool frist = true;
|
|
|
+ for(int i = 0; i < vSize; ++i){
|
|
|
+ QJsonObject value_object = value_array.at(i).toObject();
|
|
|
+ if(value_object.value("selected").toBool(false)){
|
|
|
+ if(frist) {
|
|
|
+ list.first = value_object.value("value").toInt();
|
|
|
+ frist = false;
|
|
|
+ } else {
|
|
|
+ list.second = value_object.value("value").toInt();
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
}
|
|
|
+
|
|
|
+QPair<int,int> RemotePackConfig::daBaoJingDu(const QJsonObject & data)
|
|
|
+{
|
|
|
+ QJsonArray value_array = data.value("value").toArray();
|
|
|
+ QPair<int,int> list;
|
|
|
+ int vSize = value_array.size();
|
|
|
+ bool frist = true;
|
|
|
+ for(int i = 0; i < vSize; ++i){
|
|
|
+ QJsonValue value_content = value_array.at(i);
|
|
|
+ auto ary = value_content.toArray();
|
|
|
+ for(int j = 0; j < ary.size(); ++j){
|
|
|
+ QJsonObject value_object = ary.at(j).toObject();
|
|
|
+ if(value_object.value("selected").toBool(false)){
|
|
|
+ if(frist) {
|
|
|
+ list.first = value_object.value("value").toInt();
|
|
|
+ frist = false;
|
|
|
+ } else {
|
|
|
+ list.second = value_object.value("value").toInt();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
+}
|
|
|
+
|
|
|
+QList<double> RemotePackConfig::getConfigStringDouble(const QJsonObject & data)
|
|
|
+{
|
|
|
+ QJsonArray value_array = data.value("value").toArray();
|
|
|
+ QList<double> list;
|
|
|
+ int vSize = value_array.size();
|
|
|
+ for(int i = 0; i < vSize; ++i){
|
|
|
+ QJsonValue value_content = value_array.at(i);
|
|
|
+ if(value_content.isObject()){
|
|
|
+ QJsonObject value_object = value_content.toObject();
|
|
|
+ list.append(value_object.value("value").toDouble());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return list;
|
|
|
+}
|
|
|
+
|
|
|
+QList<int> RemotePackConfig::getConfigStringInt(const QJsonObject & data)
|
|
|
+{
|
|
|
+ QJsonArray value_array = data.value("value").toArray();
|
|
|
+ QList<int> list;
|
|
|
+ int vSize = value_array.size();
|
|
|
+ for(int i = 0; i < vSize; ++i){
|
|
|
+ QJsonValue value_content = value_array.at(i);
|
|
|
+ if(value_content.isObject()){
|
|
|
+ QJsonObject value_object = value_content.toObject();
|
|
|
+ list.append(value_object.value("value").toInt());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
return list;
|
|
|
}
|